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

📄 sqlite3.h

📁 嵌入式数据系统软件!
💻 H
📖 第 1 页 / 共 5 页
字号:
/*** CAPI3REF: Standard File Control Opcodes {F11310}**** These integer constants are opcodes for the xFileControl method** of the [sqlite3_io_methods] object and to the [sqlite3_file_control()]** interface.**** {F11311} The [SQLITE_FCNTL_LOCKSTATE] opcode is used for debugging.  This** opcode cases the xFileControl method to write the current state of** the lock (one of [SQLITE_LOCK_NONE], [SQLITE_LOCK_SHARED],** [SQLITE_LOCK_RESERVED], [SQLITE_LOCK_PENDING], or [SQLITE_LOCK_EXCLUSIVE])** into an integer that the pArg argument points to. {F11312} This capability** is used during testing and only needs to be supported when SQLITE_TEST** is defined.*/#define SQLITE_FCNTL_LOCKSTATE        1/*** CAPI3REF: Mutex Handle {F17110}**** The mutex module within SQLite defines [sqlite3_mutex] to be an** abstract type for a mutex object.  {F17111} The SQLite core never looks** at the internal representation of an [sqlite3_mutex]. {END} It only** deals with pointers to the [sqlite3_mutex] object.**** Mutexes are created using [sqlite3_mutex_alloc()].*/typedef struct sqlite3_mutex sqlite3_mutex;/*** CAPI3REF: OS Interface Object {F11140}**** An instance of this object defines the interface between the** SQLite core and the underlying operating system.  The "vfs"** in the name of the object stands for "virtual file system".**** The iVersion field is initially 1 but may be larger for future** versions of SQLite.  Additional fields may be appended to this** object when the iVersion value is increased.**** The szOsFile field is the size of the subclassed [sqlite3_file]** structure used by this VFS.  mxPathname is the maximum length of** a pathname in this VFS.**** Registered vfs modules are kept on a linked list formed by** 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.**** {F11141} 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.  {END} So the [sqlite3_file] can store a pointer to the** filename if it needs to remember the filename for some reason.**** {F11142} The flags argument to xOpen() includes all bits set in** the flags argument to [sqlite3_open_v2()].  Or if [sqlite3_open()]** or [sqlite3_open16()] is used, then flags includes at least** [SQLITE_OPEN_READWRITE] | [SQLITE_OPEN_CREATE]. {END}** If xOpen() opens a file read-only then it sets *pOutFlags to** include [SQLITE_OPEN_READONLY].  Other bits in *pOutFlags may be** set.** ** {F11143} 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> {END}**** 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.** ** {F11144} SQLite might also add one of the following flags to the xOpen** method:** ** <ul>** <li> [SQLITE_OPEN_DELETEONCLOSE]** <li> [SQLITE_OPEN_EXCLUSIVE]** </ul>** ** {F11145} The [SQLITE_OPEN_DELETEONCLOSE] flag means the file should be** deleted when it is closed.  {F11146} The [SQLITE_OPEN_DELETEONCLOSE]** will be set for TEMP  databases, journals and for subjournals. ** {F11147} 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. {END}** ** {F11148} At least szOsFile bytes of memory is allocated by SQLite ** to hold the  [sqlite3_file] structure passed as the third ** argument to xOpen.  {END}  The xOpen method does not have to** allocate the structure; it should just fill it in.** ** {F11149} 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.  {END} The file can be a ** directory.** ** {F11150} SQLite will always allocate at least mxPathname+1 byte for** the output buffers for xGetTempname and xFullPathname. {F11151} The exact** size of the output buffer is also passed as a parameter to both ** methods. {END} 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 endeavor 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 {F11190}**** {F11191} These integer constants can be used as the third parameter to** the xAccess method of an [sqlite3_vfs] object. {END}  They determine** the kind of what kind of permissions the xAccess method is** looking for.  {F11192} With SQLITE_ACCESS_EXISTS, the xAccess method** simply checks to see if the file exists. {F11193} With** SQLITE_ACCESS_READWRITE, the xAccess method checks to see** if the file is both readable and writable.  {F11194} 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 {F12200}**** {F12201} The sqlite3_extended_result_codes() routine enables or disables the** [SQLITE_IOERR_READ | extended result codes] feature on a database** connection if its 2nd parameter is** non-zero or zero, respectively. {F12202}** By default, SQLite API routines return one of only 26 integer** [SQLITE_OK | result codes].  {F12203} 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.**** {F12204} The second argument is a boolean value that turns extended result** codes on and off. {F12205} 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 {F12220}**** {F12221} Each entry in an SQLite table has a unique 64-bit signed** integer key called the "rowid".  {F12222} The rowid is always available** as an undeclared column named ROWID, OID, or _ROWID_ as long as those** names are not also used by explicitly declared columns. {F12223} If** the table has a column of type INTEGER PRIMARY KEY then that column** is another an alias for the rowid.**** {F12224} This routine returns the rowid of the most recent** successful INSERT into the database from the database connection** shown in the first argument.  {F12225} If no successful inserts** have ever occurred on this database connection, zero is returned.**** {F12226} 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.  {F12227} But once the trigger terminates, the value returned** by this routine reverts to the last value inserted before the** trigger fired.**** {F12228} An INSERT that fails due to a constraint violation is not a** successful insert and does not change the value returned by this** routine.  {F12229} 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.  {F12231} 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. **** {UF12232} 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 {F12240}**** {F12241} This function returns the number of database rows that were changed** or inserted or deleted by the most recently completed SQL statement** on the connection specified by the first parameter. {F12242} Only** changes that are directly specified by the INSERT, UPDATE, or** DELETE statement are counted.  Auxiliary changes caused by** triggers are not counted. {F12243} Use the [sqlite3_total_changes()] function** to find the total number of changes including changes caused by triggers.**** {F12244} 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 same trigger.**** {F12245} All changes are counted, even if they are later undone by a** ROLLBACK or ABORT.  {F12246} Except, changes associated with creating and** dropping tables are not counted.**** {F12247} 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.**** {F12248} 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. {F12251} To get an accurate count** of the number of rows deleted, use** "DELETE FROM table WHERE 1" instead.**** {UF12252} 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 {F12260}

⌨️ 快捷键说明

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