輕量級資料庫框架LitePal 查詢資料

2021-07-11 00:52:14 字數 1488 閱讀 5064

第二次用litepal資料庫框架,給我的感覺是非常簡便的orm框架:1)特別是配置。2)api方法使用非常簡單 效能對比與其它的框架可能若一點點【可自行查閱資料】

news news = datasupport.find(news.class, 1);  

news firstnews = datasupport.findfirst(news.class);

查詢多條資料

listnewslist = datasupport.findall(news.class, 1, 3, 5, 7);  

long ids = new

long ;

listnewslist = datasupport.findall(news.class, ids);

listallnews = datasupport.findall(news.class);

指定條件查詢

只需要指定的字段

listnewslist = datasupport.select("title", "content")  .where("commentcount > ?", "0").find(news.class);
並且根據指定字段排序

listnewslist = datasupport.select("title", "content")  .where("commentcount > ?", "0")  .order("publishdate desc").find(news.class);
只需要前10條資料

listnewslist = datasupport.select("title", "content") .where("commentcount > ?", "0")  .order("publishdate desc").limit(10).find(news.class);
limit 所要取的記錄數目(以基準點為參考點) offset 基準點

list newslist = datasupport.select(「title」, 「content」)

.where(「commentcount > ?」, 「0」)

.order(「publishdate desc」).limit(10).offset(10)

.find(news.class);

寫 sql 語句查詢

cursor cursor = datasupport.findbysql("select * from news where commentcount>?", "

0");

C 使用sqlite 輕量級資料庫

一,準備工作 3070800.zip 就ok了precompiled binaries for windows sqlite shell win32 x86 3070800.zip 248.28 kib 用於visual studio 專案中引用 二,試用sqlite3.exe 解壓sqlite s...

android 輕量級資料庫sqlite入門

sqlite 的基本介紹 一.sqlite資料庫 1.sqlite資料庫的特點 安卓手機自帶,小巧,適合在手機中使用 不區分資料型別 主鍵除外 sql語句和mysql幾乎相同 sqlite不使用jdbc連線,使用的是android自有的api 每個資料庫對應乙個檔案 二,sqlite 資料庫的建立 ...

C 使用sqlite 輕量級資料庫

一 準備工作 precompiled binaries for windows sqlite shell win32 x86 3070800.zip 248.28 kib 用於visual studio 專案中引用 二,試用sqlite3.exe 解壓sqlite shell win32 x86 3...