More questions welcome to my forum and exchange http://tcwin.yuxa.com/vbs/
1. Open the database:
Note: open a database. If it does not exist, it is automatically created. The first parameter specifies the file name, and the second parameter is the sqlite3 ** ppdb struct pointer you have defined. It is not necessary to know what the struct is, we only need to know that it is equivalent to a database handle.
Int sqlite3_open (
Const char * filename,/* Database Name (UTF-8 )*/
Sqlite3 ** ppdb/* Out: SQLite database handle */
);
2. Shut down the database:
Description: The parameter is the OODB handle obtained by sqlite3_open. You can call this function to close the database.
Int sqlite3_close (sqlite3 *); // The parameter is the structure just obtained, that is, the database handle.
3. Execute SQL:
Note: This function is used to execute one or more SQL statements separated by the ";" sign. We recommend that you specify the third parameter callback function when executing one or more SQL statements. In the callback function, you can obtain detailed procedures for executing SQL statements, if all SQL statements are executed, 0 is returned. Otherwise, the execution is not completely successful.
Fifth parameter: if the execution fails (no 0 is returned), you can view the fifth elaborated value. To view detailed error information.
Int sqlite3_exec (
Sqlite3 *,/* opened database handle */
Const char * SQL,/* SQL statement to be executed */
Sqlite_callback,/* callback function */
Void *,/* parameters passed to the callback function */
Char ** errmsg/* save error message */
);
4. Take the current insert position:
Function: return the last time you inserted the data. Starting from 1, sqlite3 * opens the database for you to get the handle.
Long long int sqlite3_last_insert_rowid (sqlite3 *);
5. Execute an SQL query:
Function: execute a query SQL statement and return a record set.
Int sqlite3_get_table (
Sqlite3 *,/* opened database handle */
Const char * SQL,/* SQL statement to be executed */
Char *** resultp,/* Save the pointer to the returned record set */
Int * nrow,/* Number of returned records */
Int * ncolumn,/* Number of returned fields */
Char ** errmsg/* error message returned */
)
6. Release query results:
Function: releases the memory occupied by the currently queried record set.
Void sqlite3_free_table (char ** result );