📄 compile.html
字号:
<p><b>SQLITE_THREADSAFE=<i><0 or 1 or 2></i></b></p><blockquote><p> This option controls whether or not code is included in SQLite to enable it to operate safely in a multithreaded environment. The default is SQLITE_THREADSAFE=1 which is safe for use in a multithreaded environment. When compiled with SQLITE_THREADSAFE=0 all mutexing code is omitted and it is unsafe to use SQLite in a multithreaded program. When compiled with SQLITE_THREADSAFE=2, SQLite can be used in a multithreaded program so long as no two threads attempt to use the same <a href="c3ref/sqlite3.html">database connection</a> at the same time.</p><p> To put it another way, SQLITE_THREADSAFE=1 sets the default <a href="threadsafe.html">threading mode</a> to Serialized. SQLITE_THREADSAFE=2 sets the default <a href="threadsafe.html">threading mode</a> to Multi-threaded. And SQLITE_THREADSAFE=0 sets the <a href="threadsafe.html">threading mode</a> to Single-threaded.</p><p> The value of SQLITE_THREADSAFE can be determined at run-time using the <a href="c3ref/threadsafe.html">sqlite3_threadsafe()</a> interface.</p><p> When SQLite has been compiled with SQLITE_THREADSAFE=1 or SQLITE_THREADSAFE=2 then the <a href="threadsafe.html">threading mode</a> can be altered at run-time using the <a href="c3ref/config.html">sqlite3_config()</a> interface together with one of these verbs:</p><p> <ul> <li><a href="c3ref/c_config_getmalloc.html">SQLITE_CONFIG_SINGLETHREAD</a> <li><a href="c3ref/c_config_getmalloc.html">SQLITE_CONFIG_MULTITHREAD</a> <li><a href="c3ref/c_config_getmalloc.html">SQLITE_CONFIG_SERIALIZED</a> </ul></p><p> The <a href="c3ref/c_open_create.html">SQLITE_OPEN_NOMUTEX</a> and <a href="c3ref/c_open_create.html">SQLITE_OPEN_FULLMUTEX</a> flags to <a href="c3ref/open.html">sqlite3_open_v2()</a> can also be used to adjust the <a href="threadsafe.html">threading mode</a> of individual <a href="c3ref/sqlite3.html">database connections</a> at run-time.</p><p> Note that when SQLite is compiled with SQLITE_THREADSAFE=0, the code to make SQLite threadsafe is omitted from the build. When this occurs, it is impossible to change the <a href="threadsafe.html">threading mode</a> at start-time or run-time.</p><p> See the <a href="threadsafe.html">threading mode</a> documentation for additional information on aspects of using SQLite in a multithreaded environment.</p></blockquote><a name="temp_store"></a><p><b>SQLITE_TEMP_STORE=<i><0 through 3></i></b></p><blockquote><p> This option controls whether temporary files are stored on disk or in memory. The meanings for various settings of this compile-time option are as follows:</p><p> <table cellpadding="2" border="1"> <tr><th>SQLITE_TEMP_STORE</th><th>Meaning</th></tr> <tr><td align="center">0</td><td>Always use temporary files</td></tr> <tr><td align="center">1</td><td>Use files by default but allow the <a href="pragma.html#pragma_temp_store">PRAGMA temp_store</a> command to override</td></tr> <tr><td align="center">2</td><td>Use memory by default but allow the <a href="pragma.html#pragma_temp_store">PRAGMA temp_store</a> command to override</td></tr> <tr><td align="center">3</td><td>Always use memory</td></tr> </table></p><p> The default setting is 1. Additional information can be found in <a href="tempfiles.html#tempstore">tempfiles.html</a>.</p></blockquote><a name="enablefeatures"></a><h2>1.4 Options To Enable Features Normally Turned Off</h2><a name="enable_atomic_write"></a><p><b>SQLITE_ENABLE_ATOMIC_WRITE</b></p><blockquote><p> If this C-preprocessor macro is defined and if the xDeviceCharacteristics method of <a href="c3ref/io_methods.html">sqlite3_io_methods</a> object for a database file reports (via one of the <a href="c3ref/c_iocap_atomic.html">SQLITE_IOCAP_ATOMIC</a> bits) that the filesystem supports atomic writes and if a transaction involves a change to only a single page of the database file, then the transaction commits with just a single write request of a single page of the database and no rollback journal is created or written. On filesystems that support atomic writes, this optimization can result in significant speed improvements for small updates. However, few filesystems support this capability and the code paths that check for this capability slow down write performance on systems that lack atomic write capability, so this feature is disabled by default.</p></blockquote><a name="enable_column_metadata"></a><p><b>SQLITE_ENABLE_COLUMN_METADATA</b></p><blockquote><p> When this C-preprocessor macro is defined, SQLite includes some additional APIs that provide convenient access to meta-data about tables and queries. The APIs that are enabled by this option are:</p><p> <ul> <li> <a href="c3ref/column_database_name.html">sqlite3_column_database_name()</a> </li> <li> <a href="c3ref/column_database_name.html">sqlite3_column_database_name16()</a> </li> <li> <a href="c3ref/column_database_name.html">sqlite3_column_table_name()</a> </li> <li> <a href="c3ref/column_database_name.html">sqlite3_column_table_name16()</a> </li> <li> <a href="c3ref/column_database_name.html">sqlite3_column_origin_name()</a> </li> <li> <a href="c3ref/column_database_name.html">sqlite3_column_origin_name16()</a> </li> <li> <a href="c3ref/table_column_metadata.html">sqlite3_table_column_metadata()</a> </li> </ul></p></blockquote><a name="enable_fts3"></a><p><b>SQLITE_ENABLE_FTS3</b></p><blockquote><p> When this option is defined in the <a href="amalgamation.html">amalgamation</a>, version 3 of the full-text search engine is added to the build automatically.</p></blockquote><a name="enable_icu"></a><p><b>SQLITE_ENABLE_ICU</b></p><blockquote><p> This option causes the <a href="http://www.icu-project.org/">International Components for Unicode</a> or "ICU" extension to SQLite to be added to the build. </p></blockquote><a name="enable_iotrace"></a><p><b>SQLITE_ENABLE_IOTRACE</b></p><blockquote><p> When both the SQLite core and the <a href="sqlite.html">Command Line Interface</a> (CLI) are both compiled with this option, then the CLI provides an extra command named ".iotrace" that provides a low-level log of I/O activity. This option is experimental and may be discontinued in a future release.</p></blockquote><a name="enable_locking_style"></a><p><b>SQLITE_ENABLE_LOCKING_STYLE</b></p><blockquote><p> This option enables additional logic in the OS interface layer for Mac OS X. The additional logic attempts to determine the type of the underlying filesystem and choose and alternative locking strategy that works correctly for that filesystem type. Five locking strategies are available:</p><p> <ul> <li> POSIX locking style. This is the default locking style and the style used by other (non Mac OS X) Unixes. Locks are obtained and released using the fcntl() system call.</p><p> <li> AFP locking style. This locking style is used for network file systems that use the AFP (Apple Filing Protocol) protocol. Locks are obtained by calling the library function _AFPFSSetLock().</p><p> <li> Flock locking style. This is used for file-systems that do not support POSIX locking style. Locks are obtained and released using the flock() system call.</p><p> <li> Dot-file locking style. This locking style is used when neither flock nor POSIX locking styles are supported by the file system. Database locks are obtained by creating and entry in the file-system at a well-known location relative to the database file (a "dot-file") and relinquished by deleting the same file.</p><p> <li> No locking style. If none of the above can be supported, this locking style is used. No database locking mechanism is used. When this system is used it is not safe for a single database to be accessed by multiple clients. </ul></p><p> Additionally, five extra VFS implementations are provided as well as the default. By specifying one of the extra VFS implementations when calling <a href="c3ref/open.html">sqlite3_open_v2()</a>, an application may bypass the file-system detection logic and explicitly select one of the above locking styles. The five extra VFS implementations are called "unix-posix", "unix-afp", "unix-flock", "unix-dotfile" and "unix-none".</p></blockquote><a name="enable_memory_management"></a><p><b>SQLITE_ENABLE_MEMORY_MANAGEMENT</b></p><blockquote><p> This option adds extra logic to SQLite that allows it to release unused memory upon request. This option must be enabled in order for the <a href="c3ref/release_memory.html">sqlite3_release_memory()</a> interface to work. If this compile-time option is not used, the <a href="c3ref/release_memory.html">sqlite3_release_memory()</a> interface is a no-op. Since <a href="c3ref/soft_heap_limit.html">sqlite3_soft_heap_limit()</a> depends on <a href="c3ref/release_memory.html">sqlite3_release_memory()</a>, this option is also necessary for the correct operation of <a href="c3ref/soft_heap_limit.html">sqlite3_soft_heap_limit()</a>.</p></blockquote><a name="enable_memsys3"></a><p><b>SQLITE_ENABLE_MEMSYS3</b></p><blockquote><p> This option includes code in SQLite that implements an alternative memory allocator. This alternative memory allocator is only engaged when the <a href="c3ref/c_config_getmalloc.html">SQLITE_CONFIG_HEAP</a> option to <a href="c3ref/config.html">sqlite3_config()</a> is used to supply a large chunk of memory from which all memory allocations are taken. The MEMSYS3 memory allocator uses a hybrid allocation algorithm patterned after dlmalloc(). Only one of SQLITE_ENABLE_MEMSYS3 and SQLITE_ENABLE_MEMSYS5 may be enabled at once.</p></blockquote><a name="enable_memsys5"></a><p><b>SQLITE_ENABLE_MEMSYS5</b></p><blockquote><p> This option includes code in SQLite that implements an alternative memory allocator. This alternative memory allocator is only engaged when the <a href="c3ref/c_config_getmalloc.html">SQLITE_CONFIG_HEAP</a> option to <a href="c3ref/config.html">sqlite3_config()</a> is used to supply a large chunk of memory from which all memory allocations are taken. The MEMSYS5 module rounds all allocations up to the next power of two and uses a first-fit, buddy-allocator algorithm that provides strong guarantees against fragmentation and breakdown subject to certain operating constraints.</p></blockquote><a name="enable_rtree"></a><p><b>SQLITE_ENABLE_RTREE</b></p><blockquote><p> This option causes SQLite to include support for the <a href="rtree.html">R*Tree index extension</a>.</p></blockquote><a name="enable_update_delete_limit"></a><p><b>SQLITE_ENABLE_UPDATE_DELETE_LIMIT</b></p><blockquote><p> This option enables an optional ORDER BY and LIMIT clause on <a href="lang_update.html">UPDATE</a> and <a href="lang_delete.html">DELETE</a> statements.</p><p> <p>If this option is defined, then it must also be defined when using the 'lemon' tool to generate a parse.c file. Because of this, this option may only be used when the library is built from source, not from the <a href="amalgamation.html">amalgamation</a> or from the collection of pre-packaged C files provided for non-Unix like platforms on the website. </p></p></blockquote><a name="yytrackmaxstackdepth"></a><p><b>YYTRACKMAXSTACKDEPTH</b></p><blockquote><p> This option causes the LALR(1) parser stack depth to be tracked and reported using the <a href="c3ref/status.html">sqlite3_status</a>(<a href="c3ref/c_status_malloc_size.html">SQLITE_STATUS_PARSER_STACK</a>,...) interface. SQLite's LALR(1) parser has a fixed stack depth (determined at compile-time using the <a href="compile.html#yystackdepth">YYSTACKDEPTH</a> options). This option can be used to help determine if an application is getting close to exceeding the maximum LALR(1) stack depth.</p></blockquote><a name="disablefeatures"></a><h2>1.5 Options To Disable Features Normally Turned On</h2><a name="disable_lfs"></a><p><b>SQLITE_DISABLE_LFS</b></p><blockquote><p> If this C-preprocessor macro is defined, large file support
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -