Sqlite3 compilation and query

Source: Internet
Author: User

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

 

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.