From: drh
The name of the database is just the name of a disk file in which
-the database is stored.
+the database is stored. If the name of the database is an empty
+string or the special name ":memory:" then a new database is created
+in memory.
Once an SQLite database is open, it can be controlled using
-methods of the dbcmd. There are currently 19 methods
+methods of the dbcmd. There are currently 21 methods
defined: The sqlite3 also accepts an optional third argument called
+the "mode". This argument is a legacy from SQLite version 2 and is
+currently ignored.
}
foreach m [lsort {
authorizer
busy
+ cache
changes
close
collate
@@ -85,32 +92,6 @@ not in the order shown above.
-As its name suggests, the "close" method to an SQLite database just -closes the database. This has the side-effect of deleting the -dbcmd Tcl command. Here is an example of opening and then -immediately closing a database: -
- --sqlite3 db1 ./testdb- -
-db1 close -
-If you delete the dbcmd directly, that has the same effect -as invoking the "close" method. So the following code is equivalent -to the previous:
- --sqlite3 db1 ./testdb-} - ############################################################################## METHOD eval {
-rename db1 {} -
@@ -231,6 +212,32 @@ since it avoids making a copy of the content of $bigblob. } +############################################################################## +METHOD close { + +
+As its name suggests, the "close" method to an SQLite database just +closes the database. This has the side-effect of deleting the +dbcmd Tcl command. Here is an example of opening and then +immediately closing a database: +
+ ++sqlite3 db1 ./testdb+ +
+db1 close +
+If you delete the dbcmd directly, that has the same effect +as invoking the "close" method. So the following code is equivalent +to the previous:
+ ++sqlite3 db1 ./testdb+} + ############################################################################## METHOD transaction { @@ -269,6 +276,38 @@ The transaction-type can be one of deferred, } +############################################################################## +METHOD cache { + +
+rename db1 {} +
+The "eval" method described above keeps a cache of +prepared statements +for recently evaluated SQL commands. +The "cache" method is used to control this cache. +The first form of this command is:
+ ++dbcmd cache size N ++ +
This sets the maximum number of statements that can be cached. +The upper limit is 100. The default is 10. If you set the cache size +to 0, no caching is done.
+ +The second form of the command is this:
+ + ++dbcmd cache flush ++ +
The cache-flush method +finalizes +all prepared statements currently +in the cache.
+ +} + ############################################################################## METHOD complete { @@ -279,9 +318,9 @@ there is more to be entered.The "complete" method is useful when building interactive applications in order to know when the user has finished entering a line of SQL code. -This is really just an interface to the sqlite3_complete() C -function. Refer to the C/C++ interface -specification for additional information.
+This is really just an interface to the +sqlite3_complete() C +function. } ############################################################################## @@ -426,7 +465,8 @@ representation for NULL values is an empty string. ############################################################################## METHOD onecolumn { -The "onecolumn" method works like "eval" in that it evaluates the +
The "onecolumn" method works like +"eval" in that it evaluates the SQL query statement given as its argument. The difference is that "onecolumn" returns a single element which is the first column of the first row of the query result.
@@ -455,7 +495,8 @@ current database connection was first opened. ############################################################################## METHOD authorizer { -The "authorizer" method provides access to the sqlite3_set_authorizer +
The "authorizer" method provides access to the +sqlite3_set_authorizer C/C++ interface. The argument to authorizer is the name of a procedure that is called when SQL statements are being compiled in order to authorize certain operations. The callback procedure takes 5 arguments which describe