The
|
The Extended API
The extended API provides a range of non-
Finding Information About the SQLite Libraryconst char sqlite_version[]; Contains the current library version number. const char sqlite_encoding[]; Contains the current library encoding version. Finding Information About Changes to the DatabaseSeveral functions can return information about changes that have been made to the database. int sqlite_last_insert_rowid(sqlite *db); Returns the most recently assigned autoincrementing value of an INTEGER PRIMARY KEY field. int sqlite_changes(sqlite *db); Returns the number of rows affected by an UPDATE or DELETE statement. Checking SQL Statementsint sqlite_complete(const char *sql);
Returns
trUE
if a complete SQL statement is provided, that is, the statement ends with a semicolon. Returns
FALSE
if more
Interrupting an SQL Statementvoid sqlite_interrupt(sqlite *db); Causes the current database operation to exist at the first opportunity, returning SQLITE_INTERRUPT to the calling function. Convenience FunctionsThe following function fetches the entire result of a database query with a single function call: int sqlite_get_table( sqlite *db, char *sql, char ***result, int *nrow, int *ncolumn, char **errmsg );
The
result
will be an array of string pointers containing one element for each column of each row in the result. The first
ncolumn
elements contain the column
The return code from sqlite_get_table() is the same as if sqlite_exec() had executed the query. void sqlite_free_table(char **azResult); Frees memory allocated by sqlite_get_table() when it is no longer required. The _printf() Wrapper Functionschar *sqlite_mprintf(const char *zFormat, ...);
Works like
sprintf()
but also allows the format strings
%q
and
%Q
to manipulate strings for database storage.
%q
int sqlite_exec_printf( sqlite *db, char *sqlFormat, int (*)(void *, int, char **, char **), void *pArg, char **errmsg, ... );
Combines
sqlite_exec()
with
sqlite_mprintf()
. The format string references items from the
int sqlite_get_table_printf( sqlite *db, char *sql, char ***result, int *nrow, int *ncolumn, char **errmsg, ... ); Combines sqlite_get_table() with sqlite_mprintf() . The format string references items from the seventh argument onwards. Memory Managementvoid sqlite_freemem(void *p);
Where the library
Dealing with Locked Database Filesvoid sqlite_busy_timeout( sqlite *db, int ms );
Specifies an amount of time in
void sqlite_busy_handler( sqlite *db, int (*xBusy)(void *, const char *, int), void *pArg );
Specifies an alternative busy handler function
xBusy
. A
Performing Background Jobs During Large Queriesvoid sqlite_progress_handler( sqlite *db, int nOps, int (*xProgress)(void *), void *pArg ); Registers a callback routine xProgress to be invoked every nOps virtual machine operations during long-running query execution. |