資料庫開源ormlite

2021-07-22 08:51:48 字數 1425 閱讀 6321

用途: 運算元據庫

使用步驟

建立資料庫表結構的實體類.示例**:

@databasetable(tablename = "user")

public class user

public user(string name, int age, string tel)

}

建立ormlitesqliteopenhelper的實現類.示例**:

public class userdbopenhelper extends ormlitesqliteopenhelper 

@override

public void oncreate(sqlitedatabase database, connectionsource connectionsource) catch (sqlexception e)

}@override

public void onupgrade(sqlitedatabase database, connectionsource connectionsource, int oldversion, int newversion) catch (sqlexception e)

}private static userdbopenhelper instance;

public static synchronized userdbopenhelper getinstance(context context) }}

return instance;

}private daodao;

// 獲取運算元據庫的dao

public daogetuserdao() throws sqlexception

return dao;

}@override

public void close()

}

獲取資料庫的dao物件, 即可進行增刪改查的操作.示例**:

userdbopenhelper helper = new userdbopenhelper(this);

daodao = helper.getuserdao();

user user = new user("zhangsan", 12, "13212345678");

// 增

dao.create(user);

// 改

dao.updateraw("update user set tel = '18882348888' where name = ?", new string);

// 查

listquery = dao.queryforeq("name", "王武");

// 刪

dao.deletebyid(2);

開源資料庫有感

這個星球上的資料庫實在不勝列舉,這裡只列一些我接觸過的常見的。可以稍微誇張點說,有互動的應用,起碼得用一下資料儲存,即便是自定義結構的資料儲存,還是最常見的ini xml等,都可以算是 資料庫 真正點的,如dbase系列 foxbase foxpro msaccess interbase ms sq...

資料庫開源才是王道

毫無疑問,資料庫的專業化趨勢變得愈加明顯。這不但體現在專業的資料庫型別適應專業的工作負載,還體現在專業的dba提供專業的資料庫服務上。資料庫的多樣化 似乎在不久之前,業界還在爭論到底是通用的資料庫方向還是專業化的資料庫方向代表未來。前者的典型案例就是oracle,從一開始oracle的路線就是all...

C 開源資料庫介紹

1 前言 今天給大家介紹乙個記憶體資料庫,純c 寫的。sharphsql。這個資料庫我的意見是 對於大量高併發的情況最好還是不要用這個資料庫。可能有些朋友會問 那你還給大家介紹?呵呵,別慌,我們雖然不能在開發環境運用這個框架,但是我們可以看看他是怎麼一步一步實現了資料庫的。有些地方和oracle的邏...