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

📄 sqlite3.h

📁 linux下的网站
💻 H
📖 第 1 页 / 共 5 页
字号:
** an English language description of the error.**** If the database file does not exist, then a new database will be created** as needed.  The default encoding for the database will be UTF-8 if** sqlite3_open() is called and UTF-16 if sqlite3_open16 is used.**** Whether or not an error occurs when it is opened, resources associated** with the [sqlite3*] handle should be released by passing it to** sqlite3_close() when it is no longer required.**** Note to windows users:  The encoding used for the filename argument** of sqlite3_open() must be UTF-8, not whatever codepage is currently** defined.  Filenames containing international characters must be converted** to UTF-8 prior to passing them into sqlite3_open().*/int sqlite3_open(  const char *filename,   /* Database filename (UTF-8) */  sqlite3 **ppDb          /* OUT: SQLite db handle */);int sqlite3_open16(  const void *filename,   /* Database filename (UTF-16) */  sqlite3 **ppDb          /* OUT: SQLite db handle */);/*** CAPI3REF: Error Codes And Messages**** The sqlite3_errcode() interface returns the numeric** [SQLITE_OK | result code] or [SQLITE_IOERR_READ | extended result code]** for the most recent failed sqlite3_* API call associated** with [sqlite3] handle 'db'.  If a prior API call failed but the** most recent API call succeeded, the return value from sqlite3_errcode()** is undefined. **** The sqlite3_errmsg() and sqlite3_errmsg16() return English-langauge** text that describes the error, as either UTF8 or UTF16 respectively.** Memory to hold the error message string is managed internally.  The ** string may be overwritten or deallocated by subsequent calls to SQLite** interface functions.**** Calls to many sqlite3_* functions set the error code and string returned** by [sqlite3_errcode()], [sqlite3_errmsg()], and [sqlite3_errmsg16()]** (overwriting the previous values). Note that calls to [sqlite3_errcode()],** [sqlite3_errmsg()], and [sqlite3_errmsg16()] themselves do not affect the** results of future invocations.  Calls to API routines that do not return** an error code (examples: [sqlite3_data_count()] or [sqlite3_mprintf()]) do** not change the error code returned by this routine.**** Assuming no other intervening sqlite3_* API calls are made, the error** code returned by this function is associated with the same error as** the strings returned by [sqlite3_errmsg()] and [sqlite3_errmsg16()].*/int sqlite3_errcode(sqlite3 *db);const char *sqlite3_errmsg(sqlite3*);const void *sqlite3_errmsg16(sqlite3*);/*** CAPI3REF: SQL Statement Object**** Instance of this object represent single SQL statements.  This** is variously known as a "prepared statement" or a ** "compiled SQL statement" or simply as a "statement".** ** The life of a statement object goes something like this:**** <ol>** <li> Create the object using [sqlite3_prepare_v2()] or a related**      function.** <li> Bind values to host parameters using**      [sqlite3_bind_blob | sqlite3_bind_* interfaces].** <li> Run the SQL by calling [sqlite3_step()] one or more times.** <li> Reset the statement using [sqlite3_reset()] then go back**      to step 2.  Do this zero or more times.** <li> Destroy the object using [sqlite3_finalize()].** </ol>**** Refer to documentation on individual methods above for additional** information.*/typedef struct sqlite3_stmt sqlite3_stmt;/*** CAPI3REF: Compiling An SQL Statement**** To execute an SQL query, it must first be compiled into a byte-code** program using one of these routines. **** The first argument "db" is an [sqlite3 | SQLite database handle] ** obtained from a prior call to [sqlite3_open()] or [sqlite3_open16()].** The second argument "zSql" is the statement to be compiled, encoded** as either UTF-8 or UTF-16.  The sqlite3_prepare() and sqlite3_prepare_v2()** interfaces uses UTF-8 and sqlite3_prepare16() and sqlite3_prepare16_v2()** use UTF-16. If the next argument, "nBytes", is less** than zero, then zSql is read up to the first zero terminator.  If** "nBytes" is not less than zero, then it is the length of the string zSql** in bytes (not characters).**** *pzTail is made to point to the first byte 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.**** *ppStmt is left pointing to a compiled ** [sqlite3_stmt | SQL statement structure] that can be** executed using [sqlite3_step()].  Or if there is an error, *ppStmt may be** set to NULL.  If the input text contained no SQL (if the input is and** empty string or a comment) then *ppStmt is set to NULL.  The calling** procedure is responsible for deleting the compiled SQL statement** using [sqlite3_finalize()] after it has finished with it.**** On success, [SQLITE_OK] is returned.  Otherwise an ** [SQLITE_ERROR | error code] is returned.**** The sqlite3_prepare_v2() and sqlite3_prepare16_v2() interfaces are** recommended for all new programs. The two older interfaces are retained** for backwards compatibility, but their use is discouraged.** In the "v2" interfaces, the prepared statement** that is returned (the [sqlite3_stmt] object) contains a copy of the ** original SQL text. This causes the [sqlite3_step()] interface to** behave a differently in two ways:**** <ol>** <li>** If the database schema changes, instead of returning [SQLITE_SCHEMA] as it** always used to do, [sqlite3_step()] will automatically recompile the SQL** statement and try to run it again.  If the schema has changed in a way** that makes the statement no longer valid, [sqlite3_step()] will still** return [SQLITE_SCHEMA].  But unlike the legacy behavior, [SQLITE_SCHEMA] is** now a fatal error.  Calling [sqlite3_prepare_v2()] again will not make the** error go away.  Note: use [sqlite3_errmsg()] to find the text of the parsing** error that results in an [SQLITE_SCHEMA] return.** </li>**** <li>** When an error occurs, ** [sqlite3_step()] will return one of the detailed ** [SQLITE_ERROR | result codes] or** [SQLITE_IOERR_READ | extended result codes] such as directly.** The legacy behavior was that [sqlite3_step()] would only return a generic** [SQLITE_ERROR] result code and you would have to make a second call to** [sqlite3_reset()] in order to find the underlying cause of the problem.** With the "v2" prepare interfaces, the underlying reason for the error is** returned immediately.** </li>** </ol>*/int sqlite3_prepare(  sqlite3 *db,            /* Database handle */  const char *zSql,       /* SQL statement, UTF-8 encoded */  int nBytes,             /* Length of zSql in bytes. */  sqlite3_stmt **ppStmt,  /* OUT: Statement handle */  const char **pzTail     /* OUT: Pointer to unused portion of zSql */);int sqlite3_prepare_v2(  sqlite3 *db,            /* Database handle */  const char *zSql,       /* SQL statement, UTF-8 encoded */  int nBytes,             /* Length of zSql in bytes. */  sqlite3_stmt **ppStmt,  /* OUT: Statement handle */  const char **pzTail     /* OUT: Pointer to unused portion of zSql */);int sqlite3_prepare16(  sqlite3 *db,            /* Database handle */  const void *zSql,       /* SQL statement, UTF-16 encoded */  int nBytes,             /* Length of zSql in bytes. */  sqlite3_stmt **ppStmt,  /* OUT: Statement handle */  const void **pzTail     /* OUT: Pointer to unused portion of zSql */);int sqlite3_prepare16_v2(  sqlite3 *db,            /* Database handle */  const void *zSql,       /* SQL statement, UTF-16 encoded */  int nBytes,             /* Length of zSql in bytes. */  sqlite3_stmt **ppStmt,  /* OUT: Statement handle */  const void **pzTail     /* OUT: Pointer to unused portion of zSql */);/*** CAPI3REF:  Dynamically Typed Value Object**** SQLite uses dynamic typing for the values it stores.  Values can ** be integers, floating point values, strings, BLOBs, or NULL.  When** passing around values internally, each value is represented as** an instance of the sqlite3_value object.*/typedef struct Mem sqlite3_value;/*** CAPI3REF:  SQL Function Context Object**** The context in which an SQL function executes is stored in an** sqlite3_context object.  A pointer to such an object is the** first parameter to user-defined SQL functions.*/typedef struct sqlite3_context sqlite3_context;/*** CAPI3REF:  Binding Values To Prepared Statements**** In the SQL strings input to [sqlite3_prepare_v2()] and its variants,** one or more literals can be replace by a parameter in one of these** forms:**** <ul>** <li>  ?** <li>  ?NNN** <li>  :AAA** <li>  @AAA** <li>  $VVV** </ul>**** In the parameter forms shown above 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 defined here.**** The first argument to the sqlite3_bind_*() routines always is a pointer** to the [sqlite3_stmt] object returned from [sqlite3_prepare_v2()] or** its variants.  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 ** [sqlite3_blob_open | increment BLOB I/O] routines.**** The sqlite3_bind_*() routines must be called after** [sqlite3_prepare_v2()] (and its variants) 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.*/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, sqlite_int64);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, void(*)(void*));int sqlite3_bind_value(sqlite3_stmt*, int, const sqlite3_value*);int sqlite3_bind_zeroblob(sqlite3_stmt*, int, int n);/*** CAPI3REF: Number Of Host Parameters**** 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.*/int sqlite3_bind_parameter_count(sqlite3_stmt*);

⌨️ 快捷键说明

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