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

📄 capi3ref.tcl

📁 嵌入式数据库,在嵌入式平台上实现数据库功能,没有数据引擎,符合sql92标准
💻 TCL
📖 第 1 页 / 共 5 页
字号:
void sqlite3_result_text(sqlite3_context*, const char*, int n, void(*)(void*));void sqlite3_result_text16(sqlite3_context*, const void*, int n, void(*)(void*));void sqlite3_result_text16be(sqlite3_context*, const void*, int n, void(*)(void*));void sqlite3_result_text16le(sqlite3_context*, const void*, int n, void(*)(void*));void sqlite3_result_value(sqlite3_context*, sqlite3_value*);} { User-defined functions invoke these routines in order to set their return value.  The sqlite3_result_value() routine is used to return an exact copy of one of the arguments to the function. The operation of these routines is very similar to the operation of sqlite3_bind_blob() and its cousins.  Refer to the documentation there for additional information.}api {} {int sqlite3_set_authorizer(  sqlite3*,  int (*xAuth)(void*,int,const char*,const char*,const char*,const char*),  void *pUserData);#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            */#define SQLITE_ALTER_TABLE          26   /* Database Name   Table Name      */#define SQLITE_REINDEX              27   /* Index Name      NULL            */#define SQLITE_ANALYZE              28   /* Table Name      NULL            */#define SQLITE_CREATE_VTABLE        29   /* Table Name      Module Name     */#define SQLITE_DROP_VTABLE          30   /* Table Name      Module Name     */#define SQLITE_FUNCTION             31   /* Function Name   NULL            */#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 */} { This routine registers a callback with the SQLite library.  The callback is invoked by sqlite3_prepare() to authorize various operations against the database.  The callback should return SQLITE_OK if access is allowed, SQLITE_DENY if the entire SQL statement should be aborted with an error and SQLITE_IGNORE if the operation should be treated as a no-op. Each database connection have at most one authorizer registered at a time one time.  Each call to sqlite3_set_authorizer() overrides the previous authorizer. Setting the callback to NULL disables the authorizer. The second argument to the access authorization function will be one of the defined constants shown.  These values signify what kind of operation is to be authorized.  The 3rd and 4th arguments to the authorization function will be arguments or NULL depending on which of the  codes is used as the second argument.  For example, if the the 2nd argument code is SQLITE_READ then the 3rd argument will be the name of the table that is being read from and the 4th argument will be the name of the column that is being read from.  Or if the 2nd argument is SQLITE_FUNCTION then the 3rd argument will be the name of the function that is being invoked and the 4th argument will be NULL. The 5th argument is the name of the database ("main", "temp", etc.) where applicable.  The 6th argument 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. The return value of the authorization function should be one of the constants SQLITE_OK, SQLITE_DENY, or SQLITE_IGNORE.  A return of SQLITE_OK means that the operation is permitted and that  sqlite3_prepare() can proceed as normal. A return of SQLITE_DENY means that the sqlite3_prepare() should fail with an error.  A return of SQLITE_IGNORE causes the  sqlite3_prepare() to continue as normal but the requested  operation is silently converted into a no-op.  A return of SQLITE_IGNORE in response to an SQLITE_READ or SQLITE_FUNCTION causes the column being read or the function being invoked to return a NULL. The intent of this routine is to allow applications to safely execute user-entered SQL.  An appropriate callback can deny the user-entered SQL access certain operations (ex: anything that changes the database) or to deny access to certain tables or columns within the database.}api {} {int sqlite3_step(sqlite3_stmt*);} { After an SQL query has been prepared with a call to either sqlite3_prepare() or sqlite3_prepare16(), then this function must be called one or more times to execute the statement. The return value will be either SQLITE_BUSY, SQLITE_DONE,  SQLITE_ROW, SQLITE_ERROR, or SQLITE_MISUSE. SQLITE_BUSY means that the database engine attempted to open a locked database and there is no busy callback registered. Call sqlite3_step() again to retry the open. SQLITE_DONE means that the statement has finished executing successfully.  sqlite3_step() should not be called again on this virtual machine without first calling sqlite3_reset() to reset the virtual machine back to its initial state. If the SQL statement being executed returns any data, then  SQLITE_ROW is returned each time a new row of data is ready for processing by the caller. The values may be accessed using the sqlite3_column_*() functions. sqlite3_step() is called again to retrieve the next row of data.  SQLITE_ERROR means that a run-time error (such as a constraint violation) has occurred.  sqlite3_step() should not be called again on the VM. More information may be found by calling sqlite3_errmsg(). A more specific error code (example: SQLITE_INTERRUPT, SQLITE_SCHEMA, SQLITE_CORRUPT, and so forth) can be obtained by calling sqlite3_reset() on the prepared statement. SQLITE_MISUSE means that the this routine was called inappropriately. Perhaps it was called on a virtual machine that had already been finalized or on one that had previously returned SQLITE_ERROR or SQLITE_DONE.  Or it could be the case that a database connection is being used by a different thread than the one it was created it. <b>Goofy Interface Alert:</b> The sqlite3_step() API always returns a generic error code, SQLITE_ERROR, following any error other than SQLITE_BUSY and SQLITE_MISUSE. You must call sqlite3_reset() (or sqlite3_finalize()) in order to find the specific error code that better describes the error.  We admit that this is a goofy design.  Sqlite3_step() would be much easier to use if it returned the specific error code directly.  But we cannot change that now without breaking backwards compatibility. Note that there is never any harm in calling sqlite3_reset() after getting back an SQLITE_ERROR from sqlite3_step().  Any API that can be used after an sqlite3_step() can also be used after sqlite3_reset(). You may want to create a simple wrapper around sqlite3_step() to make this easier.  For example: <blockquote><pre>    int less_goofy_sqlite3_step(sqlite3_stmt *pStatement){      int rc;      rc = sqlite3_step(pStatement);      if( rc==SQLITE_ERROR ){        rc = sqlite3_reset(pStatement);      }      return rc;    } </pre></blockquote> Simply substitute the less_goofy_sqlite3_step() call above for  the normal sqlite3_step() everywhere in your code, and you will always get back the specific error code rather than a generic SQLITE_ERROR error code.}api {} {void *sqlite3_trace(sqlite3*, void(*xTrace)(void*,const char*), void*);} { Register a function that is called each time an SQL statement is evaluated. The callback function is invoked on the first call to sqlite3_step() after calls to sqlite3_prepare() or sqlite3_reset(). This function can be used (for example) to generate a log file of all SQL executed against a database.  This can be useful when debugging an application that uses SQLite.}api {} {void *sqlite3_user_data(sqlite3_context*);} { The pUserData argument to the sqlite3_create_function() and sqlite3_create_function16() routines used to register user functions is available to the implementation of the function using this call.}api {} {const void *sqlite3_value_blob(sqlite3_value*);int sqlite3_value_bytes(sqlite3_value*);int sqlite3_value_bytes16(sqlite3_value*);double sqlite3_value_double(sqlite3_value*);int sqlite3_value_int(sqlite3_value*);long long int sqlite3_value_int64(sqlite3_value*);const unsigned char *sqlite3_value_text(sqlite3_value*);const void *sqlite3_value_text16(sqlite3_value*);const void *sqlite3_value_text16be(sqlite3_value*);const void *sqlite3_value_text16le(sqlite3_value*);int sqlite3_value_type(sqlite3_value*);} { This group of routines returns information about arguments to a user-defined function.  Function implementations use these routines to access their arguments.  These routines are the same as the sqlite3_column_... routines except that these routines take a single sqlite3_value* pointer instead of an sqlite3_stmt* and an integer column number. See the documentation under sqlite3_column_blob for additional information.}api {} {  int sqlite3_sleep(int);} { Sleep for a little while. The second parameter is the number of miliseconds to sleep for.  If the operating system does not support sleep requests with  milisecond time resolution, then the time will be rounded up to  the nearest second. The number of miliseconds of sleep actually  requested from the operating system is returned.}api {} {  int sqlite3_expired(sqlite3_stmt*);} { Return TRUE (non-zero) if the statement supplied as an argument needs to be recompiled.  A statement needs to be recompiled whenever the execution environment changes in a way that would alter the program that sqlite3_prepare() generates.  For example, if new functions or collating sequences are registered or if an authorizer function is added or changed.}api {} {  int sqlite3_transfer_bindings(sqlite3_stmt*, sqlite3_stmt*);} { Move all bindings from the first prepared statement over to the second. This routine is useful, for example, if the first prepared statement fails with an SQLITE_SCHEMA error.  The same SQL can be prepared into the second prepared statement then all of the bindings transfered over to the second statement before the first statement is finalized.}api {} {  int sqlite3_global_recover();} { This function used to be involved in recovering from out-of-memory errors.  But as of SQLite version 3.3.0, out-of-memory recovery is automatic and this routine now does nothing.  THe interface is retained to avoid link errors with legacy code.}api {} {  int sqlite3_get_autocommit(sqlite3*);} { Test to see whether or not the database connection is in autocommit mode.  Return TRUE if it is and FALSE if not.  Autocommit mode is on by default.  Autocommit is disabled by a BEGIN statement and reenabled by the next COMMIT or ROLLBACK.}api {} {  int sqlite3_clear_bindings(sqlite3_stmt*);} { Set all the parameters in the compiled SQL statement back to NULL.}api {} {  sqlite3 *sqlite3_db_handle(sqlite3_stmt*);} { Return the sqlite3* database handle to which the prepared statement given in the argument belongs.  This is the same database handle that was the first argument to the sqlite3_prepare() that was used to create the statement in the first place.}api {} {  void *sqlite3_update_hook(    sqlite3*,     void(*)(void *,int ,char const *,char const *,sqlite_int64),    void*  );} { Register a callback function with the database connection identified by the  first argument to be invoked whenever a row is updated, inserted or deleted. Any callback set by a previous call to this function for the same  database connection is overridden. The second argument is a pointer to the function to invoke when a  row is updated, inserted or deleted. The first argument to the callback is a copy of the third argument to sqlite3_update_hook. The second callback  argument is one of SQLITE_INSERT, SQLITE_DELETE or SQLITE_UPDATE, depending on the operation that caused the callback to be invoked. The third and  fourth arguments to the callback contain pointers to the database and  table name containing the affected row. The final callback parameter is  the rowi

⌨️ 快捷键说明

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