?? sqlite3.h
字號(hào):
** the pNext pointer. The [sqlite3_vfs_register()]** and [sqlite3_vfs_unregister()] interfaces manage this list** in a thread-safe way. The [sqlite3_vfs_find()] interface** searches the list.**** The pNext field is the only fields in the sqlite3_vfs ** structure that SQLite will ever modify. SQLite will only access** or modify this field while holding a particular static mutex.** The application should never modify anything within the sqlite3_vfs** object once the object has been registered.**** The zName field holds the name of the VFS module. The name must** be unique across all VFS modules.**** SQLite will guarantee that the zFilename string passed to** xOpen() is a full pathname as generated by xFullPathname() and** that the string will be valid and unchanged until xClose() is** called. So the [sqlite3_file] can store a pointer to the** filename if it needs to remember the filename for some reason.**** The flags argument to xOpen() is a copy of the flags argument** to [sqlite3_open_v2()]. If [sqlite3_open()] or [sqlite3_open16()]** is used, then flags is [SQLITE_OPEN_READWRITE] | [SQLITE_OPEN_CREATE].** If xOpen() opens a file read-only then it sets *pOutFlags to** include [SQLITE_OPEN_READONLY]. Other bits in *pOutFlags may be** set.** ** SQLite will also add one of the following flags to the xOpen()** call, depending on the object being opened:** ** <ul>** <li> [SQLITE_OPEN_MAIN_DB]** <li> [SQLITE_OPEN_MAIN_JOURNAL]** <li> [SQLITE_OPEN_TEMP_DB]** <li> [SQLITE_OPEN_TEMP_JOURNAL]** <li> [SQLITE_OPEN_TRANSIENT_DB]** <li> [SQLITE_OPEN_SUBJOURNAL]** <li> [SQLITE_OPEN_MASTER_JOURNAL]** </ul>**** The file I/O implementation can use the object type flags to** changes the way it deals with files. For example, an application** that does not care about crash recovery or rollback, might make** the open of a journal file a no-op. Writes to this journal are** also a no-op. Any attempt to read the journal return SQLITE_IOERR.** Or the implementation might recognize the a database file will** be doing page-aligned sector reads and writes in a random order** and set up its I/O subsystem accordingly.** ** SQLite might also add one of the following flags to the xOpen** method:** ** <ul>** <li> [SQLITE_OPEN_DELETEONCLOSE]** <li> [SQLITE_OPEN_EXCLUSIVE]** </ul>** ** The [SQLITE_OPEN_DELETEONCLOSE] flag means the file should be** deleted when it is closed. This will always be set for TEMP ** databases and journals and for subjournals. The ** [SQLITE_OPEN_EXCLUSIVE] flag means the file should be opened** for exclusive access. This flag is set for all files except** for the main database file.** ** Space to hold the [sqlite3_file] structure passed as the third ** argument to xOpen is allocated by caller (the SQLite core). ** szOsFile bytes are allocated for this object. The xOpen method** fills in the allocated space.** ** The flags argument to xAccess() may be [SQLITE_ACCESS_EXISTS] ** to test for the existance of a file,** or [SQLITE_ACCESS_READWRITE] to test to see** if a file is readable and writable, or [SQLITE_ACCESS_READ]** to test to see if a file is at least readable. The file can be a ** directory.** ** SQLite will always allocate at least mxPathname+1 byte for** the output buffers for xGetTempname and xFullPathname. The exact** size of the output buffer is also passed as a parameter to both ** methods. If the output buffer is not large enough, SQLITE_CANTOPEN** should be returned. As this is handled as a fatal error by SQLite,** vfs implementations should endevour to prevent this by setting ** mxPathname to a sufficiently large value.** ** The xRandomness(), xSleep(), and xCurrentTime() interfaces** are not strictly a part of the filesystem, but they are** included in the VFS structure for completeness.** The xRandomness() function attempts to return nBytes bytes** of good-quality randomness into zOut. The return value is** the actual number of bytes of randomness obtained. The** xSleep() method cause the calling thread to sleep for at** least the number of microseconds given. The xCurrentTime()** method returns a Julian Day Number for the current date and** time.*/typedef struct sqlite3_vfs sqlite3_vfs;struct sqlite3_vfs { int iVersion; /* Structure version number */ int szOsFile; /* Size of subclassed sqlite3_file */ int mxPathname; /* Maximum file pathname length */ sqlite3_vfs *pNext; /* Next registered VFS */ const char *zName; /* Name of this virtual file system */ void *pAppData; /* Pointer to application-specific data */ int (*xOpen)(sqlite3_vfs*, const char *zName, sqlite3_file*, int flags, int *pOutFlags); int (*xDelete)(sqlite3_vfs*, const char *zName, int syncDir); int (*xAccess)(sqlite3_vfs*, const char *zName, int flags); int (*xGetTempname)(sqlite3_vfs*, int nOut, char *zOut); int (*xFullPathname)(sqlite3_vfs*, const char *zName, int nOut, char *zOut); void *(*xDlOpen)(sqlite3_vfs*, const char *zFilename); void (*xDlError)(sqlite3_vfs*, int nByte, char *zErrMsg); void *(*xDlSym)(sqlite3_vfs*,void*, const char *zSymbol); void (*xDlClose)(sqlite3_vfs*, void*); int (*xRandomness)(sqlite3_vfs*, int nByte, char *zOut); int (*xSleep)(sqlite3_vfs*, int microseconds); int (*xCurrentTime)(sqlite3_vfs*, double*); /* New fields may be appended in figure versions. The iVersion ** value will increment whenever this happens. */};/*** CAPI3REF: Flags for the xAccess VFS method**** These integer constants can be used as the third parameter to** the xAccess method of an [sqlite3_vfs] object. They determine** the kind of what kind of permissions the xAccess method is** looking for. With SQLITE_ACCESS_EXISTS, the xAccess method** simply checks to see if the file exists. With SQLITE_ACCESS_READWRITE,** the xAccess method checks to see if the file is both readable** and writable. With SQLITE_ACCESS_READ the xAccess method** checks to see if the file is readable.*/#define SQLITE_ACCESS_EXISTS 0#define SQLITE_ACCESS_READWRITE 1#define SQLITE_ACCESS_READ 2/*** CAPI3REF: Enable Or Disable Extended Result Codes**** This routine enables or disables the** [SQLITE_IOERR_READ | extended result codes] feature.** By default, SQLite API routines return one of only 26 integer** [SQLITE_OK | result codes]. When extended result codes** are enabled by this routine, the repetoire of result codes can be** much larger and can (hopefully) provide more detailed information** about the cause of an error.**** The second argument is a boolean value that turns extended result** codes on and off. Extended result codes are off by default for** backwards compatibility with older versions of SQLite.*/int sqlite3_extended_result_codes(sqlite3*, int onoff);/*** CAPI3REF: Last Insert Rowid**** Each entry in an SQLite table has a unique 64-bit signed integer key** called the "rowid". The rowid is always available as an undeclared** column named ROWID, OID, or _ROWID_. If the table has a column of** type INTEGER PRIMARY KEY then that column is another an alias for the** rowid.**** This routine returns the rowid of the most recent successful INSERT into** the database from the database connection given in the first ** argument. If no successful inserts have ever occurred on this database** connection, zero is returned.**** If an INSERT occurs within a trigger, then the rowid of the** inserted row is returned by this routine as long as the trigger** is running. But once the trigger terminates, the value returned** by this routine reverts to the last value inserted before the** trigger fired.**** An INSERT that fails due to a constraint violation is not a** successful insert and does not change the value returned by this** routine. Thus INSERT OR FAIL, INSERT OR IGNORE, INSERT OR ROLLBACK,** and INSERT OR ABORT make no changes to the return value of this** routine when their insertion fails. When INSERT OR REPLACE ** encounters a constraint violation, it does not fail. The** INSERT continues to completion after deleting rows that caused** the constraint problem so INSERT OR REPLACE will always change** the return value of this interface.**** If another thread does a new insert on the same database connection** while this routine is running and thus changes the last insert rowid,** then the return value of this routine is undefined.*/sqlite3_int64 sqlite3_last_insert_rowid(sqlite3*);/*** CAPI3REF: Count The Number Of Rows Modified**** This function returns the number of database rows that were changed** (or inserted or deleted) by the most recent SQL statement. Only** changes that are directly specified by the INSERT, UPDATE, or** DELETE statement are counted. Auxiliary changes caused by** triggers are not counted. Use the [sqlite3_total_changes()] function** to find the total number of changes including changes caused by triggers.**** Within the body of a trigger, the sqlite3_changes() interface can be** called to find the number of** changes in the most recently completed INSERT, UPDATE, or DELETE** statement within the body of the trigger.**** All changes are counted, even if they were later undone by a** ROLLBACK or ABORT. Except, changes associated with creating and** dropping tables are not counted.**** If a callback invokes [sqlite3_exec()] or [sqlite3_step()] recursively,** then the changes in the inner, recursive call are counted together** with the changes in the outer call.**** SQLite implements the command "DELETE FROM table" without a WHERE clause** by dropping and recreating the table. (This is much faster than going** through and deleting individual elements from the table.) Because of** this optimization, the change count for "DELETE FROM table" will be** zero regardless of the number of elements that were originally in the** table. To get an accurate count of the number of rows deleted, use** "DELETE FROM table WHERE 1" instead.**** If another thread makes changes on the same database connection** while this routine is running then the return value of this routine** is undefined.*/int sqlite3_changes(sqlite3*);/*** CAPI3REF: Total Number Of Rows Modified***** This function returns the number of database rows that have been** modified by INSERT, UPDATE or DELETE statements since the database handle** was opened. This includes UPDATE, INSERT and DELETE statements executed** as part of trigger programs. All changes are counted as soon as the** statement that makes them is completed (when the statement handle is** passed to [sqlite3_reset()] or [sqlite3_finalize()]).**** See also the [sqlite3_change()] interface.**** SQLite implements the command "DELETE FROM table" without a WHERE clause** by dropping and recreating the table. (This is much faster than going** through and deleting individual elements form the table.) Because of** this optimization, the change count for "DELETE FROM table" will be** zero regardless of the number of elements that were originally in the** table. To get an accurate count of the number of rows deleted, use** "DELETE FROM table WHERE 1" instead.**** If another thread makes changes on the same database connection** while this routine is running then the return value of this routine** is undefined.*/int sqlite3_total_changes(sqlite3*);/*** CAPI3REF: Interrupt A Long-Running Query**** This function causes any pending database operation to abort and** return at its earliest opportunity. This routine is typically** called in response to a user action such as pressing "Cancel"** or Ctrl-C where the user wants a long query operation to halt** immediately.**** It is safe to call this routine from a thread different from the** thread that is currently running the database operation. But it** is not safe to call this routine with a database connection that** is closed or might close before sqlite3_interrupt() returns.**** The SQL operation that is interrupted will return [SQLITE_INTERRUPT].** If an interrupted operation was an update that is inside an** explicit transaction, then the entire transaction will be rolled** back automatically.*/void sqlite3_interrupt(sqlite3*);/*** CAPI3REF: Determine If An SQL Statement Is Complete**** These functions return true if the given input string comprises** one or more complete SQL statements. For the sqlite3_complete() call,** the parameter must be a nul-terminated UTF-8 string. For** sqlite3_complete16(), a nul-terminated machine byte order UTF-16 string** is required.**** These routines are useful for command-line input to determine if the** currently entered text forms one or more complete SQL statements or** if additional input is needed before sending the statements into** SQLite for parsing. The algorithm is simple. If the ** last token other than spaces and comments is a semicolon, then return ** true. Actually, the algorithm is a little more complicated than that** in order to deal with triggers, but the basic idea is the same: the** statement is not complete unless it ends in a semicolon.*/int sqlite3_complete(const char *sql);int sqlite3_complete16(const void *sql);
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -