xref: /netbsd-src/external/public-domain/sqlite/man/SQLITE_DBCONFIG_MAINDBNAME.3 (revision bdc22b2e01993381dcefeff2bc9b56ca75a4235c)
1.Dd March 11, 2017
2.Dt SQLITE_DBCONFIG_MAINDBNAME 3
3.Os
4.Sh NAME
5.Nm SQLITE_DBCONFIG_MAINDBNAME ,
6.Nm SQLITE_DBCONFIG_LOOKASIDE ,
7.Nm SQLITE_DBCONFIG_ENABLE_FKEY ,
8.Nm SQLITE_DBCONFIG_ENABLE_TRIGGER ,
9.Nm SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER ,
10.Nm SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION ,
11.Nm SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE
12.Nd Database Connection Configuration Options
13.Sh SYNOPSIS
14.Fd #define SQLITE_DBCONFIG_MAINDBNAME
15.Fd #define SQLITE_DBCONFIG_LOOKASIDE
16.Fd #define SQLITE_DBCONFIG_ENABLE_FKEY
17.Fd #define SQLITE_DBCONFIG_ENABLE_TRIGGER
18.Fd #define SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER
19.Fd #define SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION
20.Fd #define SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE
21.Sh DESCRIPTION
22These constants are the available integer configuration options that
23can be passed as the second argument to the sqlite3_db_config()
24interface.
25.Pp
26New configuration options may be added in future releases of SQLite.
27Existing configuration options might be discontinued.
28Applications should check the return code from sqlite3_db_config()
29to make sure that the call worked.
30The sqlite3_db_config() interface will return a
31non-zero error code if a discontinued or unsupported configuration
32option is invoked.
33.Bl -tag -width Ds
34.It SQLITE_DBCONFIG_LOOKASIDE
35This option takes three additional arguments that determine the lookaside memory allocator
36configuration for the database connection.
37The first argument (the third parameter to sqlite3_db_config()
38is a pointer to a memory buffer to use for lookaside memory.
39The first argument after the SQLITE_DBCONFIG_LOOKASIDE verb may be
40NULL in which case SQLite will allocate the lookaside buffer itself
41using sqlite3_malloc().
42The second argument is the size of each lookaside buffer slot.
43The third argument is the number of slots.
44The size of the buffer in the first argument must be greater than or
45equal to the product of the second and third arguments.
46The buffer must be aligned to an 8-byte boundary.
47If the second argument to SQLITE_DBCONFIG_LOOKASIDE is not a multiple
48of 8, it is internally rounded down to the next smaller multiple of
498.
50The lookaside memory configuration for a database connection can only
51be changed when that connection is not currently using lookaside memory,
52or in other words when the "current value" returned by sqlite3_db_status(D,SQLITE_CONFIG_LOOKASIDE,...)
53is zero.
54Any attempt to change the lookaside memory configuration when lookaside
55memory is in use leaves the configuration unchanged and returns SQLITE_BUSY.
56.It SQLITE_DBCONFIG_ENABLE_FKEY
57This option is used to enable or disable the enforcement of foreign key constraints.
58There should be two additional arguments.
59The first argument is an integer which is 0 to disable FK enforcement,
60positive to enable FK enforcement or negative to leave FK enforcement
61unchanged.
62The second parameter is a pointer to an integer into which is written
630 or 1 to indicate whether FK enforcement is off or on following this
64call.
65The second parameter may be a NULL pointer, in which case the FK enforcement
66setting is not reported back.
67.It SQLITE_DBCONFIG_ENABLE_TRIGGER
68This option is used to enable or disable  triggers.
69There should be two additional arguments.
70The first argument is an integer which is 0 to disable triggers, positive
71to enable triggers or negative to leave the setting unchanged.
72The second parameter is a pointer to an integer into which is written
730 or 1 to indicate whether triggers are disabled or enabled following
74this call.
75The second parameter may be a NULL pointer, in which case the trigger
76setting is not reported back.
77.It SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER
78This option is used to enable or disable the two-argument version of
79the fts3_tokenizer() function which is part of the
80FTS3 full-text search engine extension.
81There should be two additional arguments.
82The first argument is an integer which is 0 to disable fts3_tokenizer()
83or positive to enable fts3_tokenizer() or negative to leave the setting
84unchanged.
85The second parameter is a pointer to an integer into which is written
860 or 1 to indicate whether fts3_tokenizer is disabled or enabled following
87this call.
88The second parameter may be a NULL pointer, in which case the new setting
89is not reported back.
90.It SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION
91This option is used to enable or disable the sqlite3_load_extension()
92interface independently of the load_extension() SQL
93function.
94The sqlite3_enable_load_extension()
95API enables or disables both the C-API sqlite3_load_extension()
96and the SQL function load_extension().
97There should be two additional arguments.
98When the first argument to this interface is 1, then only the C-API
99is enabled and the SQL function remains disabled.
100If the first argument to this interface is 0, then both the C-API and
101the SQL function are disabled.
102If the first argument is -1, then no changes are made to state of either
103the C-API or the SQL function.
104The second parameter is a pointer to an integer into which is written
1050 or 1 to indicate whether sqlite3_load_extension()
106interface is disabled or enabled following this call.
107The second parameter may be a NULL pointer, in which case the new setting
108is not reported back.
109.It SQLITE_DBCONFIG_MAINDBNAME
110This option is used to change the name of the "main" database schema.
111The sole argument is a pointer to a constant UTF8 string which will
112become the new schema name in place of "main".
113SQLite does not make a copy of the new main schema name string, so
114the application must ensure that the argument passed into this DBCONFIG
115option is unchanged until after the database connection closes.
116.It SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE
117Usually, when a database in wal mode is closed or detached from a database
118handle, SQLite checks if this will mean that there are now no connections
119at all to the database.
120If so, it performs a checkpoint operation before closing the connection.
121This option may be used to override this behaviour.
122The first parameter passed to this operation is an integer - non-zero
123to disable checkpoints-on-close, or zero (the default) to enable them.
124The second parameter is a pointer to an integer into which is written
1250 or 1 to indicate whether checkpoints-on-close have been disabled
126- 0 if they are not disabled, 1 if they are.
127.El
128.Pp
129.Sh SEE ALSO
130.Xr sqlite3 3 ,
131.Xr sqlite3_db_config 3 ,
132.Xr sqlite3_db_status 3 ,
133.Xr sqlite3_enable_load_extension 3 ,
134.Xr sqlite3_load_extension 3 ,
135.Xr sqlite3_malloc 3 ,
136.Xr SQLITE_OK 3 ,
137.Xr SQLITE_CONFIG_SINGLETHREAD 3
138