| 1 |
<!DOCTYPE html> |
| 2 |
<html><head> |
| 3 |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 4 |
<meta http-equiv="content-type" content="text/html; charset=UTF-8"> |
| 5 |
<link href="../sqlite.css" rel="stylesheet"> |
| 6 |
<title>Database Connection Configuration Options</title> |
| 7 |
<!-- path=../ --> |
| 8 |
</head> |
| 9 |
<body> |
| 10 |
<div class=nosearch> |
| 11 |
<a href="../index.html"> |
| 12 |
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0"> |
| 13 |
</a> |
| 14 |
<div><!-- IE hack to prevent disappearing logo --></div> |
| 15 |
<div class="tagline desktoponly"> |
| 16 |
Small. Fast. Reliable.<br>Choose any three. |
| 17 |
</div> |
| 18 |
<div class="menu mainmenu"> |
| 19 |
<ul> |
| 20 |
<li><a href="../index.html">Home</a> |
| 21 |
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a> |
| 22 |
<li class='wideonly'><a href='../about.html'>About</a> |
| 23 |
<li class='desktoponly'><a href="../docs.html">Documentation</a> |
| 24 |
<li class='desktoponly'><a href="../download.html">Download</a> |
| 25 |
<li class='wideonly'><a href='../copyright.html'>License</a> |
| 26 |
<li class='desktoponly'><a href="../support.html">Support</a> |
| 27 |
<li class='desktoponly'><a href="../prosupport.html">Purchase</a> |
| 28 |
<li class='search' id='search_menubutton'> |
| 29 |
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a> |
| 30 |
</ul> |
| 31 |
</div> |
| 32 |
<div class="menu submenu" id="submenu"> |
| 33 |
<ul> |
| 34 |
<li><a href='../about.html'>About</a> |
| 35 |
<li><a href='../docs.html'>Documentation</a> |
| 36 |
<li><a href='../download.html'>Download</a> |
| 37 |
<li><a href='../support.html'>Support</a> |
| 38 |
<li><a href='../prosupport.html'>Purchase</a> |
| 39 |
</ul> |
| 40 |
</div> |
| 41 |
<div class="searchmenu" id="searchmenu"> |
| 42 |
<form method="GET" action="../search"> |
| 43 |
<select name="s" id="searchtype"> |
| 44 |
<option value="d">Search Documentation</option> |
| 45 |
<option value="c">Search Changelog</option> |
| 46 |
</select> |
| 47 |
<input type="text" name="q" id="searchbox" value=""> |
| 48 |
<input type="submit" value="Go"> |
| 49 |
</form> |
| 50 |
</div> |
| 51 |
</div> |
| 52 |
<script> |
| 53 |
function toggle_div(nm) { |
| 54 |
var w = document.getElementById(nm); |
| 55 |
if( w.style.display=="block" ){ |
| 56 |
w.style.display = "none"; |
| 57 |
}else{ |
| 58 |
w.style.display = "block"; |
| 59 |
} |
| 60 |
} |
| 61 |
function toggle_search() { |
| 62 |
var w = document.getElementById("searchmenu"); |
| 63 |
if( w.style.display=="block" ){ |
| 64 |
w.style.display = "none"; |
| 65 |
} else { |
| 66 |
w.style.display = "block"; |
| 67 |
setTimeout(function(){ |
| 68 |
document.getElementById("searchbox").focus() |
| 69 |
}, 30); |
| 70 |
} |
| 71 |
} |
| 72 |
function div_off(nm){document.getElementById(nm).style.display="none";} |
| 73 |
window.onbeforeunload = function(e){div_off("submenu");} |
| 74 |
/* Disable the Search feature if we are not operating from CGI, since */ |
| 75 |
/* Search is accomplished using CGI and will not work without it. */ |
| 76 |
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){ |
| 77 |
document.getElementById("search_menubutton").style.display = "none"; |
| 78 |
} |
| 79 |
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */ |
| 80 |
function hideorshow(btn,obj){ |
| 81 |
var x = document.getElementById(obj); |
| 82 |
var b = document.getElementById(btn); |
| 83 |
if( x.style.display!='none' ){ |
| 84 |
x.style.display = 'none'; |
| 85 |
b.innerHTML='show'; |
| 86 |
}else{ |
| 87 |
x.style.display = ''; |
| 88 |
b.innerHTML='hide'; |
| 89 |
} |
| 90 |
return false; |
| 91 |
} |
| 92 |
var antiRobot = 0; |
| 93 |
function antiRobotGo(){ |
| 94 |
if( antiRobot!=3 ) return; |
| 95 |
antiRobot = 7; |
| 96 |
var j = document.getElementById("mtimelink"); |
| 97 |
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href"); |
| 98 |
} |
| 99 |
function antiRobotDefense(){ |
| 100 |
document.body.onmousedown=function(){ |
| 101 |
antiRobot |= 2; |
| 102 |
antiRobotGo(); |
| 103 |
document.body.onmousedown=null; |
| 104 |
} |
| 105 |
document.body.onmousemove=function(){ |
| 106 |
antiRobot |= 2; |
| 107 |
antiRobotGo(); |
| 108 |
document.body.onmousemove=null; |
| 109 |
} |
| 110 |
setTimeout(function(){ |
| 111 |
antiRobot |= 1; |
| 112 |
antiRobotGo(); |
| 113 |
}, 100) |
| 114 |
antiRobotGo(); |
| 115 |
} |
| 116 |
antiRobotDefense(); |
| 117 |
</script> |
| 118 |
<!-- keywords: SQLITE_DBCONFIG_DEFENSIVE SQLITE_DBCONFIG_DQS_DDL SQLITE_DBCONFIG_DQS_DML SQLITE_DBCONFIG_ENABLE_FKEY SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION SQLITE_DBCONFIG_ENABLE_QPSG SQLITE_DBCONFIG_ENABLE_TRIGGER SQLITE_DBCONFIG_ENABLE_VIEW SQLITE_DBCONFIG_LEGACY_ALTER_TABLE SQLITE_DBCONFIG_LEGACY_FILE_FORMAT SQLITE_DBCONFIG_LOOKASIDE SQLITE_DBCONFIG_MAINDBNAME SQLITE_DBCONFIG_MAX SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE SQLITE_DBCONFIG_RESET_DATABASE SQLITE_DBCONFIG_REVERSE_SCANORDER SQLITE_DBCONFIG_STMT_SCANSTATUS SQLITE_DBCONFIG_TRIGGER_EQP SQLITE_DBCONFIG_TRUSTED_SCHEMA SQLITE_DBCONFIG_WRITABLE_SCHEMA --> |
| 119 |
<div class=nosearch> |
| 120 |
<a href="../c3ref/intro.html"><h2>SQLite C Interface</h2></a> |
| 121 |
<h2>Database Connection Configuration Options</h2> |
| 122 |
</div> |
| 123 |
<blockquote><pre> |
| 124 |
#define SQLITE_DBCONFIG_MAINDBNAME 1000 /* const char* */ |
| 125 |
#define SQLITE_DBCONFIG_LOOKASIDE 1001 /* void* int int */ |
| 126 |
#define SQLITE_DBCONFIG_ENABLE_FKEY 1002 /* int int* */ |
| 127 |
#define SQLITE_DBCONFIG_ENABLE_TRIGGER 1003 /* int int* */ |
| 128 |
#define SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER 1004 /* int int* */ |
| 129 |
#define SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION 1005 /* int int* */ |
| 130 |
#define SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE 1006 /* int int* */ |
| 131 |
#define SQLITE_DBCONFIG_ENABLE_QPSG 1007 /* int int* */ |
| 132 |
#define SQLITE_DBCONFIG_TRIGGER_EQP 1008 /* int int* */ |
| 133 |
#define SQLITE_DBCONFIG_RESET_DATABASE 1009 /* int int* */ |
| 134 |
#define SQLITE_DBCONFIG_DEFENSIVE 1010 /* int int* */ |
| 135 |
#define SQLITE_DBCONFIG_WRITABLE_SCHEMA 1011 /* int int* */ |
| 136 |
#define SQLITE_DBCONFIG_LEGACY_ALTER_TABLE 1012 /* int int* */ |
| 137 |
#define SQLITE_DBCONFIG_DQS_DML 1013 /* int int* */ |
| 138 |
#define SQLITE_DBCONFIG_DQS_DDL 1014 /* int int* */ |
| 139 |
#define SQLITE_DBCONFIG_ENABLE_VIEW 1015 /* int int* */ |
| 140 |
#define SQLITE_DBCONFIG_LEGACY_FILE_FORMAT 1016 /* int int* */ |
| 141 |
#define SQLITE_DBCONFIG_TRUSTED_SCHEMA 1017 /* int int* */ |
| 142 |
#define SQLITE_DBCONFIG_STMT_SCANSTATUS 1018 /* int int* */ |
| 143 |
#define SQLITE_DBCONFIG_REVERSE_SCANORDER 1019 /* int int* */ |
| 144 |
#define SQLITE_DBCONFIG_MAX 1019 /* Largest DBCONFIG */ |
| 145 |
</pre></blockquote> |
| 146 |
<p> |
| 147 |
These constants are the available integer configuration options that |
| 148 |
can be passed as the second argument to the <a href="../c3ref/db_config.html">sqlite3_db_config()</a> interface.</p> |
| 149 |
|
| 150 |
<p>New configuration options may be added in future releases of SQLite. |
| 151 |
Existing configuration options might be discontinued. Applications |
| 152 |
should check the return code from <a href="../c3ref/db_config.html">sqlite3_db_config()</a> to make sure that |
| 153 |
the call worked. The <a href="../c3ref/db_config.html">sqlite3_db_config()</a> interface will return a |
| 154 |
non-zero <a href="../rescode.html">error code</a> if a discontinued or unsupported configuration option |
| 155 |
is invoked.</p> |
| 156 |
|
| 157 |
<p><dl> |
| 158 |
<a name="sqlitedbconfiglookaside"></a> |
| 159 |
|
| 160 |
<dt>SQLITE_DBCONFIG_LOOKASIDE</dt> |
| 161 |
<dd> This option takes three additional arguments that determine the |
| 162 |
<a href="../malloc.html#lookaside">lookaside memory allocator</a> configuration for the <a href="../c3ref/sqlite3.html">database connection</a>. |
| 163 |
The first argument (the third parameter to <a href="../c3ref/db_config.html">sqlite3_db_config()</a> is a |
| 164 |
pointer to a memory buffer to use for lookaside memory. |
| 165 |
The first argument after the SQLITE_DBCONFIG_LOOKASIDE verb |
| 166 |
may be NULL in which case SQLite will allocate the |
| 167 |
lookaside buffer itself using <a href="../c3ref/free.html">sqlite3_malloc()</a>. The second argument is the |
| 168 |
size of each lookaside buffer slot. The third argument is the number of |
| 169 |
slots. The size of the buffer in the first argument must be greater than |
| 170 |
or equal to the product of the second and third arguments. The buffer |
| 171 |
must be aligned to an 8-byte boundary. If the second argument to |
| 172 |
SQLITE_DBCONFIG_LOOKASIDE is not a multiple of 8, it is internally |
| 173 |
rounded down to the next smaller multiple of 8. The lookaside memory |
| 174 |
configuration for a database connection can only be changed when that |
| 175 |
connection is not currently using lookaside memory, or in other words |
| 176 |
when the "current value" returned by |
| 177 |
<a href="../c3ref/db_status.html">sqlite3_db_status</a>(D,<a href="../c3ref/c_dbstatus_options.html#sqlitedbstatuslookasideused">SQLITE_DBSTATUS_LOOKASIDE_USED</a>,...) is zero. |
| 178 |
Any attempt to change the lookaside memory configuration when lookaside |
| 179 |
memory is in use leaves the configuration unchanged and returns |
| 180 |
<a href="../rescode.html#busy">SQLITE_BUSY</a>.</dd></p> |
| 181 |
|
| 182 |
<p><a name="sqlitedbconfigenablefkey"></a> |
| 183 |
|
| 184 |
<dt>SQLITE_DBCONFIG_ENABLE_FKEY</dt> |
| 185 |
<dd> This option is used to enable or disable the enforcement of |
| 186 |
<a href="../foreignkeys.html">foreign key constraints</a>. There should be two additional arguments. |
| 187 |
The first argument is an integer which is 0 to disable FK enforcement, |
| 188 |
positive to enable FK enforcement or negative to leave FK enforcement |
| 189 |
unchanged. The second parameter is a pointer to an integer into which |
| 190 |
is written 0 or 1 to indicate whether FK enforcement is off or on |
| 191 |
following this call. The second parameter may be a NULL pointer, in |
| 192 |
which case the FK enforcement setting is not reported back. </dd></p> |
| 193 |
|
| 194 |
<p><a name="sqlitedbconfigenabletrigger"></a> |
| 195 |
|
| 196 |
<dt>SQLITE_DBCONFIG_ENABLE_TRIGGER</dt> |
| 197 |
<dd> This option is used to enable or disable <a href="../lang_createtrigger.html">triggers</a>. |
| 198 |
There should be two additional arguments. |
| 199 |
The first argument is an integer which is 0 to disable triggers, |
| 200 |
positive to enable triggers or negative to leave the setting unchanged. |
| 201 |
The second parameter is a pointer to an integer into which |
| 202 |
is written 0 or 1 to indicate whether triggers are disabled or enabled |
| 203 |
following this call. The second parameter may be a NULL pointer, in |
| 204 |
which case the trigger setting is not reported back.</p> |
| 205 |
|
| 206 |
<p><p>Originally this option disabled all triggers. However, since |
| 207 |
SQLite version 3.35.0, TEMP triggers are still allowed even if |
| 208 |
this option is off. So, in other words, this option now only disables |
| 209 |
triggers in the main database schema or in the schemas of ATTACH-ed |
| 210 |
databases. </dd></p> |
| 211 |
|
| 212 |
<p><a name="sqlitedbconfigenableview"></a> |
| 213 |
|
| 214 |
<dt>SQLITE_DBCONFIG_ENABLE_VIEW</dt> |
| 215 |
<dd> This option is used to enable or disable <a href="../lang_createview.html">views</a>. |
| 216 |
There should be two additional arguments. |
| 217 |
The first argument is an integer which is 0 to disable views, |
| 218 |
positive to enable views or negative to leave the setting unchanged. |
| 219 |
The second parameter is a pointer to an integer into which |
| 220 |
is written 0 or 1 to indicate whether views are disabled or enabled |
| 221 |
following this call. The second parameter may be a NULL pointer, in |
| 222 |
which case the view setting is not reported back.</p> |
| 223 |
|
| 224 |
<p><p>Originally this option disabled all views. However, since |
| 225 |
SQLite version 3.35.0, TEMP views are still allowed even if |
| 226 |
this option is off. So, in other words, this option now only disables |
| 227 |
views in the main database schema or in the schemas of ATTACH-ed |
| 228 |
databases. </dd></p> |
| 229 |
|
| 230 |
<p><a name="sqlitedbconfigenablefts3tokenizer"></a> |
| 231 |
|
| 232 |
<dt>SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER</dt> |
| 233 |
<dd> This option is used to enable or disable the |
| 234 |
<a href="../fts3.html#f3tknzr">fts3_tokenizer()</a> function which is part of the |
| 235 |
<a href="../fts3.html">FTS3</a> full-text search engine extension. |
| 236 |
There should be two additional arguments. |
| 237 |
The first argument is an integer which is 0 to disable fts3_tokenizer() or |
| 238 |
positive to enable fts3_tokenizer() or negative to leave the setting |
| 239 |
unchanged. |
| 240 |
The second parameter is a pointer to an integer into which |
| 241 |
is written 0 or 1 to indicate whether fts3_tokenizer is disabled or enabled |
| 242 |
following this call. The second parameter may be a NULL pointer, in |
| 243 |
which case the new setting is not reported back. </dd></p> |
| 244 |
|
| 245 |
<p><a name="sqlitedbconfigenableloadextension"></a> |
| 246 |
|
| 247 |
<dt>SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION</dt> |
| 248 |
<dd> This option is used to enable or disable the <a href="../c3ref/load_extension.html">sqlite3_load_extension()</a> |
| 249 |
interface independently of the <a href="../lang_corefunc.html#load_extension">load_extension()</a> SQL function. |
| 250 |
The <a href="../c3ref/enable_load_extension.html">sqlite3_enable_load_extension()</a> API enables or disables both the |
| 251 |
C-API <a href="../c3ref/load_extension.html">sqlite3_load_extension()</a> and the SQL function <a href="../lang_corefunc.html#load_extension">load_extension()</a>. |
| 252 |
There should be two additional arguments. |
| 253 |
When the first argument to this interface is 1, then only the C-API is |
| 254 |
enabled and the SQL function remains disabled. If the first argument to |
| 255 |
this interface is 0, then both the C-API and the SQL function are disabled. |
| 256 |
If the first argument is -1, then no changes are made to state of either the |
| 257 |
C-API or the SQL function. |
| 258 |
The second parameter is a pointer to an integer into which |
| 259 |
is written 0 or 1 to indicate whether <a href="../c3ref/load_extension.html">sqlite3_load_extension()</a> interface |
| 260 |
is disabled or enabled following this call. The second parameter may |
| 261 |
be a NULL pointer, in which case the new setting is not reported back. |
| 262 |
</dd></p> |
| 263 |
|
| 264 |
<p><a name="sqlitedbconfigmaindbname"></a> |
| 265 |
<dt>SQLITE_DBCONFIG_MAINDBNAME</dt> |
| 266 |
<dd> This option is used to change the name of the "main" database |
| 267 |
schema. The sole argument is a pointer to a constant UTF8 string |
| 268 |
which will become the new schema name in place of "main". SQLite |
| 269 |
does not make a copy of the new main schema name string, so the application |
| 270 |
must ensure that the argument passed into this DBCONFIG option is unchanged |
| 271 |
until after the database connection closes. |
| 272 |
</dd></p> |
| 273 |
|
| 274 |
<p><a name="sqlitedbconfignockptonclose"></a> |
| 275 |
|
| 276 |
<dt>SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE</dt> |
| 277 |
<dd> Usually, when a database in wal mode is closed or detached from a |
| 278 |
database handle, SQLite checks if this will mean that there are now no |
| 279 |
connections at all to the database. If so, it performs a checkpoint |
| 280 |
operation before closing the connection. This option may be used to |
| 281 |
override this behavior. The first parameter passed to this operation |
| 282 |
is an integer - positive to disable checkpoints-on-close, or zero (the |
| 283 |
default) to enable them, and negative to leave the setting unchanged. |
| 284 |
The second parameter is a pointer to an integer |
| 285 |
into which is written 0 or 1 to indicate whether checkpoints-on-close |
| 286 |
have been disabled - 0 if they are not disabled, 1 if they are. |
| 287 |
</dd></p> |
| 288 |
|
| 289 |
<p><a name="sqlitedbconfigenableqpsg"></a> |
| 290 |
<dt>SQLITE_DBCONFIG_ENABLE_QPSG</dt> |
| 291 |
<dd>The SQLITE_DBCONFIG_ENABLE_QPSG option activates or deactivates |
| 292 |
the <a href="../queryplanner-ng.html#qpstab">query planner stability guarantee</a> (QPSG). When the QPSG is active, |
| 293 |
a single SQL query statement will always use the same algorithm regardless |
| 294 |
of values of <a href="../lang_expr.html#varparam">bound parameters</a>. The QPSG disables some query optimizations |
| 295 |
that look at the values of bound parameters, which can make some queries |
| 296 |
slower. But the QPSG has the advantage of more predictable behavior. With |
| 297 |
the QPSG active, SQLite will always use the same query plan in the field as |
| 298 |
was used during testing in the lab. |
| 299 |
The first argument to this setting is an integer which is 0 to disable |
| 300 |
the QPSG, positive to enable QPSG, or negative to leave the setting |
| 301 |
unchanged. The second parameter is a pointer to an integer into which |
| 302 |
is written 0 or 1 to indicate whether the QPSG is disabled or enabled |
| 303 |
following this call. |
| 304 |
</dd></p> |
| 305 |
|
| 306 |
<p><a name="sqlitedbconfigtriggereqp"></a> |
| 307 |
<dt>SQLITE_DBCONFIG_TRIGGER_EQP</dt> |
| 308 |
<dd> By default, the output of EXPLAIN QUERY PLAN commands does not |
| 309 |
include output for any operations performed by trigger programs. This |
| 310 |
option is used to set or clear (the default) a flag that governs this |
| 311 |
behavior. The first parameter passed to this operation is an integer - |
| 312 |
positive to enable output for trigger programs, or zero to disable it, |
| 313 |
or negative to leave the setting unchanged. |
| 314 |
The second parameter is a pointer to an integer into which is written |
| 315 |
0 or 1 to indicate whether output-for-triggers has been disabled - 0 if |
| 316 |
it is not disabled, 1 if it is. |
| 317 |
</dd></p> |
| 318 |
|
| 319 |
<p><a name="sqlitedbconfigresetdatabase"></a> |
| 320 |
<dt>SQLITE_DBCONFIG_RESET_DATABASE</dt> |
| 321 |
<dd> Set the SQLITE_DBCONFIG_RESET_DATABASE flag and then run |
| 322 |
<a href="../lang_vacuum.html">VACUUM</a> in order to reset a database back to an empty database |
| 323 |
with no schema and no content. The following process works even for |
| 324 |
a badly corrupted database file: |
| 325 |
<ol> |
| 326 |
<li> If the database connection is newly opened, make sure it has read the |
| 327 |
database schema by preparing then discarding some query against the |
| 328 |
database, or calling sqlite3_table_column_metadata(), ignoring any |
| 329 |
errors. This step is only necessary if the application desires to keep |
| 330 |
the database in WAL mode after the reset if it was in WAL mode before |
| 331 |
the reset. |
| 332 |
<li> sqlite3_db_config(db, SQLITE_DBCONFIG_RESET_DATABASE, 1, 0); |
| 333 |
<li> <a href="../c3ref/exec.html">sqlite3_exec</a>(db, "<a href="../lang_vacuum.html">VACUUM</a>", 0, 0, 0); |
| 334 |
<li> sqlite3_db_config(db, SQLITE_DBCONFIG_RESET_DATABASE, 0, 0); |
| 335 |
</ol> |
| 336 |
Because resetting a database is destructive and irreversible, the |
| 337 |
process requires the use of this obscure API and multiple steps to |
| 338 |
help ensure that it does not happen by accident. Because this |
| 339 |
feature must be capable of resetting corrupt databases, and |
| 340 |
shutting down virtual tables may require access to that corrupt |
| 341 |
storage, the library must abandon any installed virtual tables |
| 342 |
without calling their xDestroy() methods.</p> |
| 343 |
|
| 344 |
<p><a name="sqlitedbconfigdefensive"></a> |
| 345 |
<dt>SQLITE_DBCONFIG_DEFENSIVE</dt> |
| 346 |
<dd>The SQLITE_DBCONFIG_DEFENSIVE option activates or deactivates the |
| 347 |
"defensive" flag for a database connection. When the defensive |
| 348 |
flag is enabled, language features that allow ordinary SQL to |
| 349 |
deliberately corrupt the database file are disabled. The disabled |
| 350 |
features include but are not limited to the following: |
| 351 |
<ul> |
| 352 |
<li> The <a href="../pragma.html#pragma_writable_schema">PRAGMA writable_schema=ON</a> statement. |
| 353 |
<li> The <a href="../pragma.html#pragma_journal_mode">PRAGMA journal_mode=OFF</a> statement. |
| 354 |
<li> The <a href="../pragma.html#pragma_schema_version">PRAGMA schema_version=N</a> statement. |
| 355 |
<li> Writes to the <a href="../dbpage.html">sqlite_dbpage</a> virtual table. |
| 356 |
<li> Direct writes to <a href="../vtab.html#xshadowname">shadow tables</a>. |
| 357 |
</ul> |
| 358 |
</dd></p> |
| 359 |
|
| 360 |
<p><a name="sqlitedbconfigwritableschema"></a> |
| 361 |
<dt>SQLITE_DBCONFIG_WRITABLE_SCHEMA</dt> |
| 362 |
<dd>The SQLITE_DBCONFIG_WRITABLE_SCHEMA option activates or deactivates the |
| 363 |
"writable_schema" flag. This has the same effect and is logically equivalent |
| 364 |
to setting <a href="../pragma.html#pragma_writable_schema">PRAGMA writable_schema=ON</a> or <a href="../pragma.html#pragma_writable_schema">PRAGMA writable_schema=OFF</a>. |
| 365 |
The first argument to this setting is an integer which is 0 to disable |
| 366 |
the writable_schema, positive to enable writable_schema, or negative to |
| 367 |
leave the setting unchanged. The second parameter is a pointer to an |
| 368 |
integer into which is written 0 or 1 to indicate whether the writable_schema |
| 369 |
is enabled or disabled following this call. |
| 370 |
</dd></p> |
| 371 |
|
| 372 |
<p><a name="sqlitedbconfiglegacyaltertable"></a> |
| 373 |
|
| 374 |
<dt>SQLITE_DBCONFIG_LEGACY_ALTER_TABLE</dt> |
| 375 |
<dd>The SQLITE_DBCONFIG_LEGACY_ALTER_TABLE option activates or deactivates |
| 376 |
the legacy behavior of the <a href="../lang_altertable.html#altertabrename">ALTER TABLE RENAME</a> command such it |
| 377 |
behaves as it did prior to <a href="../releaselog/3_24_0.html">version 3.24.0</a> (2018-06-04). See the |
| 378 |
"Compatibility Notice" on the <a href="../lang_altertable.html#altertabrename">ALTER TABLE RENAME documentation</a> for |
| 379 |
additional information. This feature can also be turned on and off |
| 380 |
using the <a href="../pragma.html#pragma_legacy_alter_table">PRAGMA legacy_alter_table</a> statement. |
| 381 |
</dd></p> |
| 382 |
|
| 383 |
<p><a name="sqlitedbconfigdqsdml"></a> |
| 384 |
|
| 385 |
<dt>SQLITE_DBCONFIG_DQS_DML</dt> |
| 386 |
<dd>The SQLITE_DBCONFIG_DQS_DML option activates or deactivates |
| 387 |
the legacy <a href="../quirks.html#dblquote">double-quoted string literal</a> misfeature for DML statements |
| 388 |
only, that is DELETE, INSERT, SELECT, and UPDATE statements. The |
| 389 |
default value of this setting is determined by the <a href="../compile.html#dqs">-DSQLITE_DQS</a> |
| 390 |
compile-time option. |
| 391 |
</dd></p> |
| 392 |
|
| 393 |
<p><a name="sqlitedbconfigdqsddl"></a> |
| 394 |
|
| 395 |
<dt>SQLITE_DBCONFIG_DQS_DDL</dt> |
| 396 |
<dd>The SQLITE_DBCONFIG_DQS option activates or deactivates |
| 397 |
the legacy <a href="../quirks.html#dblquote">double-quoted string literal</a> misfeature for DDL statements, |
| 398 |
such as CREATE TABLE and CREATE INDEX. The |
| 399 |
default value of this setting is determined by the <a href="../compile.html#dqs">-DSQLITE_DQS</a> |
| 400 |
compile-time option. |
| 401 |
</dd></p> |
| 402 |
|
| 403 |
<p><a name="sqlitedbconfigtrustedschema"></a> |
| 404 |
|
| 405 |
<dt>SQLITE_DBCONFIG_TRUSTED_SCHEMA</dt> |
| 406 |
<dd>The SQLITE_DBCONFIG_TRUSTED_SCHEMA option tells SQLite to |
| 407 |
assume that database schemas are untainted by malicious content. |
| 408 |
When the SQLITE_DBCONFIG_TRUSTED_SCHEMA option is disabled, SQLite |
| 409 |
takes additional defensive steps to protect the application from harm |
| 410 |
including: |
| 411 |
<ul> |
| 412 |
<li> Prohibit the use of SQL functions inside triggers, views, |
| 413 |
CHECK constraints, DEFAULT clauses, expression indexes, |
| 414 |
partial indexes, or generated columns |
| 415 |
unless those functions are tagged with <a href="../c3ref/c_deterministic.html#sqliteinnocuous">SQLITE_INNOCUOUS</a>. |
| 416 |
<li> Prohibit the use of virtual tables inside of triggers or views |
| 417 |
unless those virtual tables are tagged with <a href="../c3ref/c_vtab_constraint_support.html#sqlitevtabinnocuous">SQLITE_VTAB_INNOCUOUS</a>. |
| 418 |
</ul> |
| 419 |
This setting defaults to "on" for legacy compatibility, however |
| 420 |
all applications are advised to turn it off if possible. This setting |
| 421 |
can also be controlled using the <a href="../pragma.html#pragma_trusted_schema">PRAGMA trusted_schema</a> statement. |
| 422 |
</dd></p> |
| 423 |
|
| 424 |
<p><a name="sqlitedbconfiglegacyfileformat"></a> |
| 425 |
|
| 426 |
<dt>SQLITE_DBCONFIG_LEGACY_FILE_FORMAT</dt> |
| 427 |
<dd>The SQLITE_DBCONFIG_LEGACY_FILE_FORMAT option activates or deactivates |
| 428 |
the legacy file format flag. When activated, this flag causes all newly |
| 429 |
created database file to have a schema format version number (the 4-byte |
| 430 |
integer found at offset 44 into the database header) of 1. This in turn |
| 431 |
means that the resulting database file will be readable and writable by |
| 432 |
any SQLite version back to 3.0.0 (2004-06-18). Without this setting, |
| 433 |
newly created databases are generally not understandable by SQLite versions |
| 434 |
prior to 3.3.0 (2006-01-11). As these words are written, there |
| 435 |
is now scarcely any need to generate database files that are compatible |
| 436 |
all the way back to version 3.0.0, and so this setting is of little |
| 437 |
practical use, but is provided so that SQLite can continue to claim the |
| 438 |
ability to generate new database files that are compatible with version |
| 439 |
3.0.0. |
| 440 |
<p>Note that when the SQLITE_DBCONFIG_LEGACY_FILE_FORMAT setting is on, |
| 441 |
the <a href="../lang_vacuum.html">VACUUM</a> command will fail with an obscure error when attempting to |
| 442 |
process a table with generated columns and a descending index. This is |
| 443 |
not considered a bug since SQLite versions 3.3.0 and earlier do not support |
| 444 |
either generated columns or descending indexes. |
| 445 |
</dd></p> |
| 446 |
|
| 447 |
<p><a name="sqlitedbconfigstmtscanstatus"></a> |
| 448 |
|
| 449 |
<dt>SQLITE_DBCONFIG_STMT_SCANSTATUS</dt> |
| 450 |
<dd>The SQLITE_DBCONFIG_STMT_SCANSTATUS option is only useful in |
| 451 |
SQLITE_ENABLE_STMT_SCANSTATUS builds. In this case, it sets or clears |
| 452 |
a flag that enables collection of the sqlite3_stmt_scanstatus_v2() |
| 453 |
statistics. For statistics to be collected, the flag must be set on |
| 454 |
the database handle both when the SQL statement is prepared and when it |
| 455 |
is stepped. The flag is set (collection of statistics is enabled) |
| 456 |
by default. This option takes two arguments: an integer and a pointer to |
| 457 |
an integer.. The first argument is 1, 0, or -1 to enable, disable, or |
| 458 |
leave unchanged the statement scanstatus option. If the second argument |
| 459 |
is not NULL, then the value of the statement scanstatus setting after |
| 460 |
processing the first argument is written into the integer that the second |
| 461 |
argument points to. |
| 462 |
</dd></p> |
| 463 |
|
| 464 |
<p><a name="sqlitedbconfigreversescanorder"></a> |
| 465 |
|
| 466 |
<dt>SQLITE_DBCONFIG_REVERSE_SCANORDER</dt> |
| 467 |
<dd>The SQLITE_DBCONFIG_REVERSE_SCANORDER option changes the default order |
| 468 |
in which tables and indexes are scanned so that the scans start at the end |
| 469 |
and work toward the beginning rather than starting at the beginning and |
| 470 |
working toward the end. Setting SQLITE_DBCONFIG_REVERSE_SCANORDER is the |
| 471 |
same as setting <a href="../pragma.html#pragma_reverse_unordered_selects">PRAGMA reverse_unordered_selects</a>. This option takes |
| 472 |
two arguments which are an integer and a pointer to an integer. The first |
| 473 |
argument is 1, 0, or -1 to enable, disable, or leave unchanged the |
| 474 |
reverse scan order flag, respectively. If the second argument is not NULL, |
| 475 |
then 0 or 1 is written into the integer that the second argument points to |
| 476 |
depending on if the reverse scan order flag is set after processing the |
| 477 |
first argument. |
| 478 |
</dd></p> |
| 479 |
|
| 480 |
<p></dl> |
| 481 |
</p><p>See also lists of |
| 482 |
<a href="../c3ref/objlist.html">Objects</a>, |
| 483 |
<a href="../c3ref/constlist.html">Constants</a>, and |
| 484 |
<a href="../c3ref/funclist.html">Functions</a>.</p> |
| 485 |
|