1. sqlite3
Http://www.sqlite.org/
Download
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. Write and call the main function and makefile
3. Compile and run
Choose database> query> close database;
Two ways to obtain table information:
a) sqlite3_get_table
SQLITE_API *db, *zSql, ***pazResult, *pnRow, *pnColumn, **pzErrmsg sqlite3_free_table( **result);
B) sqlite3_exec
The callback function reads a row and returns it to the callback function for processing.
sqlite3_exec( db,sql, get_sqlite_table_record, NULL, &err);
SQLITE_API *, *sql, (*callback)(*,,**,**), *, **errmsg
Main Function
Get_sqlite_table_record (* para, n_column, ** column_value, ** (I =; I <n_column; I ++ get_table (* databasename, ** db = * err = ** = sqlite3_open (databasename, &-= sqlite3_get_table (db, SQL, & dbResult, & nRow, & nCol, & (rc = index = I = j = (I =; I <= nRow; I ++ (j =; j <= nCol; j ++, dbResult [index ++ dbResult = sqlite_record_call_back (* databasename, ** db = * err = rc = sqlite3_open (databasename, &-= sqlite3_exec (db, SQL, timeout, NULL, & (rc =-main (ret =-sqlitename [] = SQL _table [] = sql1 [] = sql2 [] === (ret =-= (ret =-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
If the dynamic link library of sqlite3 has been installed
You can use gcc-g-Wall-ldl-lsqlite3-lpthread-o a. out sqlite_main.o
Reference URL:
Http://www.cnblogs.com/stephen-liu74/category/348367.htmlhttp://blog.csdn.net/yoli_c_world/article/details/7939442http://blog.csdn.net/daiyelang/article/details/8641778
File: http://files.cnblogs.com/frankwz/demo_sqlite-amalgamation-3080403.zip