📄 capi3ref.tcl
字号:
api {} {void sqlite3_result_blob(sqlite3_context*, const void*, int n, void(*)(void*));void sqlite3_result_double(sqlite3_context*, double);void sqlite3_result_error(sqlite3_context*, const char*, int);void sqlite3_result_error16(sqlite3_context*, const void*, int);void sqlite3_result_int(sqlite3_context*, int);void sqlite3_result_int64(sqlite3_context*, long long int);void sqlite3_result_null(sqlite3_context*);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_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 (at compile-time, not at run-time) for each attempt to access a column of a table in 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 column should be treated as a NULL value. 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 following codes is used as the second argument. The 5th argument is the name of the database ("main", "temp", etc.) if 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. 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(). 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.}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 is called to recover from a malloc() failure that occured within the SQLite library. Normally, after a single malloc() fails the library refuses to function (all major calls return SQLITE_NOMEM). This function restores the library state so that it can be used again. All existing statements (sqlite3_stmt pointers) must be finalized or reset before this call is made. Otherwise, SQLITE_BUSY is returned. If any in-memory databases are in use, either as a main or TEMP database, SQLITE_ERROR is returned. In either of these cases, the library is not reset and remains unusable. This function is *not* threadsafe. Calling this from within a threaded application when threads other than the caller have used SQLite is dangerous and will almost certainly result in malfunctions. This functionality can be omitted from a build by defining the SQLITE_OMIT_GLOBALRECOVER at compile time.}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 {} { int 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.}set n 0set i 0foreach item $apilist { set namelist [lindex $item 0] foreach name $namelist { set n_to_name($n) $name set n_to_idx($n) $i set name_to_idx($name) $i incr n } incr i}set i 0foreach name [lsort [array names name_to_idx]] { set sname($i) $name incr i}puts {<table width="100%" cellpadding="5"><tr>}set nrow [expr {($n+2)/3}]set i 0for {set j 0} {$j<3} {incr j} { if {$j>0} {puts {<td width="10"></td>}} puts {<td valign="top">} set limit [expr {$i+$nrow}] puts {<ul>} while {$i<$limit && $i<$n} { set name $sname($i) if {[regexp {^sqlite} $name]} {set display $name} {set display <i>$name</i>} puts "<li><a href=\"#$name\">$display</a></li>" incr i } puts {</ul></td>}}puts "</table>"puts "<!-- $n entries. $nrow rows in 3 columns -->"proc resolve_name {ignore_list name} { global name_to_idx if {![info exists name_to_idx($name)] || [lsearch $ignore_list $name]>=0} { return $name } else { return "<a href=\"#$name\">$name</a>" }}foreach name [lsort [array names name_to_idx]] { set i $name_to_idx($name) if {[info exists done($i)]} continue set done($i) 1 foreach {namelist prototype desc} [lindex $apilist $i] break foreach name $namelist { puts "<a name=\"$name\">" } puts "<p><hr></p>" puts "<blockquote><pre>" regsub "^( *\n)+" $prototype {} p2 regsub "(\n *)+\$" $p2 {} p3 puts $p3 puts "</pre></blockquote>" regsub -all {\[} $desc {\[} desc regsub -all {sqlite3_[a-z0-9_]+} $desc "\[resolve_name $name &\]" d2 regsub -all "\n( *\n)+" [subst $d2] "</p>\n\n<p>" d3 puts "<p>$d3</p>"}footer $rcsid
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -