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

📄 sqlite3.h

📁 sqlite - amalgamation source
💻 H
📖 第 1 页 / 共 5 页
字号:
  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 *pResOut);  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 {H11310} <S30800>**** These integer constants are opcodes for the xFileControl method** of the [sqlite3_io_methods] object and for 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#define SQLITE_GET_LOCKPROXYFILE      2#define SQLITE_SET_LOCKPROXYFILE      3#define SQLITE_LAST_ERRNO             4/*** CAPI3REF: Mutex Handle {H17110} <S20130>**** 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 {H11140} <S20100>**** An instance of the sqlite3_vfs 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 value of the iVersion field is initially 1 but may be larger in** future versions of SQLite.  Additional fields may be appended to this** object when the iVersion value is increased.  Note that the structure** of the sqlite3_vfs object changes in the transaction between** SQLite version 3.5.9 and 3.6.0 and yet the iVersion field was not** modified.**** 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.  Neither the application code nor the VFS** implementation should use the pNext pointer.**** 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.**** SQLite will guarantee that the zFilename parameter to xOpen** is either a NULL pointer or string obtained** from xFullPathname().  SQLite further guarantees that** the string will be valid and unchanged until xClose() is** called. Because of the previous sentense,** the [sqlite3_file] can safely store a pointer to the** filename if it needs to remember the filename for some reason.** If the zFilename parameter is xOpen is a NULL pointer then xOpen** must invite its own temporary name for the file.  Whenever the ** xFilename parameter is NULL it will also be the case that the** flags parameter will include [SQLITE_OPEN_DELETEONCLOSE].**** 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]. ** 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** change 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>**** The [SQLITE_OPEN_DELETEONCLOSE] flag means the file should be** deleted when it is closed.  The [SQLITE_OPEN_DELETEONCLOSE]** will be set for TEMP  databases, 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.**** At least szOsFile bytes of memory are allocated by SQLite** to hold the  [sqlite3_file] structure passed as the third** argument to xOpen.  The xOpen method does not have to** allocate the structure; it should just fill it in.**** The flags argument to xAccess() may be [SQLITE_ACCESS_EXISTS]** to test for the existence of a file, or [SQLITE_ACCESS_READWRITE] to** test whether a file is readable and writable, or [SQLITE_ACCESS_READ]** to test whether a file is at least readable.   The file can be a** directory.**** SQLite will always allocate at least mxPathname+1 bytes for the** output buffer 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. Since 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 *pResOut);  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);  void (*xDlClose)(sqlite3_vfs*, void*);  int (*xRandomness)(sqlite3_vfs*, int nByte, char *zOut);  int (*xSleep)(sqlite3_vfs*, int microseconds);  int (*xCurrentTime)(sqlite3_vfs*, double*);  int (*xGetLastError)(sqlite3_vfs*, int, char *);  /* New fields may be appended in figure versions.  The iVersion  ** value will increment whenever this happens. */};/*** CAPI3REF: Flags for the xAccess VFS method {H11190} <H11140>**** 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.** With SQLITE_ACCESS_EXISTS, the xAccess method** simply checks whether the file exists.** With SQLITE_ACCESS_READWRITE, the xAccess method** checks whether the file is both readable and writable.** With SQLITE_ACCESS_READ, the xAccess method** checks whether the file is readable.*/#define SQLITE_ACCESS_EXISTS    0#define SQLITE_ACCESS_READWRITE 1#define SQLITE_ACCESS_READ      2/*** CAPI3REF: Initialize The SQLite Library {H10130} <S20000><S30100>**** The sqlite3_initialize() routine initializes the** SQLite library.  The sqlite3_shutdown() routine** deallocates any resources that were allocated by sqlite3_initialize().**** A call to sqlite3_initialize() is an "effective" call if it is** the first time sqlite3_initialize() is invoked during the lifetime of** the process, or if it is the first time sqlite3_initialize() is invoked** following a call to sqlite3_shutdown().  Only an effective call** of sqlite3_initialize() does any initialization.  All other calls** are harmless no-ops.**** Among other things, sqlite3_initialize() shall invoke** sqlite3_os_init().  Similarly, sqlite3_shutdown()** shall invoke sqlite3_os_end().**** The sqlite3_initialize() routine returns [SQLITE_OK] on success.** If for some reason, sqlite3_initialize() is unable to initialize** the library (perhaps it is unable to allocate a needed resource such** as a mutex) it returns an [error code] other than [SQLITE_OK].**** The sqlite3_initialize() routine is called internally by many other** SQLite interfaces so that an application usually does not need to** invoke sqlite3_initialize() directly.  For example, [sqlite3_open()]** calls sqlite3_initialize() so the SQLite library will be automatically** initialized when [sqlite3_open()] is called if it has not be initialized** already.  However, if SQLite is compiled with the [SQLITE_OMIT_AUTOINIT]** compile-time option, then the automatic calls to sqlite3_initialize()** are omitted and the application must call sqlite3_initialize() directly** prior to using any other SQLite interface.  For maximum portability,** it is recommended that applications always invoke sqlite3_initialize()** directly prior to using any other SQLite interface.  Future releases** of SQLite may require this.  In other words, the behavior exhibited** when SQLite is compiled with [SQLITE_OMIT_AUTOINIT] might become the** default behavior in some future release of SQLite.**** The sqlite3_os_init() routine does operating-system specific** initialization of the SQLite library.  The sqlite3_os_end()** routine undoes the effect of sqlite3_os_init().  Typical tasks** performed by these routines include allocation or deallocation** of static resources, initialization of global variables,** setting up a default [sqlite3_vfs] module, or setting up** a default configuration using [sqlite3_config()].**** The application should never invoke either sqlite3_os_init()** or sqlite3_os_end() directly.  The application should only invoke** sqlite3_initialize() and sqlite3_shutdown().  The sqlite3_os_init()** interface is called automatically by sqlite3_initialize() and** sqlite3_os_end() is called by sqlite3_shutdown().  Appropriate** implementations for sqlite3_os_init() and sqlite3_os_end()** are built into SQLite when it is compiled for unix, windows, or os/2.** When built for other platforms (using the [SQLITE_OS_OTHER=1] compile-time** option) the application must supply a suitable implementation for** sqlite3_os_init() and sqlite3_os_end().  An application-supplied** implementation of sqlite3_os_init() or sqlite3_os_end()** must return [SQLITE_OK] on success and some other [error code] upon** failure.*/int sqlite3_initialize(void);int sqlite3_shutdown(void);int sqlite3_os_init(void);int sqlite3_os_end(void);/*** CAPI3REF: Configuring The SQLite Library {H14100} <S20000><S30200>** EXPERIMENTAL**** The sqlite3_config() interface is used to make global configuration** changes to SQLite in order to tune SQLite to the specific needs of** the application.  The default configuration is recommended for most** applications and so this routine is usually not necessary.  It is** provided to support rare applications with unusual needs.**** The sqlite3_config() interface is not threadsafe.  The application

⌨️ 快捷键说明

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