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

📄 sqlite3.h

📁 sqllive C开发的轻量级的数据库。 对想深入了解数据库的数据结构有很好的借鉴
💻 H
📖 第 1 页 / 共 5 页
字号:
** <li> [SQLITE_IOCAP_ATOMIC512]** <li> [SQLITE_IOCAP_ATOMIC1K]** <li> [SQLITE_IOCAP_ATOMIC2K]** <li> [SQLITE_IOCAP_ATOMIC4K]** <li> [SQLITE_IOCAP_ATOMIC8K]** <li> [SQLITE_IOCAP_ATOMIC16K]** <li> [SQLITE_IOCAP_ATOMIC32K]** <li> [SQLITE_IOCAP_ATOMIC64K]** <li> [SQLITE_IOCAP_SAFE_APPEND]** <li> [SQLITE_IOCAP_SEQUENTIAL]** </ul>**** 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().*/typedef struct sqlite3_io_methods sqlite3_io_methods;struct sqlite3_io_methods {  int iVersion;  int (*xClose)(sqlite3_file*);  int (*xRead)(sqlite3_file*, void*, int iAmt, sqlite3_int64 iOfst);  int (*xWrite)(sqlite3_file*, const void*, int iAmt, sqlite3_int64 iOfst);  int (*xTruncate)(sqlite3_file*, sqlite3_int64 size);  int (*xSync)(sqlite3_file*, int flags);  int (*xFileSize)(sqlite3_file*, sqlite3_int64 *pSize);  int (*xLock)(sqlite3_file*, int);  int (*xUnlock)(sqlite3_file*, int);  int (*xCheckReservedLock)(sqlite3_file*);  int (*xFileControl)(sqlite3_file*, int op, void *pArg);  int (*xSectorSize)(sqlite3_file*);  int (*xDeviceCharacteristics)(sqlite3_file*);  /* Additional methods may be added in future releases */};/*** 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.**** The [SQLITE_FCNTL_LOCKSTATE] opcode is used for debugging.  This** opcode causes 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. 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.  The SQLite core never looks** at the internal representation of an [sqlite3_mutex].  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 sqlite3_vfs objects 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 field 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 would** also be no-ops, and any attempt to read the journal would return ** SQLITE_IOERR.  Or the implementation might recognize that 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>** ** {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 are 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 bytes 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 causes 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** 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}**** The sqlite3_extended_result_codes() routine enables or disables the** [SQLITE_IOERR_READ | extended result codes] feature of SQLite.** The extended result codes are disabled by default for historical** compatibility.**** INVARIANTS:**** {F12201} Each new [database connection] has the **          [extended result codes] feature**          disabled by default.**** {F12202} The [sqlite3_extended_result_codes(D,F)] interface will enable**          [extended result codes] for the **          [database connection] D if the F parameter**          is true, or disable them if F is false.*/int sqlite3_extended_result_codes(sqlite3*, int onoff);/*** CAPI3REF: Last Insert Rowid {F12220}**** 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_ as long as those** names are not also used by explicitly declared columns. If** the table has a column of type INTEGER PRIMARY KEY then that column** is another alias for the rowid.**** This routine returns the rowid of the most recent** successful INSERT into the database from the database connection** shown 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. **** For the purposes of this routine, an insert is considered to** be successful even if it is subsequently rolled back.**** INVARIANTS:**** {F12221} The [sqlite3_last_insert_rowid()] function returns the**          rowid of the most recent successful insert done**          on the same database connection and within the same**          trigger context, or zero if there have**          been no qualifying inserts on that connection.**** {F12223} The [sqlite3_last_insert_rowid()] function returns**          same value when called from the same trigger context**          immediately before and after a ROLLBACK.**** LIMITATIONS:**** {U12232} If a separate thread does a new insert on the same**          database connection while the [sqlite3_last_insert_rowid()]**          function is running and thus changes the last insert rowid,**          then the value returned by [sqlite3_last_insert_rowid()] is**          unpredictable and might not equal either the old or the new**          last insert rowid.*/sqlite3_int64 sqlite3_last_insert_rowid(sqlite3*);

⌨️ 快捷键说明

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