Index: main.mk ================================================================== --- main.mk +++ main.mk @@ -369,11 +369,11 @@ -e 's,\\,\\\\,g' \ -e 's,",\\",g' \ -e 's,^,",' \ -e 's,$$,\\n",' \ $(TOP)/tool/spaceanal.tcl >spaceanal_tcl.h - $(TCCX) $(TCL_FLAGS) -DTCLSH=2 -DSQLITE_TEST=1 -static -o \ + $(TCCX) $(TCL_FLAGS) -DTCLSH=2 -DSQLITE_TEST=1 -o \ sqlite3_analyzer$(EXE) $(TESTSRC) $(TOP)/src/tclsqlite.c \ libsqlite3.a $(LIBTCL) $(THREADLIB) # Rules used to build documentation # @@ -436,10 +436,13 @@ tclsh $(TOP)/www/index.tcl >index.html lang.html: $(TOP)/www/lang.tcl tclsh $(TOP)/www/lang.tcl >lang.html +pragma.html: $(TOP)/www/pragma.tcl + tclsh $(TOP)/www/pragma.tcl >pragma.html + lockingv3.html: $(TOP)/www/lockingv3.tcl tclsh $(TOP)/www/lockingv3.tcl >lockingv3.html oldnews.html: $(TOP)/www/oldnews.tcl tclsh $(TOP)/www/oldnews.tcl >oldnews.html @@ -507,10 +510,11 @@ mingw.html \ nulls.html \ oldnews.html \ omitted.html \ opcode.html \ + pragma.html \ quickstart.html \ speed.html \ sqlite.gif \ sqlite.html \ support.html \ Index: www/c_interface.tcl ================================================================== --- www/c_interface.tcl +++ www/c_interface.tcl @@ -1,9 +1,9 @@ # # Run this Tcl script to generate the sqlite.html file. # -set rcsid {$Id: c_interface.tcl,v 1.41 2004/08/30 14:58:12 drh Exp $} +set rcsid {$Id: c_interface.tcl,v 1.42 2004/11/10 05:48:57 danielk1977 Exp $} source common.tcl header {The C language interface to the SQLite library} puts {

The C language interface to the SQLite library

@@ -134,17 +134,17 @@ argv[i] == 0

The names of the columns are contained in first argc entries of the fourth argument. -If the SHOW_DATATYPES pragma +If the SHOW_DATATYPES pragma is on (it is off by default) then the second argc entries in the 4th argument are the datatypes for the corresponding columns.

-

If the +

If the EMPTY_RESULT_CALLBACKS pragma is set to ON and the result of a query is an empty set, then the callback is invoked once with the third parameter (argv) set to 0. In other words

 argv == 0

Index: www/common.tcl
==================================================================
--- www/common.tcl
+++ www/common.tcl
@@ -53,5 +53,43 @@
   if {$date!=""} {
     puts "This page last modified on $date"
   }
   puts {}
 }
