xref: /netbsd-src/external/public-domain/sqlite/man/SQLITE_DBCONFIG_LOOKASIDE.3 (revision a24efa7dea9f1f56c3bdb15a927d3516792ace1c)
1.Dd $Mdocdate$
2.Dt SQLITE_DBCONFIG_LOOKASIDE 3
3.Os
4.Sh NAME
5.Nm SQLITE_DBCONFIG_LOOKASIDE ,
6.Nm SQLITE_DBCONFIG_ENABLE_FKEY ,
7.Nm SQLITE_DBCONFIG_ENABLE_TRIGGER
8.Nd Database Connection Configuration Options
9.Sh SYNOPSIS
10.Fd #define SQLITE_DBCONFIG_LOOKASIDE
11.Fd #define SQLITE_DBCONFIG_ENABLE_FKEY
12.Fd #define SQLITE_DBCONFIG_ENABLE_TRIGGER
13.Sh DESCRIPTION
14These constants are the available integer configuration options that
15can be passed as the second argument to the sqlite3_db_config()
16interface.
17.Pp
18New configuration options may be added in future releases of SQLite.
19Existing configuration options might be discontinued.
20Applications should check the return code from sqlite3_db_config()
21to make sure that the call worked.
22The sqlite3_db_config() interface will return a
23non-zero error code if a discontinued or unsupported configuration
24option is invoked.
25.Bl -tag -width Ds
26.It SQLITE_DBCONFIG_LOOKASIDE
27This option takes three additional arguments that determine the lookaside memory allocator
28configuration for the database connection.
29The first argument (the third parameter to sqlite3_db_config()
30is a pointer to a memory buffer to use for lookaside memory.
31The first argument after the SQLITE_DBCONFIG_LOOKASIDE verb may be
32NULL in which case SQLite will allocate the lookaside buffer itself
33using sqlite3_malloc().
34The second argument is the size of each lookaside buffer slot.
35The third argument is the number of slots.
36The size of the buffer in the first argument must be greater than or
37equal to the product of the second and third arguments.
38The buffer must be aligned to an 8-byte boundary.
39If the second argument to SQLITE_DBCONFIG_LOOKASIDE is not a multiple
40of 8, it is internally rounded down to the next smaller multiple of
418.
42The lookaside memory configuration for a database connection can only
43be changed when that connection is not currently using lookaside memory,
44or in other words when the "current value" returned by sqlite3_db_status(D,SQLITE_CONFIG_LOOKASIDE,...)
45is zero.
46Any attempt to change the lookaside memory configuration when lookaside
47memory is in use leaves the configuration unchanged and returns SQLITE_BUSY.
48.It SQLITE_DBCONFIG_ENABLE_FKEY
49This option is used to enable or disable the enforcement of foreign key constraints.
50There should be two additional arguments.
51The first argument is an integer which is 0 to disable FK enforcement,
52positive to enable FK enforcement or negative to leave FK enforcement
53unchanged.
54The second parameter is a pointer to an integer into which is written
550 or 1 to indicate whether FK enforcement is off or on following this
56call.
57The second parameter may be a NULL pointer, in which case the FK enforcement
58setting is not reported back.
59.It SQLITE_DBCONFIG_ENABLE_TRIGGER
60This option is used to enable or disable  triggers.
61There should be two additional arguments.
62The first argument is an integer which is 0 to disable triggers, positive
63to enable triggers or negative to leave the setting unchanged.
64The second parameter is a pointer to an integer into which is written
650 or 1 to indicate whether triggers are disabled or enabled following
66this call.
67The second parameter may be a NULL pointer, in which case the trigger
68setting is not reported back.
69.El
70.Pp
71.Sh SEE ALSO
72.Xr sqlite3 3 ,
73.Xr SQLITE_OK 3 ,
74.Xr sqlite3_db_config 3 ,
75.Xr sqlite3_db_status 3 ,
76.Xr sqlite3_malloc 3 ,
77.Xr SQLITE_OK 3 ,
78.Xr SQLITE_CONFIG_SINGLETHREAD 3
79