📄 sqlite3.h
字号:
** {F12113} The [sqlite3_exec()] routine will pass its 4th parameter through** as the 1st parameter of the callback.**** {F12116} The [sqlite3_exec()] routine sets the 2nd parameter of its** callback to be the number of columns in the current row of** result.**** {F12119} The [sqlite3_exec()] routine sets 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()].**** {F12122} The [sqlite3_exec()] routine sets 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()].**** {F12125} If the 3rd parameter to [sqlite3_exec()] is NULL then** [sqlite3_exec()] never invokes a callback. All query** results are silently discarded.**** {F12128} If an error occurs while parsing or evaluating any of the SQL** statements handed to [sqlite3_exec()] then [sqlite3_exec()] will** return an [error code] other than [SQLITE_OK].**** {F12131} If an error occurs while parsing or evaluating any of the SQL** handed to [sqlite3_exec()] and if the 5th parameter (errmsg)** to [sqlite3_exec()] is not NULL, then an error message is** allocated using the equivalent of [sqlite3_mprintf()] and** *errmsg is made to point to that message.**** {F12134} The [sqlite3_exec()] routine does not change the value of** *errmsg if errmsg is NULL or if there are no errors.**** {F12137} The [sqlite3_exec()] function sets the error code and message** accessible via [sqlite3_errcode()], [sqlite3_errmsg()], and** [sqlite3_errmsg16()].**** LIMITATIONS:**** {U12141} The first parameter to [sqlite3_exec()] must be an valid and open** [database connection].**** {U12142} The database connection must not be closed while** [sqlite3_exec()] is running.** ** {U12143} The calling function is should use [sqlite3_free()] to free** the memory that *errmsg is left pointing at once the error** message is no longer needed.**** {U12145} 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 evaluted */ int (*callback)(void*,int,char**,char**), /* Callback function */ void *, /* 1st argument to callback */ char **errmsg /* Error msg written here */);/*** CAPI3REF: Result Codes {F10210}** KEYWORDS: SQLITE_OK {error code} {error codes}**** Many SQLite functions return an integer result code from the set shown** here in order to indicates success or failure.**** 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 {F10220}** KEYWORDS: {extended error code} {extended error codes}** KEYWORDS: {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 course-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** for each database connection 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:**** {F10223} The symbolic name for an extended result code always contains** a related primary result code as a prefix.**** {F10224} Primary result code names contain a single "_" character.**** {F10225} Extended result code names contain two or more "_" characters.**** {F10226} The numeric value of an extended result code contains 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))/*** CAPI3REF: Flags For File Open Operations {F10230}**** 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/*** CAPI3REF: Device Characteristics {F10240}**** 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 {F10250}**** SQLite uses one of these integer values as the second** argument to calls it makes to the xLock() and xUnlock() methods** of an [sqlite3_io_methods] object.*/#define SQLITE_LOCK_NONE 0#define SQLITE_LOCK_SHARED 1#define SQLITE_LOCK_RESERVED 2#define SQLITE_LOCK_PENDING 3#define SQLITE_LOCK_EXCLUSIVE 4/*** CAPI3REF: Synchronization Type Flags {F10260}**** When SQLite invokes the xSync() method of an** [sqlite3_io_methods] object it uses a combination of** these integer values as the second argument.**** When the SQLITE_SYNC_DATAONLY flag is used, it means that the** sync operation only needs to flush data to mass storage. Inode** information need not be flushed. The SQLITE_SYNC_NORMAL flag means ** to use normal fsync() semantics. The SQLITE_SYNC_FULL flag means ** to use Mac OS-X style fullsync instead of fsync().*/#define SQLITE_SYNC_NORMAL 0x00002#define SQLITE_SYNC_FULL 0x00003#define SQLITE_SYNC_DATAONLY 0x00010/*** CAPI3REF: OS Interface Open File Handle {F11110}**** An [sqlite3_file] object represents an open file in the OS** interface layer. Individual OS interface implementations will** want to subclass this object by appending additional fields** for their own use. The pMethods entry is a pointer to an** [sqlite3_io_methods] object that defines methods for performing** I/O operations on the open file.*/typedef struct sqlite3_file sqlite3_file;struct sqlite3_file { const struct sqlite3_io_methods *pMethods; /* Methods for an open file */};/*** CAPI3REF: OS Interface File Virtual Methods Object {F11120}**** Every file opened by the [sqlite3_vfs] xOpen method contains a pointer to** an instance of this object. This object defines the** methods used to perform various operations against the open file.**** The flags argument to xSync may be one of [SQLITE_SYNC_NORMAL] or** [SQLITE_SYNC_FULL]. The first choice is the normal fsync().* The second choice is an** OS-X style fullsync. The SQLITE_SYNC_DATA flag may be ORed in to** indicate that only the data of the file and not its inode needs to be** synced.** ** The integer values to xLock() and xUnlock() are one of** <ul>** <li> [SQLITE_LOCK_NONE],** <li> [SQLITE_LOCK_SHARED],** <li> [SQLITE_LOCK_RESERVED],** <li> [SQLITE_LOCK_PENDING], or** <li> [SQLITE_LOCK_EXCLUSIVE].** </ul>** xLock() increases the lock. xUnlock() decreases the lock. ** The xCheckReservedLock() method looks** to see if any database connection, either in this** process or in some other process, is holding an RESERVED,** PENDING, or EXCLUSIVE lock on the file. It returns true** if such a lock exists and false if not.** ** The xFileControl() method is a generic interface that allows custom** VFS implementations to directly control an open file using the** [sqlite3_file_control()] interface. The second "op" argument** is an integer opcode. The third** argument is a generic pointer which is intended to be a pointer** to a structure that may contain arguments or space in which to** write return values. Potential uses for xFileControl() might be** functions to enable blocking locks with timeouts, to change the** locking strategy (for example to use dot-file locks), to inquire** about the status of a lock, or to break stale locks. The SQLite** core reserves opcodes less than 100 for its own use. ** A [SQLITE_FCNTL_LOCKSTATE | list of opcodes] less than 100 is available.** Applications that define a custom xFileControl method should use opcodes ** greater than 100 to avoid conflicts.**** The xSectorSize() method returns the sector size of the** device that underlies the file. The sector size is the** minimum write that can be performed without disturbing** other bytes in the file. The xDeviceCharacteristics()** method returns a bit vector describing behaviors of the** underlying device:**** <ul>** <li> [SQLITE_IOCAP_ATOMIC]
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -