| SQLITE_DBCONFIG_MAINDBNAME(3) | Library Functions Manual | SQLITE_DBCONFIG_MAINDBNAME(3) |
SQLITE_DBCONFIG_MAINDBNAME,
SQLITE_DBCONFIG_LOOKASIDE,
SQLITE_DBCONFIG_ENABLE_FKEY,
SQLITE_DBCONFIG_ENABLE_TRIGGER,
SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER,
SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION,
SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE,
SQLITE_DBCONFIG_ENABLE_QPSG,
SQLITE_DBCONFIG_TRIGGER_EQP,
SQLITE_DBCONFIG_RESET_DATABASE,
SQLITE_DBCONFIG_DEFENSIVE,
SQLITE_DBCONFIG_WRITABLE_SCHEMA,
SQLITE_DBCONFIG_LEGACY_ALTER_TABLE,
SQLITE_DBCONFIG_DQS_DML,
SQLITE_DBCONFIG_DQS_DDL,
SQLITE_DBCONFIG_ENABLE_VIEW,
SQLITE_DBCONFIG_LEGACY_FILE_FORMAT,
SQLITE_DBCONFIG_TRUSTED_SCHEMA,
SQLITE_DBCONFIG_STMT_SCANSTATUS,
SQLITE_DBCONFIG_REVERSE_SCANORDER,
SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE,
SQLITE_DBCONFIG_ENABLE_ATTACH_WRITE,
SQLITE_DBCONFIG_ENABLE_COMMENTS,
SQLITE_DBCONFIG_FP_DIGITS,
SQLITE_DBCONFIG_MAX —
database connection configuration options
#include
<sqlite3.h>
#define SQLITE_DBCONFIG_MAINDBNAME
#define SQLITE_DBCONFIG_LOOKASIDE
#define SQLITE_DBCONFIG_ENABLE_FKEY
#define SQLITE_DBCONFIG_ENABLE_TRIGGER
#define SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER
#define SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION
#define SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE
#define SQLITE_DBCONFIG_ENABLE_QPSG
#define SQLITE_DBCONFIG_TRIGGER_EQP
#define SQLITE_DBCONFIG_RESET_DATABASE
#define SQLITE_DBCONFIG_DEFENSIVE
#define SQLITE_DBCONFIG_WRITABLE_SCHEMA
#define SQLITE_DBCONFIG_LEGACY_ALTER_TABLE
#define SQLITE_DBCONFIG_DQS_DML
#define SQLITE_DBCONFIG_DQS_DDL
#define SQLITE_DBCONFIG_ENABLE_VIEW
#define SQLITE_DBCONFIG_LEGACY_FILE_FORMAT
#define SQLITE_DBCONFIG_TRUSTED_SCHEMA
#define SQLITE_DBCONFIG_STMT_SCANSTATUS
#define SQLITE_DBCONFIG_REVERSE_SCANORDER
#define SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE
#define SQLITE_DBCONFIG_ENABLE_ATTACH_WRITE
#define SQLITE_DBCONFIG_ENABLE_COMMENTS
#define SQLITE_DBCONFIG_FP_DIGITS
#define SQLITE_DBCONFIG_MAX
These constants are the available integer configuration options
that can be passed as the second parameter to the
sqlite3_db_config()
interface.
The
sqlite3_db_config()
interface is a var-args function. It takes a variable number of parameters,
though always at least two. The number of parameters passed into
sqlite3_db_config() depends on which of these constants is given as the
second parameter. This documentation page refers to parameters beyond the
second as "arguments". Thus, when this page says "the N-th
argument" it means "the N-th parameter past the configuration
option" or "the (N+2)-th parameter to
sqlite3_db_config()".
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_db_config()
to make sure that the call worked. The
sqlite3_db_config() interface will return a non-zero
error code if a discontinued or unsupported configuration option is
invoked.
sqlite3_db_config()
that uses SQLITE_DBCONFIG_LOOKASIDE should have a total of five
parameters.
The first argument ("buf")
is a pointer to a memory buffer to use for lookaside memory. The
first argument may be NULL in which case SQLite will allocate the
lookaside buffer itself using
sqlite3_malloc().
The third argument ("cnt") is the number of slots. Lookaside is disabled if "cnt"is less than 1. The "cnt" value will be reduced, if necessary, so that the product of "sz" and "cnt" does not exceed 2,147,418,112. The "cnt" parameter is usually chosen so that the product of "sz" and "cnt" is less than 1,000,000.
If the "buf" argument is not NULL, then it must point to a memory buffer with a size that is greater than or equal to the product of "sz" and "cnt". The buffer must be aligned to an 8-byte boundary. The lookaside memory configuration for a database connection can only be changed when that connection is not currently using lookaside memory, or in other words when the value returned by SQLITE_DBSTATUS_LOOKASIDE_USED is zero. Any attempt to change the lookaside memory configuration when lookaside memory is in use leaves the configuration unchanged and returns SQLITE_BUSY. If the "buf" argument is NULL and an attempt to allocate memory based on "sz" and "cnt" fails, then lookaside is silently disabled.
The SQLITE_CONFIG_LOOKASIDE configuration option can be used to set the default lookaside configuration at initialization. The -DSQLITE_DEFAULT_LOOKASIDE option can be used to set the default lookaside configuration at compile-time. Typical values for lookaside are 1200 for "sz" and 40 to 100 for "cnt".
Originally this option disabled all triggers. However, since SQLite version 3.35.0, TEMP triggers are still allowed even if this option is off. So, in other words, this option now only disables triggers in the main database schema or in the schemas of ATTACH-ed databases.
Originally this option disabled all views. However, since SQLite version 3.35.0, TEMP views are still allowed even if this option is off. So, in other words, this option now only disables views in the main database schema or in the schemas of ATTACH-ed databases.
fts3_tokenizer()
function - part of the FTS3 full-text search engine extension - without
using bound parameters as the parameters. Doing so is disabled by default.
There must be two additional arguments. The first argument is an integer.
If it is passed 0, then using fts3_tokenizer() without bound parameters is
disabled. If it is passed a positive value, then calling fts3_tokenizer
without bound parameters is enabled. If it is passed a negative value,
this setting is not modified - this can be used to query for the current
setting. The second parameter is a pointer to an integer into which is
written 0 or 1 to indicate the current value of this setting (after it is
modified, if applicable). The second parameter may be a NULL pointer, in
which case the value of the setting is not reported back. Refer to FTS3
documentation for further details.sqlite3_load_extension()
interface independently of the
load_extension()
SQL function. The
sqlite3_enable_load_extension()
API enables or disables both the C-API
sqlite3_load_extension() and the SQL function
load_extension(). There must be two additional
arguments. When the first argument to this interface is 1, then only the
C-API is enabled and the SQL function remains disabled. If the first
argument to this interface is 0, then both the C-API and the SQL function
are disabled. If the first argument is -1, then no changes are made to the
state of either the C-API or the SQL function. The second parameter is a
pointer to an integer into which is written 0 or 1 to indicate whether
sqlite3_load_extension() interface is disabled or
enabled following this call. The second parameter may be a NULL pointer,
in which case the new setting is not reported back.sqlite3_db_config() call has a total of three
parameters. The extra argument must be a pointer to a constant UTF8 string
which will become the new schema name in place of "main". SQLite
does not make a copy of the new main schema name string, so the
application must ensure that the argument passed into SQLITE_DBCONFIG
MAINDBNAME is unchanged until after the database connection closes.sqlite3_db_config()) is an integer
which is positive to disable checkpoints-on-close, or zero (the default)
to enable them, and negative to leave the setting unchanged. The second
argument (the fourth parameter) is a pointer to an integer into which is
written 0 or 1 to indicate whether checkpoints-on-close have been disabled
- 0 if they are not disabled, 1 if they are.Because resetting a database is destructive and irreversible, the process requires the use of this obscure API and multiple steps to help ensure that it does not happen by accident. Because this feature must be capable of resetting corrupt databases, and shutting down virtual tables may require access to that corrupt storage, the library must abandon any installed virtual tables without calling their xDestroy() methods.
This setting defaults to "on" for legacy compatibility, however all applications are advised to turn it off if possible. This setting can also be controlled using the PRAGMA trusted_schema statement.
Note that when the SQLITE_DBCONFIG_LEGACY_FILE_FORMAT setting is on, the VACUUM command will fail with an obscure error when attempting to process a table with generated columns and a descending index. This is not considered a bug since SQLite versions 3.3.0 and earlier do not support either generated columns or descending indexes.
sqlite3_stmt_scanstatus_v2()
and the nexec and ncycle columns of the bytecode virtual table. For
statistics to be collected, the flag must be set on the database handle
both when the SQL statement is prepared and when it is stepped. The flag
is set (collection of statistics is enabled) by default.
This option takes two arguments: an integer and a pointer to an integer. The first argument is 1, 0, or -1 to enable, disable, or leave unchanged the statement scanstatus option. If the second argument is not NULL, then the value of the statement scanstatus setting after processing the first argument is written into the integer that the second argument points to.
This option takes two arguments which are an integer and a pointer to an integer. The first argument is 1, 0, or -1 to enable, disable, or leave unchanged the reverse scan order flag, respectively. If the second argument is not NULL, then 0 or 1 is written into the integer that the second argument points to depending on if the reverse scan order flag is set after processing the first argument.
This option takes two arguments which are an integer and a pointer to an integer. The first argument is 1, 0, or -1 to enable, disable, or leave unchanged the attach-create flag, respectively. If the second argument is not NULL, then 0 or 1 is written into the integer that the second argument points to depending on if the attach-create flag is set after processing the first argument.
This option takes two arguments which are an integer and a pointer to an integer. The first argument is 1, 0, or -1 to enable, disable, or leave unchanged the ability to ATTACH another database for writing, respectively. If the second argument is not NULL, then 0 or 1 is written into the integer to which the second argument points, depending on whether the ability to ATTACH a read/write database is enabled or disabled after processing the first argument.
This option takes two arguments which are an integer and a pointer to an integer. The first argument is 1, 0, or -1 to enable, disable, or leave unchanged the ability to use comments in SQL text, respectively. If the second argument is not NULL, then 0 or 1 is written into the integer that the second argument points to depending on if comments are allowed in SQL text after processing the first argument.
This option takes two arguments which are an integer and a pointer to an integer. The first argument is a small integer, between 3 and 23, or zero. The FP_DIGITS setting is changed to that small integer, or left unaltered if the first argument is zero or out of range. The second argument is a pointer to an integer. If the pointer is not NULL, then the value of the FP_DIGITS setting, after possibly being modified by the first arguments, is written into the integer to which the second argument points.
Most of the SQLITE_DBCONFIG options take two arguments, so that
the overall call to
sqlite3_db_config()
has a total of four parameters. The first argument (the third parameter to
sqlite3_db_config()) is an integer. The second argument is a pointer to an
integer. If the first argument is 1, then the option becomes enabled. If the
first integer argument is 0, then the option is disabled. If the first
argument is -1, then the option setting is unchanged. The second argument,
the pointer to an integer, may be NULL. If the second argument is not NULL,
then a value of 0 or 1 is written into the integer to which the second
argument points, depending on whether the setting is disabled or enabled
after applying any changes specified by the first argument.
While most SQLITE_DBCONFIG options use the argument format described in the previous paragraph, the SQLITE_DBCONFIG_MAINDBNAME, SQLITE_DBCONFIG_LOOKASIDE, and SQLITE_DBCONFIG_FP_DIGITS options are different. See the documentation of those exceptional options for details.
These declarations were extracted from the interface documentation at line 2246.
#define SQLITE_DBCONFIG_MAINDBNAME 1000 /* const char* */ #define SQLITE_DBCONFIG_LOOKASIDE 1001 /* void* int int */ #define SQLITE_DBCONFIG_ENABLE_FKEY 1002 /* int int* */ #define SQLITE_DBCONFIG_ENABLE_TRIGGER 1003 /* int int* */ #define SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER 1004 /* int int* */ #define SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION 1005 /* int int* */ #define SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE 1006 /* int int* */ #define SQLITE_DBCONFIG_ENABLE_QPSG 1007 /* int int* */ #define SQLITE_DBCONFIG_TRIGGER_EQP 1008 /* int int* */ #define SQLITE_DBCONFIG_RESET_DATABASE 1009 /* int int* */ #define SQLITE_DBCONFIG_DEFENSIVE 1010 /* int int* */ #define SQLITE_DBCONFIG_WRITABLE_SCHEMA 1011 /* int int* */ #define SQLITE_DBCONFIG_LEGACY_ALTER_TABLE 1012 /* int int* */ #define SQLITE_DBCONFIG_DQS_DML 1013 /* int int* */ #define SQLITE_DBCONFIG_DQS_DDL 1014 /* int int* */ #define SQLITE_DBCONFIG_ENABLE_VIEW 1015 /* int int* */ #define SQLITE_DBCONFIG_LEGACY_FILE_FORMAT 1016 /* int int* */ #define SQLITE_DBCONFIG_TRUSTED_SCHEMA 1017 /* int int* */ #define SQLITE_DBCONFIG_STMT_SCANSTATUS 1018 /* int int* */ #define SQLITE_DBCONFIG_REVERSE_SCANORDER 1019 /* int int* */ #define SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE 1020 /* int int* */ #define SQLITE_DBCONFIG_ENABLE_ATTACH_WRITE 1021 /* int int* */ #define SQLITE_DBCONFIG_ENABLE_COMMENTS 1022 /* int int* */ #define SQLITE_DBCONFIG_FP_DIGITS 1023 /* int int* */ #define SQLITE_DBCONFIG_MAX 1023 /* Largest DBCONFIG */
sqlite3_db_config(3), sqlite3_enable_load_extension(3), sqlite3_exec(3), sqlite3_load_extension(3), sqlite3_malloc(3), sqlite3_prepare(3), sqlite3_step(3), sqlite3_stmt_scanstatus(3), SQLITE_CONFIG_SINGLETHREAD(3), SQLITE_DBSTATUS_LOOKASIDE_USED(3), SQLITE_DETERMINISTIC(3), SQLITE_OK(3), SQLITE_VTAB_CONSTRAINT_SUPPORT(3)
| April 29, 2026 | NetBSD 11.99 |