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

📄 sqlite3.h

📁 嵌入式小型数据库软件
💻 H
📖 第 1 页 / 共 5 页
字号:
** {F11192} With SQLITE_ACCESS_EXISTS, the xAccess method** simply checks whether the file exists.** {F11193} With SQLITE_ACCESS_READWRITE, the xAccess method** checks whether the file is both readable and writable.** {F11194} 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 {F10130}**** 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 {F10145}**** 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** must insure that no other SQLite interfaces are invoked by other** threads while sqlite3_config() is running.  Furthermore, sqlite3_config()** may only be invoked prior to library initialization using** [sqlite3_initialize()] or after shutdown by [sqlite3_shutdown()].** Note, however, that sqlite3_config() can be called as part of the** implementation of an application-defined [sqlite3_os_init()].**** The first argument to sqlite3_config() is an integer** [SQLITE_CONFIG_SINGLETHREAD | configuration option] that determines** what property of SQLite is to be configured.  Subsequent arguments** vary depending on the [SQLITE_CONFIG_SINGLETHREAD | configuration option]** in the first argument.**** When a configuration option is set, sqlite3_config() returns SQLITE_OK.** If the option is unknown or SQLite is unable to set the option** then this routine returns a non-zero [error code].**** The sqlite3_config() interface is considered experimental in that** new configuration options may be added in future releases and existing** configuration options may be discontinued or modified.*/int sqlite3_config(int, ...);/*** CAPI3REF: Memory Allocation Routines {F10155}**** An instance of this object defines the interface between SQLite** and low-level memory allocation routines.**** This object is used in only one place in the SQLite interface.** A pointer to an instance of this object is the argument to** [sqlite3_config()] when the configuration option is** [SQLITE_CONFIG_MALLOC].  By creating an instance of this object** and passing it to [sqlite3_config()] during configuration, an** application can specify an alternative memory allocation subsystem** for SQLite to use for all of its dynamic memory needs.**** Note that SQLite comes with a built-in memory allocator that is** perfectly adequate for the overwhelming majority of applications** and that this object is only useful to a tiny minority of applications** with specialized memory allocation requirements.  This object is** also used during testing of SQLite in order to specify an alternative** memory allocator that simulates memory out-of-memory conditions in** order to verify that SQLite recovers gracefully from such** conditions.**** The xMalloc, xFree, and xRealloc methods must work like the** malloc(), free(), and realloc() functions from the standard library.**** xSize should return the allocated size of a memory allocation** previously obtained from xMalloc or xRealloc.  The allocated size** is always at least as big as the requested size but may be larger.**** The xRoundup method returns what would be the allocated size of** a memory allocation given a particular requested size.  Most memory** allocators round up memory allocations at least to the next multiple** of 8.  Some allocators round up to a larger multiple or to a power of 2.**** The xInit method initializes the memory allocator.  (For example,** it might allocate any require mutexes or initialize internal data** structures.  The xShutdown method is invoked (indirectly) by** [sqlite3_shutdown()] and should deallocate any resources acquired** by xInit.  The pAppData pointer is used as the only parameter to** xInit and xShutdown.*/typedef struct sqlite3_mem_methods sqlite3_mem_methods;struct sqlite3_mem_methods {  void *(*xMalloc)(int);         /* Memory allocation function */  void (*xFree)(void*);          /* Free a prior allocation */  void *(*xRealloc)(void*,int);  /* Resize an allocation */  int (*xSize)(void*);           /* Return the size of an allocation */  int (*xRoundup)(int);          /* Round up request size to allocation size */  int (*xInit)(void*);           /* Initialize the memory allocator */  void (*xShutdown)(void*);      /* Deinitialize the memory allocator */  void *pAppData;                /* Argument to xInit() and xShutdown() */};/*** CAPI3REF: Configuration Options {F10160}**** These constants are the available integer configuration options that** can be passed as the first argument to the [sqlite3_config()] interface.**** New configuration options may be added in future releases of SQLite.** Existing configuration options might be discontinued.  Applications** should check the return code from [sqlite3_config()] to make sure that** the call worked.  The [sqlite3_config()] interface will return a** non-zero [error code] if a discontinued or unsupported configuration option** is invoked.**** <dl>** <dt>SQLITE_CONFIG_SINGLETHREAD</dt>** <dd>There are no arguments to this option.  This option disables** all mutexing and puts SQLite into a mode where it can only be used** by a single thread.</dd>**** <dt>SQLITE_CONFIG_MULTITHREAD</dt>** <dd>There are no arguments to this option.  This option disables** mutexing on [database connection] and [prepared statement] objects.** The application is responsible for serializing access to** [database connections] and [prepared statements].  But other mutexes** are enabled so that SQLite will be safe to use in a multi-threaded** environment.</dd>**** <dt>SQLITE_CONFIG_SERIALIZED</dt>** <dd>There are no arguments to this option.  This option enables** all mutexes including the recursive** mutexes on [database connection] and [prepared statement] objects.** In this mode (which is the default when SQLite is compiled with** [SQLITE_THREADSAFE=1]) the SQLite library will itself serialize access** to [database connections] and [prepared statements] so that the** application is free to use the same [database connection] or the** same [prepared statement] in different threads at the same time.**** <p>This configuration option merely sets the default mutex ** behavior to serialize access to [database connections].  Individual** [database connections] can override this setting** using the [SQLITE_OPEN_NOMUTEX] flag to [sqlite3_open_v2()].</p></dd>**** <dt>SQLITE_CONFIG_MALLOC</dt>** <dd>This option takes a single argument which is a pointer to an** instance of the [sqlite3_mem_methods] structure.  The argument specifies** alternative low-level memory allocation routines to be used in place of** the memory allocation routines built into SQLite.</dd>**** <dt>SQLITE_CONFIG_GETMALLOC</dt>** <dd>This option takes a single argument which is a pointer to an** instance of the [sqlite3_mem_methods] structure.  The [sqlite3_mem_methods]** structure is filled with the currently defined memory allocation routines.** This option can be used to overload the default memory allocation** routines with a wrapper that simulations memory allocation failure or** tracks memory usage, for example.</dd>**** <dt>SQLITE_CONFIG_MEMSTATUS</dt>** <dd>This option takes single boolean argument which enables or disables** the collection of memory allocation statistics.  When disabled, the** following SQLite interfaces become non-operational:**   <ul>**   <li> [sqlite3_memory_used()]**   <li> [sqlite3_memory_highwater()]**   <li> [sqlite3_soft_heap_limit()]**   <li> sqlite3_memory_status()**   </ul>** </dd>**** <dt>SQLITE_CONFIG_SCRATCH</dt>** <dd>This option specifies a static memory buffer that SQLite can use for** scratch memory.  There are three arguments:  A pointer to the memory, the** size of each scratch buffer (sz), and the number of buffers (N).  The sz** argument must be a multiple of 16. The first** argument should point to an allocation of at least (sz+4)*N bytes of memory.** SQLite will use no more than one scratch buffer at once per thread, so** N should be set to the expected maximum number of threads.  The sz** parameter should be 6 times the size of the largest database page size.** Scratch buffers are used as part of the btree balance operation.  If** The btree balancer needs additional memory beyond what is provided by** scratch buffers or if no scratch buffer space is specified, then SQLite** goes to [sqlite3_malloc()] to obtain the memory it needs.</dd>**** <dt>SQLITE_CONFIG_PAGECACHE</dt>** <dd>This option specifies a static memory buffer that SQLite can use for** the database page cache.  There are three arguments: A pointer to the** memory, the size of each page buffer (sz), and the number of pages (N).** The sz argument must be a power of two between 512 and 32768.  The first** argument should point to an allocation of at least (sz+4)*N bytes of memory.** SQLite will use the memory provided by the first argument to satisfy its** memory needs for the first N pages that it adds to cache.  If additional** page cache memory is needed beyond what is provided by this option, then** SQLite goes to [sqlite3_malloc()] for the additional storage space.</dd>**** <dt>SQLITE_CONFIG_HEAP</dt>** <dd>This option specifies a static memory buffer that SQLite will use** for all of its dynamic memory allocation needs beyond those provided** for by [SQLITE_CONFIG_SCRATCH] and [SQLITE_CONFIG_PAGECACHE].** There are three arguments: A pointer to the memory, the number of** bytes in the memory buffer, and the minimum allocation size.  If** the first pointer (the memory pointer) is NULL, then SQLite reverts** to using its default memory allocator (the system malloc() implementation),** undoing any prior invocation of [SQLITE_CONFIG_MALLOC].  If the** memory pointer is not NULL and either [SQLITE_ENABLE_MEMSYS3] or** [SQLITE_ENABLE_MEMSYS5] are defined, then the alternative memory** allocator is engaged to handle all of SQLites memory allocation needs.</dd>**** <dt>SQLITE_CONFIG_MUTEX</dt>** <dd>This option takes a single argument which is a pointer to an** instance of the [sqlite3_mutex_methods] structure.  The argument specifies** alternative low-level mutex routines to be used in place** the mutex routines built into SQLite.</dd>**** <dt>SQLITE_CONFIG_GETMUTEX</dt>** <dd>This option takes a single argument which is a pointer to an** instance of the [sqlite3_mutex_methods] structure.  The** [sqlite3_mutex_methods]** structure is filled with the currently defined mutex routines.** This option can be used to overload the default mutex allocation** routines with a wrapper used to track mutex usage for performance** profiling or testing, for example.</dd>*/#define SQLITE_CONFIG_SINGLETHREAD  1  /* nil */#define SQLITE_CONFIG_MULTITHREAD   2  /* nil */#define SQLITE_CONFIG_SERIALIZED    3  /* nil */#define SQLITE_CONFIG_MALLOC        4  /* sqlite3_mem_methods* */

⌨️ 快捷键说明

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