Index: www/tclsqlite.tcl
==================================================================
--- www/tclsqlite.tcl
+++ www/tclsqlite.tcl
@@ -1,9 +1,9 @@
#
# Run this Tcl script to generate the tclsqlite.html file.
#
-set rcsid {$Id: tclsqlite.tcl,v 1.14 2005/08/02 17:38:19 drh Exp $}
+set rcsid {$Id: tclsqlite.tcl,v 1.15 2005/09/13 07:00:06 drh Exp $}
source common.tcl
header {The Tcl interface to the SQLite library}
proc METHOD {name text} {
puts "\nThe \"$name\" method
\n"
puts $text
@@ -39,24 +39,31 @@
way widgets are created in Tk.
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.
The use of each of these methods will be explained in the sequel, though not in the order shown above.
} -############################################################################## -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 eval {
-rename db1 {} -
The most useful dbcmd method is "eval". The eval method is used to execute SQL on the database. The syntax of the eval method looks @@ -228,10 +209,36 @@ technique is not only easier to write, it is also much more efficient 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 {
+rename db1 {} +
@@ -266,10 +273,42 @@
The transaction-type can be one of deferred, exclusive or immediate. The default is deferred.
} + +############################################################################## +METHOD cache { + ++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 {@@ -277,13 +316,13 @@ It returns TRUE if the string is a complete statement of SQL and FALSE if 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. } ############################################################################## METHOD copy { @@ -424,11 +463,12 @@ ############################################################################## 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.
This is a convenience method. It saves the user from having to @@ -453,11 +493,12 @@ } ############################################################################## 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 the operation being coded. If the callback returns the text string "SQLITE_OK", then the operation is allowed. If it returns "SQLITE_IGNORE",