+
+
+# The following two procs, Syntax and Section, are used to ensure
+# consistent formatting in the "lang.html" and "pragma.html" pages.
+#
+proc Syntax {args} {
+  puts {}
+  foreach {rule body} $args {
+    puts ""
+    regsub -all < $body {%LT} body
+    regsub -all > $body {%GT} body
+    regsub -all %LT $body {} body
+    regsub -all %GT $body {} body
+    regsub -all {[]|[*?]} $body {&} body
+    regsub -all "\n" [string trim $body] "
\n" body + regsub -all "\n *" $body "\n\\ \\ \\ \\ " body + regsub -all {[|,.*()]} $body {&} body + regsub -all { = } $body { = } body + regsub -all {STAR} $body {*} body + ## These metacharacters must be handled to undo being + ## treated as SQL punctuation characters above. + regsub -all {RPPLUS} $body {
)+} body + regsub -all {LP} $body {(} body + regsub -all {RP} $body {)} body + ## Place the left-hand side of the rule in the 2nd table column. + puts "" + } + puts {
" + puts "$rule ::=$body
} +} +proc Section {name {label {}}} { + puts "\n
" + if {$label!=""} { + puts "" + } + puts "

$name

\n" +} + Index: www/docs.tcl ================================================================== --- www/docs.tcl +++ www/docs.tcl @@ -1,9 +1,9 @@ # This script generates the "docs.html" page that describes various # sources of documentation available for SQLite. # -set rcsid {$Id: docs.tcl,v 1.6 2004/09/18 18:00:24 drh Exp $} +set rcsid {$Id: docs.tcl,v 1.7 2004/11/10 05:48:57 danielk1977 Exp $} source common.tcl header {SQLite Documentation} puts {

Available Documentation

@@ -25,10 +25,15 @@ doc {SQL Syntax} {lang.html} { This document describes the SQL language that is understood by SQLite. } + +doc {Pragma commands} {pragma.html} { + This document describes SQLite performance tuning options and other + special purpose database commands. +} doc {Version 2 C/C++ API} {c_interface.html} { A description of the C/C++ interface bindings for SQLite through version 2.8 } Index: www/faq.tcl ================================================================== --- www/faq.tcl +++ www/faq.tcl @@ -1,9 +1,9 @@ # # Run this script to generated a faq.html output file # -set rcsid {$Id: faq.tcl,v 1.26 2004/10/10 17:24:55 drh Exp $} +set rcsid {$Id: faq.tcl,v 1.27 2004/11/10 05:48:57 danielk1977 Exp $} source common.tcl header {SQLite Frequently Asked Questions} set cnt 1 proc faq {question answer} { @@ -397,10 +397,14 @@ free-list and a file that is minimal in size. Note, however, that the VACUUM can take some time to run (around a half second per megabyte on the Linux box where SQLite is developed) and it can use up to twice as much temporary disk space as the original file while it is running.

+ +

As of SQLite version 3.1, an alternative to using the VACUUM command + is auto-vacuum mode, enabled using the + auto_vacuum pragma.

} faq { Can I use SQLite in my commercial product without paying royalties? } { Index: www/lang.tcl ================================================================== --- www/lang.tcl +++ www/lang.tcl @@ -1,9 +1,9 @@ # # Run this Tcl script to generate the sqlite.html file. # -set rcsid {$Id: lang.tcl,v 1.74 2004/10/10 17:24:55 drh Exp $} +set rcsid {$Id: lang.tcl,v 1.75 2004/11/10 05:48:57 danielk1977 Exp $} source common.tcl header {Query Language Understood by SQLite} puts {

SQL As Understood By SQLite

@@ -28,89 +28,55 @@

SQLite implements the follow syntax:

    } foreach {section} [lsort -index 0 -dictionary { - {{CREATE TABLE} createtable} - {{CREATE INDEX} createindex} - {VACUUM vacuum} - {{DROP TABLE} droptable} - {{DROP INDEX} dropindex} - {INSERT insert} - {REPLACE replace} - {DELETE delete} - {UPDATE update} - {SELECT select} - {comment comment} - {COPY copy} - {EXPLAIN explain} - {expression expr} - {{BEGIN TRANSACTION} transaction} - {{COMMIT TRANSACTION} transaction} - {{END TRANSACTION} transaction} - {{ROLLBACK TRANSACTION} transaction} - {PRAGMA pragma} - {{ON CONFLICT clause} conflict} - {{CREATE VIEW} createview} - {{DROP VIEW} dropview} - {{CREATE TRIGGER} createtrigger} - {{DROP TRIGGER} droptrigger} - {{ATTACH DATABASE} attach} - {{DETACH DATABASE} detach} + {{CREATE TABLE} #createtable} + {{CREATE INDEX} #createindex} + {VACUUM #vacuum} + {{DROP TABLE} #droptable} + {{DROP INDEX} #dropindex} + {INSERT #insert} + {REPLACE #replace} + {DELETE #delete} + {UPDATE #update} + {SELECT #select} + {comment #comment} + {COPY #copy} + {EXPLAIN #explain} + {expression #expr} + {{BEGIN TRANSACTION} #transaction} + {{COMMIT TRANSACTION} #transaction} + {{END TRANSACTION} #transaction} + {{ROLLBACK TRANSACTION} #transaction} + {PRAGMA pragma.html} + {{ON CONFLICT clause} #conflict} + {{CREATE VIEW} #createview} + {{DROP VIEW} #dropview} + {{CREATE TRIGGER} #createtrigger} + {{DROP TRIGGER} #droptrigger} + {{ATTACH DATABASE} #attach} + {{DETACH DATABASE} #detach} }] { - puts "
  • [lindex $section 0]
  • " + foreach {s_title s_tag} $section {} + puts "
  • $s_title
  • " } puts {

Details on the implementation of each command are provided in the sequel.

} -proc Syntax {args} { - puts {
} - foreach {rule body} $args { - puts "" - regsub -all < $body {%LT} body - regsub -all > $body {%GT} body - regsub -all %LT $body {} body - regsub -all %GT $body {} body - regsub -all {[]|[*?]} $body {&} body - regsub -all "\n" [string trim $body] "
\n" body - regsub -all "\n *" $body "\n\\ \\ \\ \\ " body - regsub -all {[|,.*()]} $body {&} body - regsub -all { = } $body { = } body - regsub -all {STAR} $body {*} body - ## These metacharacters must be handled to undo being - ## treated as SQL punctuation characters above. - regsub -all {RPPLUS} $body {
)+} body - regsub -all {LP} $body {(} body - regsub -all {RP} $body {)} body - ## Place the left-hand side of the rule in the 2nd table column. - puts "" - } - puts {
" - puts "$rule ::=$body
} -} proc Operator {name} { return "$name" } proc Nonterminal {name} { return "$name" } proc Keyword {name} { return "$name" } - - -proc Section {name {label {}}} { - puts "\n
" - if {$label!=""} { - puts "" - } - puts "

$name

\n" -} - proc Example {text} { puts "
$text
" } @@ -1270,220 +1236,10 @@ } #

For additional information, see # conflict.html.

- -Section PRAGMA pragma - -Syntax {sql-statement} { -PRAGMA [= ] | -PRAGMA () -} - -puts { -

The PRAGMA command is used to modify the operation of the SQLite library. -The pragma command is experimental and specific pragma statements may be -removed or added in future releases of SQLite. Use this command -with caution.

- -

The pragmas that take an integer value also accept -symbolic names. The strings "on", "true", and "yes" -are equivalent to 1. The strings "off", "false", -and "no" are equivalent to 0. These strings are case- -insensitive, and do not require quotes. An unrecognized string will be -treated as 1, and will not generate an error. When the value -is returned it is as an integer.

- -

The current implementation supports the following pragmas:

- -
    - -
  • PRAGMA cache_size; -
    PRAGMA cache_size =
    Number-of-pages;

    -

    Query or change the maximum number of database disk pages that SQLite - will hold in memory at once. Each page uses about 1.5K of memory. - The default cache size is 2000. If you are doing UPDATEs or DELETEs - that change many rows of a database and you do not mind if SQLite - uses more memory, you can increase the cache size for a possible speed - improvement.

    -

    When you change the cache size using the cache_size pragma, the - change only endures for the current session. The cache size reverts - to the default value when the database is closed and reopened. Use - the default_cache_size - pragma to check the cache size permanently.

  • - -
  • PRAGMA database_list;

    -

    For each open database, invoke the callback function once with - information about that database. Arguments include the index and - the name the database was attached with. The first row will be for - the main database. The second row will be for the database used to - store temporary tables.

  • - - -
  • PRAGMA default_cache_size; -
    PRAGMA default_cache_size =
    Number-of-pages;

    -

    Query or change the maximum number of database disk pages that SQLite - will hold in memory at once. Each page uses 1K on disk and about - 1.5K in memory. - This pragma works like the - cache_size - pragma with the additional - feature that it changes the cache size persistently. With this pragma, - you can set the cache size once and that setting is retained and reused - every time you reopen the database.

  • - - -
  • PRAGMA default_synchronous; -
    PRAGMA default_synchronous = FULL;
    (2) -
    PRAGMA default_synchronous = NORMAL;
    (1) -
    PRAGMA default_synchronous = OFF;
    (0)

    -

    Query or change the setting of the "synchronous" flag in - the database. The first (query) form will return the setting as an - integer. When synchronous is FULL (2), the SQLite database engine will - pause at critical moments to make sure that data has actually been - written to the disk surface before continuing. This ensures that if - the operating system crashes or if there is a power failure, the database - will be uncorrupted after rebooting. FULL synchronous is very - safe, but it is also slow. - When synchronous is NORMAL (1, the default), the SQLite database - engine will still pause at the most critical moments, but less often - than in FULL mode. There is a very small (though non-zero) chance that - a power failure at just the wrong time could corrupt the database in - NORMAL mode. But in practice, you are more likely to suffer - a catastrophic disk failure or some other unrecoverable hardware - fault. So NORMAL is the default mode. - With synchronous OFF (0), SQLite continues without pausing - as soon as it has handed data off to the operating system. - If the application running SQLite crashes, the data will be safe, but - the database might become corrupted if the operating system - crashes or the computer loses power before that data has been written - to the disk surface. On the other hand, some - operations are as much as 50 or more times faster with synchronous OFF. -

    -

    This pragma changes the synchronous mode persistently. Once changed, - the mode stays as set even if the database is closed and reopened. The - synchronous pragma does the same - thing but only applies the setting to the current session. - -

  • - - -
  • PRAGMA default_temp_store; -
    PRAGMA default_temp_store = DEFAULT;
    (0) -
    PRAGMA default_temp_store = MEMORY;
    (2) -
    PRAGMA default_temp_store = FILE;
    (1)

    -

    Query or change the setting of the "temp_store" flag stored in - the database. When temp_store is DEFAULT (0), the compile-time value - of the symbol TEMP_STORE is used for the temporary database. - When temp_store is MEMORY (2), an in-memory database is used. - When temp_store is FILE (1), a temporary database file on disk will be used. - It is possible for the library compile-time symbol TEMP_STORE to override - this setting. The following table summarizes this:

    - - - - - - - - - - - -
    TEMP_STOREtemp_storetemp database location
    0anyfile
    10file
    11file
    12memory
    20memory
    21file
    22memory
    3anymemory
    - -

    This pragma changes the temp_store mode for whenever the database - is opened in the future. The temp_store mode for the current session - is unchanged. Use the - temp_store pragma to change the - temp_store mode for the current session.

  • - -
  • PRAGMA foreign_key_list(table-name);

    -

    For each foreign key that references a column in the argument - table, invoke the callback function with information about that - foreign key. The callback function will be invoked once for each - column in each foreign key.

  • - -
  • PRAGMA index_info(index-name);

    -

    For each column that the named index references, invoke the - callback function - once with information about that column, including the column name, - and the column number.

  • - -
  • PRAGMA index_list(table-name);

    -

    For each index on the named table, invoke the callback function - once with information about that index. Arguments include the - index name and a flag to indicate whether or not the index must be - unique.

  • - -
  • PRAGMA integrity_check;

    -

    The command does an integrity check of the entire database. It - looks for out-of-order records, missing pages, malformed records, and - corrupt indices. - If any problems are found, then a single string is returned which is - a description of all problems. If everything is in order, "ok" is - returned.

  • - -
  • PRAGMA parser_trace = ON; (1) -
    PRAGMA parser_trace = OFF;
    (0)

    -

    Turn tracing of the SQL parser inside of the - SQLite library on and off. This is used for debugging. - This only works if the library is compiled without the NDEBUG macro. -

  • - - -
  • PRAGMA synchronous; -
    PRAGMA synchronous = FULL;
    (2) -
    PRAGMA synchronous = NORMAL;
    (1) -
    PRAGMA synchronous = OFF;
    (0)

    -

    Query or change the setting of the "synchronous" flag affecting - the database for the duration of the current database connection. - The synchronous flag reverts to its default value when the database - is closed and reopened. For additional information on the synchronous - flag, see the description of the - default_synchronous pragma.

    -
  • - -
  • PRAGMA table_info(table-name);

    -

    For each column in the named table, invoke the callback function - once with information about that column, including the column name, - data type, whether or not the column can be NULL, and the default - value for the column.

  • - - -
  • PRAGMA temp_store; -
    PRAGMA temp_store = DEFAULT;
    (0) -
    PRAGMA temp_store = MEMORY;
    (2) -
    PRAGMA temp_store = FILE;
    (1)

    -

    Query or change the setting of the "temp_store" flag affecting - the database for the duration of the current database connection. - The temp_store flag reverts to its default value when the database - is closed and reopened. For additional information on the temp_store - flag, see the description of the - default_temp_store pragma. Note that it is possible for - the library compile-time options to override this setting.

    - -

    When the temp_store setting is changed, all existing temporary - tables, indices, triggers, and viewers are immediately deleted. -

    -
  • - - -
  • PRAGMA vdbe_trace = ON; (1) -
    PRAGMA vdbe_trace = OFF;
    (0)

    -

    Turn tracing of the virtual database engine inside of the - SQLite library on and off. This is used for debugging. See the - VDBE documentation for more - information.

  • -
- -

No error message is generated if an unknown pragma is issued. -Unknown pragmas are ignored.

-} - - Section REPLACE replace Syntax {sql-statement} { REPLACE INTO [ .] [( )] VALUES ( ) | REPLACE INTO [ .] [( )] @@ -1659,10 +1415,14 @@ up the database file structure. It is not possible to perform the same process on an attached database file.

This command will fail if there is an active transaction. This command has no effect on an in-memory database.

+ +

As of SQLite version 3.1, an alternative to using the VACUUM command +is auto-vacuum mode, enabled using the +auto_vacuum pragma.

} Section {SQLite keywords} keywords ADDED www/pragma.tcl Index: www/pragma.tcl ================================================================== --- /dev/null +++ www/pragma.tcl @@ -0,0 +1,279 @@ +# +# Run this Tcl script to generate the pragma.html file. +# +set rcsid {$Id: pragma.tcl,v 1.1 2004/11/10 05:48:57 danielk1977 Exp $} +source common.tcl +header {Pragma statements supported by SQLite} + +puts { +

The PRAGMA command is a special command used to +modify the operation of the SQLite library or to query the library for +internal (non-table) data. The PRAGMA command is issued using the same +interface as other SQLite commands (e.g. SELECT, INSERT) but is different +different in the following important respects: +

+
    +
  • Specific pragma statements may be removed and others added in future + releases of SQLite. Use with caution! +
  • No error messages are generated if an unknown pragma is issued. + Unknown pragmas are simply ignored. This means if there is a typo in + a pragma statement the library does not inform the user of the fact. +
  • Some pragmas take effect during the SQL compilation stage, not the + execution stage. This means if using the C-language sqlite3_compile(), + sqlite3_step(), sqlite3_finalize() API (or similar in a wrapper + interface), the pragma may be applied to the library during the + sqlite3_compile() call. +
  • The pragma command is unlikely to be compatible with any other SQL + engine. +
+ +

The available pragma's fall into three basic categories:

+
    +
  • Pragmas used to query the schema of the current + database. +
  • Pragmas used to modify the operation of the + SQLite library in some manner, or to query for the current mode of + operation. +
  • Pragmas used to debug the library and verify that + database files are not corrupted. +
+} + +Section {PRAGMA command syntax} syntax + +Syntax {sql-statement} { +PRAGMA [= ] | +PRAGMA () +} + +puts { +

The pragmas that take an integer value also accept +symbolic names. The strings "on", "true", and "yes" +are equivalent to 1. The strings "off", "false", +and "no" are equivalent to 0. These strings are case- +insensitive, and do not require quotes. An unrecognized string will be +treated as 1, and will not generate an error. When the value +is returned it is as an integer.

+} + +Section {Pragmas used to modify library operation} modify + +puts { +
    + +
  • PRAGMA auto_vacuum; +
    PRAGMA auto_vacuum =
    0 | 1;

    +

    Query or set the auto-vacuum flag in the database.

    + +

    Normally, when a transaction that deletes data from a database is + committed, the database file remains the same size. Unused database file + pages are marked as such and reused later on, when data is inserted into + the database. In this mode the VACUUM + command is used to reclaim unused space.

    + +

    When the auto-vacuum flag is set, the database file shrinks when a + transaction that deletes data is committed (The VACUUM command is not + useful in a database with the auto-vacuum flag set). To support this + functionality the database stores extra information internally, resulting + in slightly larger database files than would otherwise be possible.

    + +

    It is only possible to modify the value of the auto-vacuum flag before + any tables have been created in the database. No error message is + returned if an attempt to modify the auto-vacuum flag is made after + one or more tables have been created. +

  • + + +
  • PRAGMA cache_size; +
    PRAGMA cache_size =
    Number-of-pages;

    +

    Query or change the maximum number of database disk pages that SQLite + will hold in memory at once. Each page uses about 1.5K of memory. + The default cache size is 2000. If you are doing UPDATEs or DELETEs + that change many rows of a database and you do not mind if SQLite + uses more memory, you can increase the cache size for a possible speed + improvement.

    +

    When you change the cache size using the cache_size pragma, the + change only endures for the current session. The cache size reverts + to the default value when the database is closed and reopened. Use + the default_cache_size + pragma to check the cache size permanently.

  • + + +
  • PRAGMA default_cache_size; +
    PRAGMA default_cache_size =
    Number-of-pages;

    +

    Query or change the maximum number of database disk pages that SQLite + will hold in memory at once. Each page uses 1K on disk and about + 1.5K in memory. + This pragma works like the + cache_size + pragma with the additional + feature that it changes the cache size persistently. With this pragma, + you can set the cache size once and that setting is retained and reused + every time you reopen the database.

  • + + +
  • PRAGMA default_synchronous; +
    PRAGMA default_synchronous = FULL;
    (2) +
    PRAGMA default_synchronous = NORMAL;
    (1) +
    PRAGMA default_synchronous = OFF;
    (0)

    +

    Query or change the setting of the "synchronous" flag in + the database. The first (query) form will return the setting as an + integer. When synchronous is FULL (2), the SQLite database engine will + pause at critical moments to make sure that data has actually been + written to the disk surface before continuing. This ensures that if + the operating system crashes or if there is a power failure, the database + will be uncorrupted after rebooting. FULL synchronous is very + safe, but it is also slow. + When synchronous is NORMAL (1, the default), the SQLite database + engine will still pause at the most critical moments, but less often + than in FULL mode. There is a very small (though non-zero) chance that + a power failure at just the wrong time could corrupt the database in + NORMAL mode. But in practice, you are more likely to suffer + a catastrophic disk failure or some other unrecoverable hardware + fault. So NORMAL is the default mode. + With synchronous OFF (0), SQLite continues without pausing + as soon as it has handed data off to the operating system. + If the application running SQLite crashes, the data will be safe, but + the database might become corrupted if the operating system + crashes or the computer loses power before that data has been written + to the disk surface. On the other hand, some + operations are as much as 50 or more times faster with synchronous OFF. +

    +

    This pragma changes the synchronous mode persistently. Once changed, + the mode stays as set even if the database is closed and reopened. The + synchronous pragma does the same + thing but only applies the setting to the current session. + +

  • + + +
  • PRAGMA default_temp_store; +
    PRAGMA default_temp_store = DEFAULT;
    (0) +
    PRAGMA default_temp_store = MEMORY;
    (2) +
    PRAGMA default_temp_store = FILE;
    (1)

    +

    Query or change the setting of the "temp_store" flag stored in + the database. When temp_store is DEFAULT (0), the compile-time value + of the symbol TEMP_STORE is used for the temporary database. + When temp_store is MEMORY (2), an in-memory database is used. + When temp_store is FILE (1), a temporary database file on disk will be used. + It is possible for the library compile-time symbol TEMP_STORE to override + this setting. The following table summarizes this:

    + + + + + + + + + + + +
    TEMP_STOREtemp_storetemp database location
    0anyfile
    10file
    11file
    12memory
    20memory
    21file
    22memory
    3anymemory
    + +

    This pragma changes the temp_store mode for whenever the database + is opened in the future. The temp_store mode for the current session + is unchanged. Use the + temp_store pragma to change the + temp_store mode for the current session.

  • + + +
  • PRAGMA synchronous; +
    PRAGMA synchronous = FULL;
    (2) +
    PRAGMA synchronous = NORMAL;
    (1) +
    PRAGMA synchronous = OFF;
    (0)

    +

    Query or change the setting of the "synchronous" flag affecting + the database for the duration of the current database connection. + The synchronous flag reverts to its default value when the database + is closed and reopened. For additional information on the synchronous + flag, see the description of the + default_synchronous pragma.

    +
  • + + +
  • PRAGMA temp_store; +
    PRAGMA temp_store = DEFAULT;
    (0) +
    PRAGMA temp_store = MEMORY;
    (2) +
    PRAGMA temp_store = FILE;
    (1)

    +

    Query or change the setting of the "temp_store" flag affecting + the database for the duration of the current database connection. + The temp_store flag reverts to its default value when the database + is closed and reopened. For additional information on the temp_store + flag, see the description of the + default_temp_store pragma. Note that it is possible for + the library compile-time options to override this setting.

    + +

    When the temp_store setting is changed, all existing temporary + tables, indices, triggers, and viewers are immediately deleted. +

    +
  • +
+} + +Section {Pragma's used to query the database schema} schema + +puts { +
    +
  • PRAGMA database_list;

    +

    For each open database, invoke the callback function once with + information about that database. Arguments include the index and + the name the database was attached with. The first row will be for + the main database. The second row will be for the database used to + store temporary tables.

  • + +
  • PRAGMA foreign_key_list(table-name);

    +

    For each foreign key that references a column in the argument + table, invoke the callback function with information about that + foreign key. The callback function will be invoked once for each + column in each foreign key.

  • + +
  • PRAGMA index_info(index-name);

    +

    For each column that the named index references, invoke the + callback function + once with information about that column, including the column name, + and the column number.

  • + +
  • PRAGMA index_list(table-name);

    +

    For each index on the named table, invoke the callback function + once with information about that index. Arguments include the + index name and a flag to indicate whether or not the index must be + unique.

  • + +
  • PRAGMA table_info(table-name);

    +

    For each column in the named table, invoke the callback function + once with information about that column, including the column name, + data type, whether or not the column can be NULL, and the default + value for the column.

  • +
+} + +Section {Pragma's used to debug the library} debug + +puts { +
    +
  • PRAGMA integrity_check;

    +

    The command does an integrity check of the entire database. It + looks for out-of-order records, missing pages, malformed records, and + corrupt indices. + If any problems are found, then a single string is returned which is + a description of all problems. If everything is in order, "ok" is + returned.

  • + +
  • PRAGMA parser_trace = ON; (1) +
    PRAGMA parser_trace = OFF;
    (0)

    +

    Turn tracing of the SQL parser inside of the + SQLite library on and off. This is used for debugging. + This only works if the library is compiled without the NDEBUG macro. +

  • + + +
  • PRAGMA vdbe_trace = ON; (1) +
    PRAGMA vdbe_trace = OFF;
    (0)

    +

    Turn tracing of the virtual database engine inside of the + SQLite library on and off. This is used for debugging. See the + VDBE documentation for more + information.

  • +
+ +} + Index: www/vdbe.tcl ================================================================== --- www/vdbe.tcl +++ www/vdbe.tcl @@ -1,9 +1,9 @@ # # Run this Tcl script to generate the vdbe.html file. # -set rcsid {$Id: vdbe.tcl,v 1.12 2004/05/31 15:06:30 drh Exp $} +set rcsid {$Id: vdbe.tcl,v 1.13 2004/11/10 05:48:57 danielk1977 Exp $} source common.tcl header {The Virtual Database Engine of SQLite} puts {

The Virtual Database Engine of SQLite

@@ -301,11 +301,11 @@

Tracing VDBE Program Execution

If the SQLite library is compiled without the NDEBUG preprocessor -macro, then the PRAGMA vdbe_trace +macro, then the PRAGMA vdbe_trace causes the VDBE to trace the execution of programs. Though this feature was originally intended for testing and debugging, it can also be useful in learning about how the VDBE operates. Use "PRAGMA vdbe_trace=ON;" to turn tracing on and "PRAGMA vdbe_trace=OFF" to turn tracing back off.