1、sqlite3
http://www.sqlite.org/
下載
wget http://www.sqlite.org/2014/sqlite-amalgamation-3080403.zip
tar xvf http://www.sqlite.org/2014/sqlite-amalgamation-3080403.zip
cd sqlite-amalgamation-3080403
2、寫調用main函數和makefile
3、編譯運行
打開數據庫->查詢-> 關閉數據庫;
獲取表信息2種方式:
a) sqlite3_get_table
SQLITE_API *db, *zSql, ***pazResult, *pnRow, *pnColumn, **pzErrmsg sqlite3_free_table( **result);
b)sqlite3_exec
回調函數,讀取一行返回給回調函數處理
sqlite3_exec( db,sql, get_sqlite_table_record, NULL, &err);
SQLITE_API *, *sql, (*callback)(*,,**,**), *, **errmsg
main函數View Code
Makefile
CC=gcc -g --rf *.o a.-ldl -lpthread -o a.---`date +%Y%m%d%H%M%s`.tar.gz *.c *.h Makefile *.db
如果已經安裝sqlite3的動態鏈接庫
可通過 gcc -g -Wall -ldl -lsqlite3 -lpthread -o a.out sqlite_main.o
參考網址:
http://www.cnblogs.com/stephen-liu74/category/348367.html http://blog.csdn.net/yoli_c_world/article/details/7939442 http://blog.csdn.net/daiyelang/article/details/8641778
file:http://files.cnblogs.com/frankwz/demo_sqlite-amalgamation-3080403.zip