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

📄 capi3ref.tcl.old

📁 sqlite-3.4.1,嵌入式数据库.是一个功能强大的开源数据库,给学习和研发以及小型公司的发展带来了全所未有的好处.
💻 OLD
📖 第 1 页 / 共 5 页
字号:
set rcsid {$Id: capi3ref.tcl,v 1.60 2007/05/19 06:48:43 danielk1977 Exp $}source common.tclheader {C/C++ Interface For SQLite Version 3}puts {<h2 class=pdf_section>C/C++ Interface For SQLite Version 3</h2>}proc api {name prototype desc {notused x}} {  global apilist specialname  if {$name==""} {    regsub -all {sqlite3_[a-z0-9_]+\(} $prototype \      {[lappend name [string trimright & (]]} x1    subst $x1  } else {    lappend specialname $name  }  lappend apilist [list $name $prototype $desc]}api {extended-result-codes} {#define SQLITE_IOERR_READ       #define SQLITE_IOERR_SHORT_READ #define SQLITE_IOERR_WRITE      #define SQLITE_IOERR_FSYNC      #define SQLITE_IOERR_DIR_FSYNC  #define SQLITE_IOERR_TRUNCATE   #define SQLITE_IOERR_FSTAT      #define SQLITE_IOERR_UNLOCK     #define SQLITE_IOERR_RDLOCK     #define SQLITE_IOERR_BLOCKED...} {In its default configuration, SQLite API routines return one of 26 integerresult codes described at result-codes.  However, experience has shown thatmany of these result codes are too course-grained.  They do not provide asmuch information about problems as users might like.  In an effort toaddress this, newer versions of SQLite (version 3.3.8 and later) includesupport for additional result codes that provide more detailed informationabout errors.  The extended result codes are enabled (or disabled) for each databaseconnection using the sqlite3_extended_result_codes() API.Some of the available extended result codes are listed above.We expect the number of extended result codes will be expandover time.  Software that uses extended result codes should expectto see new result codes in future releases of SQLite.The symbolic name for an extended result code always contains a relatedprimary result code as a prefix.  Primary result codes contain a single"_" character.  Extended result codes contain two or more "_" characters.The numeric value of an extended result code can be converted to itscorresponding primary result code by masking off the lower 8 bytes.A complete list of available extended result codes anddetails about the meaning of the various extended result codes can befound by consulting the C code, especially the sqlite3.h headerfile and its antecedent sqlite.h.in.  Additional informationis also available at the SQLite wiki:http://www.sqlite.org/cvstrac/wiki?p=ExtendedResultCodes}api {result-codes} {#define SQLITE_OK           0   /* Successful result */#define SQLITE_ERROR        1   /* SQL error or missing database */#define SQLITE_INTERNAL     2   /* An internal logic error in SQLite */#define SQLITE_PERM         3   /* Access permission denied */#define SQLITE_ABORT        4   /* Callback routine requested an abort */#define SQLITE_BUSY         5   /* The database file is locked */#define SQLITE_LOCKED       6   /* A table in the database is locked */#define SQLITE_NOMEM        7   /* A malloc() failed */#define SQLITE_READONLY     8   /* Attempt to write a readonly database */#define SQLITE_INTERRUPT    9   /* Operation terminated by sqlite_interrupt() */#define SQLITE_IOERR       10   /* Some kind of disk I/O error occurred */#define SQLITE_CORRUPT     11   /* The database disk image is malformed */#define SQLITE_NOTFOUND    12   /* (Internal Only) Table or record not found */#define SQLITE_FULL        13   /* Insertion failed because database is full */#define SQLITE_CANTOPEN    14   /* Unable to open the database file */#define SQLITE_PROTOCOL    15   /* Database lock protocol error */#define SQLITE_EMPTY       16   /* (Internal Only) Database table is empty */#define SQLITE_SCHEMA      17   /* The database schema changed */#define SQLITE_TOOBIG      18   /* Too much data for one row of a table */#define SQLITE_CONSTRAINT  19   /* Abort due to constraint violation */#define SQLITE_MISMATCH    20   /* Data type mismatch */#define SQLITE_MISUSE      21   /* Library used incorrectly */#define SQLITE_NOLFS       22   /* Uses OS features not supported on host */#define SQLITE_AUTH        23   /* Authorization denied */#define SQLITE_ROW         100  /* sqlite_step() has another row ready */#define SQLITE_DONE        101  /* sqlite_step() has finished executing */} {Many SQLite functions return an integer result code from the set shownabove in order to indicates success or failure.The result codes above are the only ones returned by SQLite in itsdefault configuration.  However, the sqlite3_extended_result_codes()API can be used to set a database connectoin to return more detailedresult codes.  See the documentation on sqlite3_extended_result_codes()or extended-result-codes for additional information.}api {} {  int sqlite3_extended_result_codes(sqlite3*, int onoff);} {This routine enables or disabled extended-result-codes feature.By default, SQLite API routines return one of only 26 integerresult codes described at result-codes.  When extended result codesare enabled by this routine, the repetoire of result codes can bemuch larger and can (hopefully) provide more detailed informationabout the cause of an error.The second argument is a boolean value that turns extended resultcodes on and off.  Extended result codes are off by default forbackwards compatibility with older versions of SQLite.}api {} {  const char *sqlite3_libversion(void);} {  Return a pointer to a string which contains the version number of  the library.  The same string is available in the global  variable named "sqlite3_version".  This interface is provided since  windows is unable to access global variables in DLLs.}api {} {  void *sqlite3_aggregate_context(sqlite3_context*, int nBytes);} {  Aggregate functions use this 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 is freed automatically by SQLite when the query that  invoked the aggregate function terminates.}api {} {  int sqlite3_aggregate_count(sqlite3_context*);} {  This function is deprecated.   It continues to exist so as not to  break any legacy code that might happen to use it.  But it should not  be used in any new code.  In order to encourage people to not use this function, we are not going  to tell you what it does.}api {} {  int sqlite3_bind_blob(sqlite3_stmt*, int, const void*, int n, void(*)(void*));  int sqlite3_bind_double(sqlite3_stmt*, int, double);  int sqlite3_bind_int(sqlite3_stmt*, int, int);  int sqlite3_bind_int64(sqlite3_stmt*, int, long long int);  int sqlite3_bind_null(sqlite3_stmt*, int);  int sqlite3_bind_text(sqlite3_stmt*, int, const char*, int n, void(*)(void*));  int sqlite3_bind_text16(sqlite3_stmt*, int, const void*, int n, void(*)(void*)  int sqlite3_bind_value(sqlite3_stmt*, int, const sqlite3_value*);  int sqlite3_bind_zeroblob(sqlite3_stmt*, int, int n););  #define SQLITE_STATIC      ((void(*)(void *))0)  #define SQLITE_TRANSIENT   ((void(*)(void *))-1)} { In the SQL strings input to sqlite3_prepare_v2() and sqlite3_prepare16_v2(), one or more literals can be replace by a parameter "?" or "?NNN" or ":AAA" or "@AAA" or "\$VVV" where NNN is an integer literal, AAA is an alphanumeric identifier and VVV is a variable name according to the syntax rules of the TCL programming language. The values of these parameters (also called "host parameter names") can be set using the sqlite3_bind_*() routines. The first argument to the sqlite3_bind_*() routines always is a pointer to the sqlite3_stmt structure returned from sqlite3_prepare_v2().  The second argument is the index of the parameter to be set.  The first parameter has an index of 1. When the same named parameter is used more than once, second and subsequent occurrences have the same index as the first occurrence.  The index for named parameters can be looked up using the sqlite3_bind_parameter_name() API if desired.  The index for "?NNN" parametes is the value of NNN. The NNN value must be between 1 and the compile-time parameter SQLITE_MAX_VARIABLE_NUMBER (default value: 999). See <a href="limits.html">limits.html</a> for additional information. The third argument is the value to bind to the parameter. In those routines that have a fourth argument, its value is the number of bytes in the parameter.  To be clear: the value is the number of bytes in the string, not the number of characters.  The number of bytes does not include the zero-terminator at the end of strings. If the fourth parameter is negative, the length of the string is number of bytes up to the first zero terminator. The fifth argument to sqlite3_bind_blob(), sqlite3_bind_text(), and sqlite3_bind_text16() is a destructor used to dispose of the BLOB or text after SQLite has finished with it.  If the fifth argument is the special value SQLITE_STATIC, then the library assumes that the information is in static, unmanaged space and does not need to be freed.  If the fifth argument has the value SQLITE_TRANSIENT, then SQLite makes its own private copy of the data immediately, before the sqlite3_bind_*() routine returns. The sqlite3_bind_zeroblob() routine binds a BLOB of length n that is filled with zeros.  A zeroblob uses a fixed amount of memory (just an integer to hold it size) while it is being processed. Zeroblobs are intended to serve as place-holders for BLOBs whose content is later written using increment BLOB I/O routines.  See sqlite3_blob_open() and sqlite3_blob_write() for additional information. The sqlite3_bind_*() routines must be called after sqlite3_prepare_v2() or sqlite3_reset() and before sqlite3_step(). Bindings are not cleared by the sqlite3_reset() routine. Unbound parameters are interpreted as NULL. These routines return SQLITE_OK on success or an error code if anything goes wrong.  SQLITE_RANGE is returned if the parameter index is out of range.  SQLITE_NOMEM is returned if malloc fails. SQLITE_MISUSE is returned if these routines are called on a virtual machine that is the wrong state or which has already been finalized.}api {} {  int sqlite3_bind_parameter_count(sqlite3_stmt*);} {  Return the largest host parameter index in the precompiled statement given  as the argument.  When the host parameters are of the forms like ":AAA"  or "?", then they are assigned sequential increasing numbers beginning  with one, so the value returned is the number of parameters.  However  if the same host parameter name is used multiple times, each occurrance  is given the same number, so the value returned in that case is the number  of unique host parameter names.  If host parameters of the form "?NNN"  are used (where NNN is an integer) then there might be gaps in the  numbering and the value returned by this interface is the index of the  host parameter with the largest index value.}api {} {  const char *sqlite3_bind_parameter_name(sqlite3_stmt*, int n);} {  Return the name of the n-th parameter in the precompiled statement.  Parameters of the form ":AAA" or "@AAA" or "\$VVV" have a name which is the  string ":AAA" or "@AAA" or "\$VVV".    In other words, the initial ":" or "$" or "@"  is included as part of the name.  Parameters of the form "?" or "?NNN" have no name.  The first bound parameter has an index of 1, not 0.  If the value n is out of range or if the n-th parameter is nameless,  then NULL is returned.  The returned string is always in the  UTF-8 encoding even if the named parameter was originally specified  as UTF-16 in sqlite3_prepare16_v2().}api {} {  int sqlite3_bind_parameter_index(sqlite3_stmt*, const char *zName);} {  Return the index of the parameter with the given name.  The name must match exactly.  If there is no parameter with the given name, return 0.  The string zName is always in the UTF-8 encoding.}api {} {  int sqlite3_busy_handler(sqlite3*, int(*)(void*,int), void*);} { This routine identifies a callback function that might be invoked whenever an attempt is made to open a database table  that another thread or process has locked. If the busy callback is NULL, then SQLITE_BUSY  (or sometimes SQLITE_IOERR_BLOCKED) is returned immediately upon encountering the lock. If the busy callback is not NULL, then the callback will be invoked with two arguments.  The first argument to the handler is a copy of the void* pointer which is the third argument to this routine.  The second argument to the handler is the number of times that the busy handler has been invoked for this locking event. If the busy callback returns 0, then no additional attempts are made to access the database and SQLITE_BUSY or SQLITE_IOERR_BLOCKED is returned. If the callback returns non-zero, then another attempt is made to open the database for reading and the cycle repeats. The presence of a busy handler does not guarantee that it will be invoked when there is lock contention. If SQLite determines that invoking the busy handler could result in a deadlock, it will return SQLITE_BUSY instead. Consider a scenario where one process is holding a read lock that it is trying to promote to a reserved lock and a second process is holding a reserved lock that it is trying to promote to an exclusive lock.  The first process cannot proceed because it is blocked by the second and the second process cannot proceed because it is blocked by the first.  If both processes invoke the busy handlers, neither will make any progress.  Therefore, SQLite returns SQLITE_BUSY for the first process, hoping that this will induce the first process to release its read lock and allow

⌨️ 快捷键说明

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