?? sqlite3.h
字號:
** pointer or an [sqlite3] object pointer obtained** from [sqlite3_open()], [sqlite3_open16()], or** [sqlite3_open_v2()], and not previously closed.*/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 {H12100} <S10000>**** The sqlite3_exec() interface is a convenient way of running one or more** SQL statements without having to write a lot of C code. The UTF-8 encoded** SQL statements are passed in as the second parameter to sqlite3_exec().** The statements are evaluated one by one until either an error or** an interrupt is encountered, or until they are all done. The 3rd parameter** is an optional callback that is invoked once for each row of any query** results produced by the SQL statements. The 5th parameter tells where** to write any error messages.**** The error message passed back through the 5th parameter is held** in memory obtained from [sqlite3_malloc()]. To avoid a memory leak,** the calling application should call [sqlite3_free()] on any error** message returned through the 5th parameter when it has finished using** the error message.**** If the SQL statement in the 2nd parameter is NULL or an empty string** or a string containing only whitespace and comments, then no SQL** statements are evaluated and the database is not changed.**** The sqlite3_exec() interface is implemented in terms of** [sqlite3_prepare_v2()], [sqlite3_step()], and [sqlite3_finalize()].** The sqlite3_exec() routine does nothing to the database that cannot be done** by [sqlite3_prepare_v2()], [sqlite3_step()], and [sqlite3_finalize()].**** INVARIANTS:**** {H12101} A successful invocation of [sqlite3_exec(D,S,C,A,E)]** shall sequentially evaluate all of the UTF-8 encoded,** semicolon-separated SQL statements in the zero-terminated** string S within the context of the [database connection] D.**** {H12102} If the S parameter to [sqlite3_exec(D,S,C,A,E)] is NULL then** the actions of the interface shall be the same as if the** S parameter were an empty string.**** {H12104} The return value of [sqlite3_exec()] shall be [SQLITE_OK] if all** SQL statements run successfully and to completion.**** {H12105} The return value of [sqlite3_exec()] shall be an appropriate** non-zero [error code] if any SQL statement fails.**** {H12107} If one or more of the SQL statements handed to [sqlite3_exec()]** return results and the 3rd parameter is not NULL, then** the callback function specified by the 3rd parameter shall be** invoked once for each row of result.**** {H12110} If the callback returns a non-zero value then [sqlite3_exec()]** shall abort the SQL statement it is currently evaluating,** skip all subsequent SQL statements, and return [SQLITE_ABORT].**** {H12113} The [sqlite3_exec()] routine shall pass its 4th parameter through** as the 1st parameter of the callback.**** {H12116} The [sqlite3_exec()] routine shall set the 2nd parameter of its** callback to be the number of columns in the current row of** result.**** {H12119} The [sqlite3_exec()] routine shall set the 3rd parameter of its** callback to be an array of pointers to strings holding the** values for each column in the current result set row as** obtained from [sqlite3_column_text()].**** {H12122} The [sqlite3_exec()] routine shall set the 4th parameter of its** callback to be an array of pointers to strings holding the** names of result columns as obtained from [sqlite3_column_name()].**** {H12125} If the 3rd parameter to [sqlite3_exec()] is NULL then** [sqlite3_exec()] shall silently discard query results.**** {H12131} If an error occurs while parsing or evaluating any of the SQL** statements in the S parameter of [sqlite3_exec(D,S,C,A,E)] and if** the E parameter is not NULL, then [sqlite3_exec()] shall store** in *E an appropriate error message written into memory obtained** from [sqlite3_malloc()].**** {H12134} The [sqlite3_exec(D,S,C,A,E)] routine shall set the value of** *E to NULL if E is not NULL and there are no errors.**** {H12137} The [sqlite3_exec(D,S,C,A,E)] function shall set the [error code]** and message accessible via [sqlite3_errcode()], ** [sqlite3_extended_errcode()],** [sqlite3_errmsg()], and [sqlite3_errmsg16()].**** {H12138} If the S parameter to [sqlite3_exec(D,S,C,A,E)] is NULL or an** empty string or contains nothing other than whitespace, comments,** and/or semicolons, then results of [sqlite3_errcode()],** [sqlite3_extended_errcode()],** [sqlite3_errmsg()], and [sqlite3_errmsg16()]** shall reset to indicate no errors.**** ASSUMPTIONS:**** {A12141} The first parameter to [sqlite3_exec()] must be an valid and open** [database connection].**** {A12142} The database connection must not be closed while** [sqlite3_exec()] is running.**** {A12143} The calling function should use [sqlite3_free()] to free** the memory that *errmsg is left pointing at once the error** message is no longer needed.**** {A12145} The SQL statement text in the 2nd parameter to [sqlite3_exec()]** must remain unchanged while [sqlite3_exec()] is running.*/int sqlite3_exec( sqlite3*, /* An open database */ const char *sql, /* SQL to be evaluated */ int (*callback)(void*,int,char**,char**), /* Callback function */ void *, /* 1st argument to callback */ char **errmsg /* Error msg written here */);/*** CAPI3REF: Result Codes {H10210} <S10700>** KEYWORDS: SQLITE_OK {error code} {error codes}** KEYWORDS: {result code} {result codes}**** Many SQLite functions return an integer result code from the set shown** here in order to indicates success or failure.**** New error codes may be added in future versions of SQLite.**** 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 /* 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 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_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 {H10220} <S10700>** KEYWORDS: {extended error code} {extended error codes}** KEYWORDS: {extended result code} {extended result codes}**** In its default configuration, SQLite API routines return one of 26 integer** [SQLITE_OK | result codes]. However, experience has shown that many of** these result codes are too coarse-grained. They do not provide as** much information about problems as programmers 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** on a per database connection basis using the** [sqlite3_extended_result_codes()] API.**** Some of the available extended result codes are listed here.** One may 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 SQLITE_OK result code will never be extended. It will always** be exactly zero.**** INVARIANTS:**** {H10223} The symbolic name for an extended result code shall contains** a related primary result code as a prefix.**** {H10224} Primary result code names shall contain a single "_" character.**** {H10225} Extended result code names shall contain two or more "_" characters.**** {H10226} The numeric value of an extended result code shall contain the** numeric value of its corresponding primary result code in** its least significant 8 bits.*/#define SQLITE_IOERR_READ (SQLITE_IOERR | (1<<8))#define SQLITE_IOERR_SHORT_READ (SQLITE_IOERR | (2<<8))#define SQLITE_IOERR_WRITE (SQLITE_IOERR | (3<<8))#define SQLITE_IOERR_FSYNC (SQLITE_IOERR | (4<<8))#define SQLITE_IOERR_DIR_FSYNC (SQLITE_IOERR | (5<<8))#define SQLITE_IOERR_TRUNCATE (SQLITE_IOERR | (6<<8))#define SQLITE_IOERR_FSTAT (SQLITE_IOERR | (7<<8))#define SQLITE_IOERR_UNLOCK (SQLITE_IOERR | (8<<8))#define SQLITE_IOERR_RDLOCK (SQLITE_IOERR | (9<<8))#define SQLITE_IOERR_DELETE (SQLITE_IOERR | (10<<8))#define SQLITE_IOERR_BLOCKED (SQLITE_IOERR | (11<<8))#define SQLITE_IOERR_NOMEM (SQLITE_IOERR | (12<<8))#define SQLITE_IOERR_ACCESS (SQLITE_IOERR | (13<<8))#define SQLITE_IOERR_CHECKRESERVEDLOCK (SQLITE_IOERR | (14<<8))#define SQLITE_IOERR_LOCK (SQLITE_IOERR | (15<<8))#define SQLITE_IOERR_CLOSE (SQLITE_IOERR | (16<<8))#define SQLITE_IOERR_DIR_CLOSE (SQLITE_IOERR | (17<<8))/*** CAPI3REF: Flags For File Open Operations {H10230} <H11120> <H12700>**** These bit values are intended for use in the** 3rd parameter to the [sqlite3_open_v2()] interface and** in the 4th parameter to the xOpen method of the** [sqlite3_vfs] object.*/#define SQLITE_OPEN_READONLY 0x00000001#define SQLITE_OPEN_READWRITE 0x00000002#define SQLITE_OPEN_CREATE 0x00000004#define SQLITE_OPEN_DELETEONCLOSE 0x00000008#define SQLITE_OPEN_EXCLUSIVE 0x00000010#define SQLITE_OPEN_MAIN_DB 0x00000100#define SQLITE_OPEN_TEMP_DB 0x00000200#define SQLITE_OPEN_TRANSIENT_DB 0x00000400#define SQLITE_OPEN_MAIN_JOURNAL 0x00000800#define SQLITE_OPEN_TEMP_JOURNAL 0x00001000#define SQLITE_OPEN_SUBJOURNAL 0x00002000#define SQLITE_OPEN_MASTER_JOURNAL 0x00004000#define SQLITE_OPEN_NOMUTEX 0x00008000#define SQLITE_OPEN_FULLMUTEX 0x00010000/*** CAPI3REF: Device Characteristics {H10240} <H11120>**** The xDeviceCapabilities method of the [sqlite3_io_methods]** object returns an integer which is a vector of the these** bit values expressing I/O characteristics of the mass storage** device that holds the file that the [sqlite3_io_methods]** refers to.**** The SQLITE_IOCAP_ATOMIC property means that all writes of** any size are atomic. The SQLITE_IOCAP_ATOMICnnn values** mean that writes of blocks that are nnn bytes in size and** are aligned to an address which is an integer multiple of** nnn are atomic. The SQLITE_IOCAP_SAFE_APPEND value means** that when data is appended to a file, the data is appended** first then the size of the file is extended, never the other** way around. The SQLITE_IOCAP_SEQUENTIAL property means that** information is written to disk in the same order as calls** to xWrite().*/#define SQLITE_IOCAP_ATOMIC 0x00000001#define SQLITE_IOCAP_ATOMIC512 0x00000002#define SQLITE_IOCAP_ATOMIC1K 0x00000004#define SQLITE_IOCAP_ATOMIC2K 0x00000008#define SQLITE_IOCAP_ATOMIC4K 0x00000010#define SQLITE_IOCAP_ATOMIC8K 0x00000020#define SQLITE_IOCAP_ATOMIC16K 0x00000040#define SQLITE_IOCAP_ATOMIC32K 0x00000080#define SQLITE_IOCAP_ATOMIC64K 0x00000100#define SQLITE_IOCAP_SAFE_APPEND 0x00000200#define SQLITE_IOCAP_SEQUENTIAL 0x00000400/*** CAPI3REF: File Locking Levels {H10250} <H11120> <H11310>**
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -