📄 sqlite.h.in
字号:
/*** 2001 September 15**** The author disclaims copyright to this source code. In place of** a legal notice, here is a blessing:**** May you do good and not evil.** May you find forgiveness for yourself and forgive others.** May you share freely, never taking more than you give.***************************************************************************** This header file defines the interface that the SQLite library** presents to client programs. If a C-function, structure, datatype,** or constant definition does not appear in this file, then it is** not a published API of SQLite, is subject to change without** notice, and should not be referenced by programs that use SQLite.**** Some of the definitions that are in this file are marked as** "experimental". Experimental interfaces are normally new** features recently added to SQLite. We do not anticipate changes ** to experimental interfaces but reserve to make minor changes if** experience from use "in the wild" suggest such changes are prudent.**** The official C-language API documentation for SQLite is derived** from comments in this file. This file is the authoritative source** on how SQLite interfaces are suppose to operate.**** The name of this file under configuration management is "sqlite.h.in".** The makefile makes some minor changes to this file (such as inserting** the version number) and changes its name to "sqlite3.h" as** part of the build process.**** @(#) $Id: sqlite.h.in,v 1.218 2007/07/19 12:41:40 drh Exp $*/#ifndef _SQLITE3_H_#define _SQLITE3_H_#include <stdarg.h> /* Needed for the definition of va_list *//*** Make sure we can call this stuff from C++.*/#ifdef __cplusplusextern "C" {#endif/*** Make sure these symbols where not defined by some previous header** file.*/#ifdef SQLITE_VERSION# undef SQLITE_VERSION#endif#ifdef SQLITE_VERSION_NUMBER# undef SQLITE_VERSION_NUMBER#endif/*** CAPI3REF: Compile-Time Library Version Numbers**** The version of the SQLite library is contained in the sqlite3.h** header file in a #define named SQLITE_VERSION. The SQLITE_VERSION** macro resolves to a string constant.**** The format of the version string is "X.Y.Z", where** X is the major version number, Y is the minor version number and Z** is the release number. The X.Y.Z might be followed by "alpha" or "beta".** For example "3.1.1beta".**** The X value is always 3 in SQLite. The X value only changes when** backwards compatibility is broken and we intend to never break** backwards compatibility. The Y value only changes when** there are major feature enhancements that are forwards compatible** but not backwards compatible. The Z value is incremented with** each release but resets back to 0 when Y is incremented.**** The SQLITE_VERSION_NUMBER is an integer with the value ** (X*1000000 + Y*1000 + Z). For example, for version "3.1.1beta", ** SQLITE_VERSION_NUMBER is set to 3001001. To detect if they are using ** version 3.1.1 or greater at compile time, programs may use the test ** (SQLITE_VERSION_NUMBER>=3001001).**** See also: [sqlite3_libversion()] and [sqlite3_libversion_number()].*/#define SQLITE_VERSION "--VERS--"#define SQLITE_VERSION_NUMBER --VERSION-NUMBER--/*** CAPI3REF: Run-Time Library Version Numbers**** These routines return values equivalent to the header constants** [SQLITE_VERSION] and [SQLITE_VERSION_NUMBER]. The values returned** by this routines should only be different from the header values** if you compile your program using an sqlite3.h header from a** different version of SQLite that the version of the library you** link against.**** The sqlite3_version[] string constant contains the text of the** [SQLITE_VERSION] string. The sqlite3_libversion() function returns** a poiner to the sqlite3_version[] string constant. The function** is provided for DLL users who can only access functions and not** constants within the DLL.*/extern const char sqlite3_version[];const char *sqlite3_libversion(void);int sqlite3_libversion_number(void);/*** CAPI3REF: Database Connection Handle**** Each open SQLite database is represented by pointer to an instance of the** opaque structure named "sqlite3". It is useful to think of an sqlite3** pointer as an object. The [sqlite3_open] interface is its constructor** and [sqlite3_close] is its destructor. There are many other interfaces** (such as [sqlite3_prepare_v2], [sqlite3_create_function], and** [sqlite3_busy_timeout] to name but three) that are methods on this** object.*/typedef struct sqlite3 sqlite3;/*** CAPI3REF: 64-Bit Integer Types**** Some compilers do not support the "long long" datatype. So we have** to do compiler-specific typedefs for 64-bit signed and unsigned integers.**** Many SQLite interface functions require a 64-bit integer arguments.** Those interfaces are declared using this typedef.*/#ifdef SQLITE_INT64_TYPE typedef SQLITE_INT64_TYPE sqlite_int64; typedef unsigned SQLITE_INT64_TYPE sqlite_uint64;#elif defined(_MSC_VER) || defined(__BORLANDC__) typedef __int64 sqlite_int64; typedef unsigned __int64 sqlite_uint64;#else typedef long long int sqlite_int64; typedef unsigned long long int sqlite_uint64;#endif/*** If compiling for a processor that lacks floating point support,** substitute integer for floating-point*/#ifdef SQLITE_OMIT_FLOATING_POINT# define double sqlite_int64#endif/*** CAPI3REF: Closing A Database Connection**** Call this function with a pointer to a structure that was previously** returned from [sqlite3_open()] and the corresponding database will by** closed.**** All SQL statements prepared using [sqlite3_prepare_v2()] or** [sqlite3_prepare16_v2()] must be destroyed using [sqlite3_finalize()]** before this routine is called. Otherwise, SQLITE_BUSY is returned and the** database connection remains open.*/int sqlite3_close(sqlite3 *);/*** The type for a callback function.** This is legacy and deprecated. It is included for historical** compatibility and is not documented.*/typedef int (*sqlite3_callback)(void*,int,char**, char**);/*** CAPI3REF: One-Step Query Execution Interface**** This interface is used to do a one-time evaluatation of zero** or more SQL statements. UTF-8 text of the SQL statements to** be evaluted is passed in as the second parameter. The statements** are prepared one by one using [sqlite3_prepare()], evaluated** using [sqlite3_step()], then destroyed using [sqlite3_finalize()].**** If one or more of the SQL statements are queries, then** the callback function specified by the 3rd parameter is** invoked once for each row of the query result. This callback** should normally return 0. If the callback returns a non-zero** value then the query is aborted, all subsequent SQL statements** are skipped and the sqlite3_exec() function returns the SQLITE_ABORT.**** The 4th parameter to this interface is an arbitrary pointer that is** passed through to the callback function as its first parameter.**** The 2nd parameter to the callback function is the number of** columns in the query result. The 3rd parameter to the callback** is an array of strings holding the values for each column** as extracted using [sqlite3_column_text()].** The 4th parameter to the callback is an array of strings** obtained using [sqlite3_column_name()] and holding** the names of each column.**** The callback function may be NULL, even for queries. A NULL** callback is not an error. It just means that no callback** will be invoked.**** If an error occurs while parsing or evaluating the SQL (but** not while executing the callback) then an appropriate error** message is written into memory obtained from [sqlite3_malloc()] and** *errmsg is made to point to that message. The calling function** is responsible for freeing the memory that holds the error** message. Use [sqlite3_free()] for this. If errmsg==NULL,** then no error message is ever written.**** The return value is is SQLITE_OK if there are no errors and** some other [SQLITE_OK | return code] if there is an error. ** The particular return value depends on the type of error. ***/int sqlite3_exec( sqlite3*, /* An open database */ const char *sql, /* SQL to be evaluted */ int (*callback)(void*,int,char**,char**), /* Callback function */ void *, /* 1st argument to callback */ char **errmsg /* Error msg written here */);/*** CAPI3REF: Result Codes** KEYWORDS: SQLITE_OK**** Many SQLite functions return an integer result code from the set shown** above in order to indicates success or failure.**** The result codes above are the only ones returned by SQLite in its** default configuration. However, the [sqlite3_extended_result_codes()]** API can be used to set a database connectoin to return more detailed** result codes.**** See also: [SQLITE_IOERR_READ | extended result codes]***/#define SQLITE_OK 0 /* Successful result *//* beginning-of-error-codes */#define SQLITE_ERROR 1 /* SQL error or missing database */#define SQLITE_INTERNAL 2 /* NOT USED. 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 sqlite3_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 /* NOT USED. 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 /* NOT USED. Database lock protocol error */#define SQLITE_EMPTY 16 /* Database is empty */#define SQLITE_SCHEMA 17 /* The database schema changed */#define SQLITE_TOOBIG 18 /* String or BLOB exceeds size limit */#define SQLITE_CONSTRAINT 19 /* Abort due to contraint 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_FORMAT 24 /* Auxiliary database format error */#define SQLITE_RANGE 25 /* 2nd parameter to sqlite3_bind out of range */#define SQLITE_NOTADB 26 /* File opened that is not a database file */#define SQLITE_ROW 100 /* sqlite3_step() has another row ready */#define SQLITE_DONE 101 /* sqlite3_step() has finished executing *//* end-of-error-codes *//*** CAPI3REF: Extended Result Codes**** In its default configuration, SQLite API routines return one of 26 integer** result codes described at result-codes. However, experience has shown that** many of these result codes are too course-grained. They do not provide as** much information about problems as users might like. In an effort to** address this, newer versions of SQLite (version 3.3.8 and later) include** support for additional result codes that provide more detailed information** about errors. The extended result codes are enabled (or disabled) for ** each database** connection 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 expand** over time. Software that uses extended result codes should expect** to see new result codes in future releases of SQLite.** ** The symbolic name for an extended result code always contains a related** primary 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 its** corresponding primary result code by masking off the lower 8 bytes.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -