⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sqlite.h

📁 sqlite数据库管理系统开放源码
💻 H
📖 第 1 页 / 共 3 页
字号:
#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);/*** If the SQL that was handed to sqlite_compile contains variables that** are represeted in the SQL text by a question mark ('?').  This routine** is used to assign values to those variables.**** The first parameter is a virtual machine obtained from sqlite_compile().** The 2nd "idx" parameter determines which variable in the SQL statement** to bind the value to.  The left most '?' is 1.  The 3rd parameter is** the value to assign to that variable.  The 4th parameter is the number** of bytes in the value, including the terminating \000 for strings.** Finally, the 5th "copy" parameter is TRUE if SQLite should make its** own private copy of this value, or false if the space that the 3rd** parameter points to will be unchanging and can be used directly by** SQLite.**** Unbound variables are treated as having a value of NULL.  To explicitly** set a variable to NULL, call this routine with the 3rd parameter as a** NULL pointer.**** If the 4th "len" parameter is -1, then strlen() is used to find the** length.**** This routine can only be called immediately after sqlite_compile()** or sqlite_reset() and before any calls to sqlite_step().********* THIS IS AN EXPERIMENTAL API AND IS SUBJECT TO CHANGE *******/int sqlite_bind(sqlite_vm*, int idx, const char *value, int len, int copy);/*** This routine configures a callback function - the progress callback - that** is invoked periodically during long running calls to sqlite_exec(),** sqlite_step() and sqlite_get_table(). An example use for this API is to keep** a GUI updated during a large query.**** The progress callback is invoked once for every N virtual machine opcodes,** where N is the second argument to this function. The progress callback** itself is identified by the third argument to this function. The fourth** argument to this function is a void pointer passed to the progress callback** function each time it is invoked.**** If a call to sqlite_exec(), sqlite_step() or sqlite_get_table() results ** in less than N opcodes being executed, then the progress callback is not** invoked.** ** Calling this routine overwrites any previously installed progress callback.** To remove the progress callback altogether, pass NULL as the third** argument to this function.**** If the progress callback returns a result other than 0, then the current ** query is immediately terminated and any database changes rolled back. If the** query was part of a larger transaction, then the transaction is not rolled** back and remains active. The sqlite_exec() call returns SQLITE_ABORT. ********* THIS IS AN EXPERIMENTAL API AND IS SUBJECT TO CHANGE *******/void sqlite_progress_handler(sqlite*, int, int(*)(void*), void*);/*** Register a callback function to be invoked whenever a new transaction** is committed.  The pArg argument is passed through to the callback.** callback.  If the callback function returns non-zero, then the commit** is converted into a rollback.**** If another function was previously registered, its pArg value is returned.** Otherwise NULL is returned.**** Registering a NULL function disables the callback.********* THIS IS AN EXPERIMENTAL API AND IS SUBJECT TO CHANGE *******/void *sqlite_commit_hook(sqlite*, int(*)(void*), void*);/*** Open an encrypted SQLite database.  If pKey==0 or nKey==0, this routine** is the same as sqlite_open().**** The code to implement this API is not available in the public release** of SQLite.*/sqlite *sqlite_open_encrypted(  const char *zFilename,   /* Name of the encrypted database */  const void *pKey,        /* Pointer to the key */  int nKey,                /* Number of bytes in the key */  int *pErrcode,           /* Write error code here */  char **pzErrmsg          /* Write error message here */);/*** Change the key on an open database.  If the current database is not** encrypted, this routine will encrypt it.  If pNew==0 or nNew==0, the** database is decrypted.**** The code to implement this API is not available in the public release** of SQLite.*/int sqlite_rekey(  sqlite *db,                    /* Database to be rekeyed */  const void *pKey, int nKey     /* The new key */);/*** Encode a binary buffer "in" of size n bytes so that it contains** no instances of characters '\'' or '\000'.  The output is ** null-terminated and can be used as a string value in an INSERT** or UPDATE statement.  Use sqlite_decode_binary() to convert the** string back into its original binary.**** The result is written into a preallocated output buffer "out".** "out" must be able to hold at least 2 +(257*n)/254 bytes.** In other words, the output will be expanded by as much as 3** bytes for every 254 bytes of input plus 2 bytes of fixed overhead.** (This is approximately 2 + 1.0118*n or about a 1.2% size increase.)**** The return value is the number of characters in the encoded** string, excluding the "\000" terminator.**** If out==NULL then no output is generated but the routine still returns** the number of characters that would have been generated if out had** not been NULL.*/int sqlite_encode_binary(const unsigned char *in, int n, unsigned char *out);/*** Decode the string "in" into binary data and write it into "out".** This routine reverses the encoding created by sqlite_encode_binary().** The output will always be a few bytes less than the input.  The number** of bytes of output is returned.  If the input is not a well-formed** encoding, -1 is returned.**** The "in" and "out" parameters may point to the same buffer in order** to decode a string in place.*/int sqlite_decode_binary(const unsigned char *in, unsigned char *out);#ifdef __cplusplus}  /* End of the 'extern "C"' block */#endif#endif /* _SQLITE_H_ */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -