/ Check-in [3dc823a0]
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 | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 3dc823a0ac12f640a3c54fe1eb7be878d2738529
User & Date: drh 2005-08-02 17:38:19
Context
2005-08-02
17:48
Minor refactoring of the new optimizer code. (CVS 2576) check-in: 868322f7 user: drh tags: trunk
17:38
Update the documentation for the new transaction method on the TCL interface. (CVS 2575) check-in: 3dc823a0 user: drh tags: trunk
17:15
Tests and bug fixes on the new transaction method in the TCL interface. (CVS 2574) check-in: 68dd0ed5 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to www/tclsqlite.tcl.

     1      1   #
     2      2   # Run this Tcl script to generate the tclsqlite.html file.
     3      3   #
     4         -set rcsid {$Id: tclsqlite.tcl,v 1.13 2005/04/03 23:54:45 danielk1977 Exp $}
            4  +set rcsid {$Id: tclsqlite.tcl,v 1.14 2005/08/02 17:38:19 drh Exp $}
     5      5   source common.tcl
     6      6   header {The Tcl interface to the SQLite library}
     7      7   proc METHOD {name text} {
     8      8     puts "<a name=\"$name\">\n<h3>The \"$name\" method</h3>\n"
     9      9     puts $text
    10     10   }
    11     11   puts {
................................................................................
    68     68    last_insert_rowid
    69     69    nullvalue
    70     70    onecolumn
    71     71    progress
    72     72    timeout
    73     73    total_changes
    74     74    trace
           75  + transaction
    75     76   }] {
    76     77    puts "<li><a href=\"#$m\">$m</a></li>"
    77     78   }
    78     79   puts {
    79     80   </ul>
    80     81   </p>
    81     82   
................................................................................
   225    226   Note that it is not necessary to quote the $bigblob value.  That happens
   226    227   automatically.  If $bigblob is a large string or binary object, this
   227    228   technique is not only easier to write, it is also much more efficient
   228    229   since it avoids making a copy of the content of $bigblob.
   229    230   </p>
   230    231   
   231    232   }
          233  +
          234  +##############################################################################
          235  +METHOD transaction {
          236  +
          237  +<p>
          238  +The "transaction" method is used to execute a TCL script inside an SQLite
          239  +database transaction.  The transaction is committed when the script completes,
          240  +or it rolls back if the script fails.  If the transaction occurs within
          241  +another transaction (even one that is started manually using BEGIN) it
          242  +is a no-op.
          243  +</p>
          244  +
          245  +<p>
          246  +The transaction command can be used to group together several SQLite
          247  +commands in a safe way.  You can always start transactions manually using
          248  +BEGIN, of
          249  +course.  But if an error occurs so that the COMMIT or ROLLBACK are never
          250  +run, then the database will remain locked indefinitely.  Also, BEGIN
          251  +does not nest, so you have to make sure no other transactions are active
          252  +before starting a new one.  The "transaction" method takes care of
          253  +all of these details automatically.
          254  +</p>
          255  +
          256  +<p>
          257  +The syntax looks like this:
          258  +</p>
          259  +
          260  +<blockquote>
          261  +<i>dbcmd</i>&nbsp;&nbsp;<b>transaction</b>&nbsp;&nbsp;<i>?transaction-type?</i>
          262  +&nbsp;&nbsp;<i>SCRIPT,</i>
          263  +</blockquote>
          264  +
          265  +
          266  +<p>
          267  +The <i>transaction-type</i> can be one of <b>deferred</b>,
          268  +<b>exclusive</b> or <b>immediate</b>.  The default is deferred.
          269  +</p>
          270  +}
   232    271   
   233    272   ##############################################################################
   234    273   METHOD complete {
   235    274   
   236    275   <p>
   237    276   The "complete" method takes a string of supposed SQL as its only argument.
   238    277   It returns TRUE if the string is a complete statement of SQL and FALSE if