Using the C library function interface of SQLite to access database files is similar to reading and writing files that have previously been learned. open the file with sqlite3_open and close the file with sqlite3_close, use a sqlite3 * pointer to indicate an opened database file. All queries and operations on the database are completed by passing this pointer to call the corresponding function interface. Sqlite3_exec executes SQL query on an opened database file
Typedef int (* sqlite_callback) (void * parg, int argc, char ** argv, char ** argvv );
Int sqlite3_exec (sqlite3 * dB, const char * zsql, sqlite_callback xcallback, void parg, char ** pzerrmsg );
If the zsql parameter is a SELECT query, a callback function is called for each row of the query results. The parg parameter can be used to pass a parameter to the callback function. If an error occurs, pzerrmsg points to the error message string. In the callback function, you can read the total number of columns in this row through argc, read data in each column through argv, and read the column name through argvv. If zsql is not a SELECT query, the callback function is not called.