📄 sqlite.h.in
字号:
** of this buffer if desired.*/char *sqlite_set_result_string(sqlite_func*,const char*,int);void sqlite_set_result_int(sqlite_func*,int);void sqlite_set_result_double(sqlite_func*,double);void sqlite_set_result_error(sqlite_func*,const char*,int);/*** The pUserData parameter to the sqlite_create_function() and** sqlite_create_aggregate() routines used to register user functions** is available to the implementation of the function using this** call.*/void *sqlite_user_data(sqlite_func*);/*** Aggregate functions use the following routine to allocate** a structure for storing their state. The first time this routine** is called for a particular aggregate, a new structure of size nBytes** is allocated, zeroed, and returned. On subsequent calls (for the** same aggregate instance) the same buffer is returned. The implementation** of the aggregate can use the returned buffer to accumulate data.**** The buffer allocated is freed automatically be SQLite.*/void *sqlite_aggregate_context(sqlite_func*, int nBytes);/*** The next routine returns the number of calls to xStep for a particular** aggregate function instance. The current call to xStep counts so this** routine always returns at least 1.*/int sqlite_aggregate_count(sqlite_func*);/*** This routine registers a callback with the SQLite library. The** callback is invoked (at compile-time, not at run-time) for each** attempt to access a column of a table in the database. The callback** returns SQLITE_OK if access is allowed, SQLITE_DENY if the entire** SQL statement should be aborted with an error and SQLITE_IGNORE** if the column should be treated as a NULL value.*/int sqlite_set_authorizer( sqlite*, int (*xAuth)(void*,int,const char*,const char*,const char*,const char*), void *pUserData);/*** The second parameter to the access authorization function above will** be one of the values below. These values signify what kind of operation** is to be authorized. The 3rd and 4th parameters to the authorization** function will be parameters or NULL depending on which of the following** codes is used as the second parameter. The 5th parameter is the name** of the database ("main", "temp", etc.) if applicable. The 6th parameter** is the name of the inner-most trigger or view that is responsible for** the access attempt or NULL if this access attempt is directly from ** input SQL code.**** Arg-3 Arg-4*/#define SQLITE_COPY 0 /* Table Name File Name */#define SQLITE_CREATE_INDEX 1 /* Index Name Table Name */#define SQLITE_CREATE_TABLE 2 /* Table Name NULL */#define SQLITE_CREATE_TEMP_INDEX 3 /* Index Name Table Name */#define SQLITE_CREATE_TEMP_TABLE 4 /* Table Name NULL */#define SQLITE_CREATE_TEMP_TRIGGER 5 /* Trigger Name Table Name */#define SQLITE_CREATE_TEMP_VIEW 6 /* View Name NULL */#define SQLITE_CREATE_TRIGGER 7 /* Trigger Name Table Name */#define SQLITE_CREATE_VIEW 8 /* View Name NULL */#define SQLITE_DELETE 9 /* Table Name NULL */#define SQLITE_DROP_INDEX 10 /* Index Name Table Name */#define SQLITE_DROP_TABLE 11 /* Table Name NULL */#define SQLITE_DROP_TEMP_INDEX 12 /* Index Name Table Name */#define SQLITE_DROP_TEMP_TABLE 13 /* Table Name NULL */#define SQLITE_DROP_TEMP_TRIGGER 14 /* Trigger Name Table Name */#define SQLITE_DROP_TEMP_VIEW 15 /* View Name NULL */#define SQLITE_DROP_TRIGGER 16 /* Trigger Name Table Name */#define SQLITE_DROP_VIEW 17 /* View Name NULL */#define SQLITE_INSERT 18 /* Table Name NULL */#define SQLITE_PRAGMA 19 /* Pragma Name 1st arg or NULL */#define SQLITE_READ 20 /* Table Name Column Name */#define SQLITE_SELECT 21 /* NULL NULL */#define SQLITE_TRANSACTION 22 /* NULL NULL */#define SQLITE_UPDATE 23 /* Table Name Column Name */#define SQLITE_ATTACH 24 /* Filename NULL */#define SQLITE_DETACH 25 /* Database Name NULL *//*** The return value of the authorization function should be one of the** following constants:*//* #define SQLITE_OK 0 // Allow access (This is actually defined above) */#define SQLITE_DENY 1 /* Abort the SQL statement with an error */#define SQLITE_IGNORE 2 /* Don't allow access, but don't generate an error *//*** Register a function that is called at every invocation of sqlite_exec()** or sqlite_compile(). This function can be used (for example) to generate** a log file of all SQL executed against a database.*/void *sqlite_trace(sqlite*, void(*xTrace)(void*,const char*), void*);/*** The Callback-Free API** ** The following routines implement a new way to access SQLite that does not** involve the use of callbacks.**** An sqlite_vm is an opaque object that represents a single SQL statement** that is ready to be executed.*/typedef struct sqlite_vm sqlite_vm;/*** To execute an SQLite query without the use of callbacks, you first have** to compile the SQL using this routine. The 1st parameter "db" is a pointer** to an sqlite object obtained from sqlite_open(). The 2nd parameter** "zSql" is the text of the SQL to be compiled. The remaining parameters** are all outputs.**** *pzTail is made to point to the first character past the end of the first** SQL statement in zSql. This routine only compiles the first statement** in zSql, so *pzTail is left pointing to what remains uncompiled.**** *ppVm is left pointing to a "virtual machine" that can be used to execute** the compiled statement. Or if there is an error, *ppVm may be set to NULL.** If the input text contained no SQL (if the input is and empty string or** a comment) then *ppVm is set to NULL.**** If any errors are detected during compilation, an error message is written** into space obtained from malloc() and *pzErrMsg is made to point to that** error message. The calling routine is responsible for freeing the text** of this message when it has finished with it. Use sqlite_freemem() to** free the message. pzErrMsg may be NULL in which case no error message** will be generated.**** On success, SQLITE_OK is returned. Otherwise and error code is returned.*/int sqlite_compile( sqlite *db, /* The open database */ const char *zSql, /* SQL statement to be compiled */ const char **pzTail, /* OUT: uncompiled tail of zSql */ sqlite_vm **ppVm, /* OUT: the virtual machine to execute zSql */ char **pzErrmsg /* OUT: Error message. */);/*** After an SQL statement has been compiled, it is handed to this routine** to be executed. This routine executes the statement as far as it can** go then returns. The return value will be one of SQLITE_DONE,** SQLITE_ERROR, SQLITE_BUSY, SQLITE_ROW, or SQLITE_MISUSE.**** SQLITE_DONE means that the execute of the SQL statement is complete** an no errors have occurred. sqlite_step() should not be called again** for the same virtual machine. *pN is set to the number of columns in** the result set and *pazColName is set to an array of strings that** describe the column names and datatypes. The name of the i-th column** is (*pazColName)[i] and the datatype of the i-th column is** (*pazColName)[i+*pN]. *pazValue is set to NULL.**** SQLITE_ERROR means that the virtual machine encountered a run-time** error. sqlite_step() should not be called again for the same** virtual machine. *pN is set to 0 and *pazColName and *pazValue are set** to NULL. Use sqlite_finalize() to obtain the specific error code** and the error message text for the error.**** SQLITE_BUSY means that an attempt to open the database failed because** another thread or process is holding a lock. The calling routine** can try again to open the database by calling sqlite_step() again.** The return code will only be SQLITE_BUSY if no busy handler is registered** using the sqlite_busy_handler() or sqlite_busy_timeout() routines. If** a busy handler callback has been registered but returns 0, then this** routine will return SQLITE_ERROR and sqltie_finalize() will return** SQLITE_BUSY when it is called.**** SQLITE_ROW means that a single row of the result is now available.** The data is contained in *pazValue. The value of the i-th column is** (*azValue)[i]. *pN and *pazColName are set as described in SQLITE_DONE.** Invoke sqlite_step() again to advance to the next row.**** SQLITE_MISUSE is returned if sqlite_step() is called incorrectly.** For example, if you call sqlite_step() after the virtual machine** has halted (after a prior call to sqlite_step() has returned SQLITE_DONE)** or if you call sqlite_step() with an incorrectly initialized virtual** machine or a virtual machine that has been deleted or that is associated** with an sqlite structure that has been closed.*/int sqlite_step( sqlite_vm *pVm, /* The virtual machine to execute */ int *pN, /* OUT: Number of columns in result */ const char ***pazValue, /* OUT: Column data */ const char ***pazColName /* OUT: Column names and datatypes */);/*** This routine is called to delete a virtual machine after it has finished** executing. The return value is the result code. SQLITE_OK is returned** if the statement executed successfully and some other value is returned if** there was any kind of error. If an error occurred and pzErrMsg is not** NULL, then an error message is written into memory obtained from malloc()** and *pzErrMsg is made to point to that error message. The calling routine** should use sqlite_freemem() to delete this message when it has finished** with it.**** This routine can be called at any point during the execution of the** virtual machine. If the virtual machine has not completed execution** when this routine is called, that is like encountering an error or** an interrupt. (See sqlite_interrupt().) Incomplete updates may be** rolled back and transactions cancelled, depending on the circumstances,** and the result code returned will be SQLITE_ABORT.*/int sqlite_finalize(sqlite_vm*, char **pzErrMsg);/*** This routine deletes the virtual machine, writes any error message to** *pzErrMsg and returns an SQLite return code in the same way as the** sqlite_finalize() function.**** Additionally, if ppVm is not NULL, *ppVm is left pointing to a new virtual** machine loaded with the compiled version of the original query ready for** execution.**** If sqlite_reset() returns SQLITE_SCHEMA, then *ppVm is set to NULL.********* THIS IS AN EXPERIMENTAL API AND IS SUBJECT TO CHANGE *******/int sqlite_reset(sqlite_vm *, char **pzErrMsg, sqlite_vm **ppVm);#ifdef __cplusplus} /* End of the 'extern "C"' block */#endif#endif /* _SQLITE_H_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -