SQLite

Check-in [3dc823a0ac]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Update the documentation for the new transaction method on the TCL interface. (CVS 2575)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 3dc823a0ac12f640a3c54fe1eb7be878d2738529
User & Date: drh 2005-08-02 17:38:19.000
Context
2005-08-02
17:48
Minor refactoring of the new optimizer code. (CVS 2576) (check-in: 868322f7b7 user: drh tags: trunk)
17:38
Update the documentation for the new transaction method on the TCL interface. (CVS 2575) (check-in: 3dc823a0ac user: drh tags: trunk)
17:15
Tests and bug fixes on the new transaction method in the TCL interface. (CVS 2574) (check-in: 68dd0ed5e3 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to www/tclsqlite.tcl.
1
2
3
4
5
6
7
8
9
10
11
#
# Run this Tcl script to generate the tclsqlite.html file.
#
set rcsid {$Id: tclsqlite.tcl,v 1.13 2005/04/03 23:54:45 danielk1977 Exp $}
source common.tcl
header {The Tcl interface to the SQLite library}
proc METHOD {name text} {
  puts "<a name=\"$name\">\n<h3>The \"$name\" method</h3>\n"
  puts $text
}
puts {



|







1
2
3
4
5
6
7
8
9
10
11
#
# 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 $}
source common.tcl
header {The Tcl interface to the SQLite library}
proc METHOD {name text} {
  puts "<a name=\"$name\">\n<h3>The \"$name\" method</h3>\n"
  puts $text
}
puts {
68
69
70
71
72
73
74

75
76
77
78
79
80
81
 last_insert_rowid
 nullvalue
 onecolumn
 progress
 timeout
 total_changes
 trace

}] {
 puts "<li><a href=\"#$m\">$m</a></li>"
}
puts {
</ul>
</p>








>







68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
 last_insert_rowid
 nullvalue
 onecolumn
 progress
 timeout
 total_changes
 trace
 transaction
}] {
 puts "<li><a href=\"#$m\">$m</a></li>"
}
puts {
</ul>
</p>

225
226
227
228
229
230
231






































232
233
234
235
236
237
238
Note that it is not necessary to quote the $bigblob value.  That happens
automatically.  If $bigblob is a large string or binary object, this
technique is not only easier to write, it is also much more efficient
since it avoids making a copy of the content of $bigblob.
</p>

}







































##############################################################################
METHOD complete {

<p>
The "complete" method takes a string of supposed SQL as its only argument.
It returns TRUE if the string is a complete statement of SQL and FALSE if







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
Note that it is not necessary to quote the $bigblob value.  That happens
automatically.  If $bigblob is a large string or binary object, this
technique is not only easier to write, it is also much more efficient
since it avoids making a copy of the content of $bigblob.
</p>

}

##############################################################################
METHOD transaction {

<p>
The "transaction" method is used to execute a TCL script inside an SQLite
database transaction.  The transaction is committed when the script completes,
or it rolls back if the script fails.  If the transaction occurs within
another transaction (even one that is started manually using BEGIN) it
is a no-op.
</p>

<p>
The transaction command can be used to group together several SQLite
commands in a safe way.  You can always start transactions manually using
BEGIN, of
course.  But if an error occurs so that the COMMIT or ROLLBACK are never
run, then the database will remain locked indefinitely.  Also, BEGIN
does not nest, so you have to make sure no other transactions are active
before starting a new one.  The "transaction" method takes care of
all of these details automatically.
</p>

<p>
The syntax looks like this:
</p>

<blockquote>
<i>dbcmd</i>&nbsp;&nbsp;<b>transaction</b>&nbsp;&nbsp;<i>?transaction-type?</i>
&nbsp;&nbsp;<i>SCRIPT,</i>
</blockquote>


<p>
The <i>transaction-type</i> can be one of <b>deferred</b>,
<b>exclusive</b> or <b>immediate</b>.  The default is deferred.
</p>
}

##############################################################################
METHOD complete {

<p>
The "complete" method takes a string of supposed SQL as its only argument.
It returns TRUE if the string is a complete statement of SQL and FALSE if