2N/A#
pragma ident "%Z%%M% %I% %E% SMI" 2N/A** The author disclaims copyright to this source code. In place of 2N/A** a legal notice, here is a blessing: 2N/A** May you do good and not evil. 2N/A** May you find forgiveness for yourself and forgive others. 2N/A** May you share freely, never taking more than you give. 2N/A************************************************************************* 2N/A** This file contains code used to implement the PRAGMA command. 2N/A** Interpret the given string as a boolean value. 2N/A static char *
azTrue[] = {
"yes",
"on",
"true" };
2N/A if( z[0]==0 )
return 0;
2N/A** Interpret the given string as a safety level. Return 0 for OFF, 2N/A** 1 for ON or NORMAL and 2 for FULL. Return 1 for an empty or 2N/A** unrecognized string argument. 2N/A** Note that the values returned are one less that the values that 2N/A** should be passed into sqliteBtreeSetSafetyLevel(). The is done 2N/A** to support legacy SQL code. The safety level used to be boolean 2N/A** and older scripts may have used numbers 0 for OFF and 1 for ON. 2N/A static const struct {
2N/A if( z[0]==0 )
return 1;
2N/A** Interpret the given string as a temp db location. Return 1 for file 2N/A** backed temporary databases, 2 for the Red-Black tree in memory database 2N/A** and 0 to use the compile-time default. 2N/A if( z[0]>=
'0' && z[0]<=
'2' ){
2N/A** If the TEMP database is open, close it and mark the database schema 2N/A** as needing reloading. This must be done when using the TEMP_STORE 2N/A** or DEFAULT_TEMP_STORE pragmas. 2N/A "from within a transaction");
2N/A** Check to see if zRight and zLeft refer to a pragma that queries 2N/A** or changes one of the flags in db->flags. Return 1 if so and 0 if not. 2N/A** Also, implement the pragma. 2N/A static const struct {
2N/A const char *
zName;
/* Name of the pragma */ 2N/A int mask;
/* Mask for the db->flags value */ 2N/A** Process a pragma statement. 2N/A** Pragmas are of this form: 2N/A** The identifier might also be a string. The value is a string, and 2N/A** identifier, or a number. If minusFlag is true, then the value is 2N/A** a number that was preceded by a minus sign. 2N/A ** PRAGMA default_cache_size 2N/A ** PRAGMA default_cache_size=N 2N/A ** The first form reports the current persistent setting for the 2N/A ** page cache size. The value returned is the maximum number of 2N/A ** pages in the page cache. The second form sets both the current 2N/A ** page cache size value and the persistent page cache size value 2N/A ** stored in the database file. 2N/A ** The default cache size is stored in meta-value 2 of page 1 of the 2N/A ** database file. The cache size is actually the absolute value of 2N/A ** this memory location. The sign of meta-value 2 determines the 2N/A ** synchronous setting. A negative value means synchronous is off 2N/A ** and a positive value means synchronous is on. 2N/A ** PRAGMA cache_size 2N/A ** PRAGMA cache_size=N 2N/A ** The first form reports the current local setting for the 2N/A ** page cache size. The local setting can be different from 2N/A ** the persistent cache size value that is stored in the database 2N/A ** file itself. The value returned is the maximum number of 2N/A ** pages in the page cache. The second form sets the local 2N/A ** page cache size value. It does not change the persistent 2N/A ** cache size stored on the disk so the cache size will revert 2N/A ** to its default value when the database is closed and reopened. 2N/A ** N should be a positive integer. 2N/A ** PRAGMA default_synchronous 2N/A ** PRAGMA default_synchronous=ON|OFF|NORMAL|FULL 2N/A ** The first form returns the persistent value of the "synchronous" setting 2N/A ** that is stored in the database. This is the synchronous setting that 2N/A ** is used whenever the database is opened unless overridden by a separate 2N/A ** "synchronous" pragma. The second form changes the persistent and the 2N/A ** local synchronous setting to the value given. 2N/A ** If synchronous is OFF, SQLite does not attempt any fsync() systems calls 2N/A ** to make sure data is committed to disk. Write operations are very fast, 2N/A ** but a power failure can leave the database in an inconsistent state. 2N/A ** If synchronous is ON or NORMAL, SQLite will do an fsync() system call to 2N/A ** make sure data is being written to disk. The risk of corruption due to 2N/A ** a power loss in this mode is negligible but non-zero. If synchronous 2N/A ** is FULL, extra fsync()s occur to reduce the risk of corruption to near 2N/A ** zero, but with a write performance penalty. The default mode is NORMAL. 2N/A ** PRAGMA synchronous 2N/A ** PRAGMA synchronous=OFF|ON|NORMAL|FULL 2N/A ** Return or set the local value of the synchronous flag. Changing 2N/A ** the local value does not make changes to the disk file and the 2N/A ** default value will be restored the next time the database is 2N/A /* The flagPragma() call also generates any necessary code */ 2N/A ** PRAGMA temp_store 2N/A ** PRAGMA temp_store = "default"|"memory"|"file" 2N/A ** Return or set the local value of the temp_store flag. Changing 2N/A ** the local value does not make changes to the disk file and the default 2N/A ** value will be restored the next time the database is opened. 2N/A ** Note that it is possible for the library compile-time options to 2N/A ** override this setting 2N/A ** PRAGMA default_temp_store 2N/A ** PRAGMA default_temp_store = "default"|"memory"|"file" 2N/A ** Return or set the value of the persistent temp_store flag. Any 2N/A ** change does not take effect until the next time the database is 2N/A ** Note that it is possible for the library compile-time options to 2N/A ** override this setting 2N/A /* Code that initializes the integrity check program. Set the 2N/A /* Code to do an BTree integrity check on a single database file. 2N/A /* Code that appears at the end of the integrity check. If no error 2N/A ** messages have been generated, output OK. Otherwise output the 2N/A /* Initialize the VDBE program */ 2N/A /* Do an integrity check on each database file */ 2N/A /* Do an integrity check of the B-Tree 2N/A /* Make sure all the indices are constructed correctly.