/ Check-in [394b174e]
Login

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

Overview
Comment:Add some documentation for pragma locking_mode. (CVS 3715)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 394b174e59262a84c530ea73c367d8c389a681b5
User & Date: danielk1977 2007-03-26 08:41:13
Context
2007-03-26
10:27
Add some tests and fixes surrounding exclusive-access mode and the pager change-counter. (CVS 3716) check-in: 72cb2e1a user: danielk1977 tags: trunk
08:41
Add some documentation for pragma locking_mode. (CVS 3715) check-in: 394b174e user: danielk1977 tags: trunk
08:05
Some fixes and test cases for exclusive access mode. (CVS 3714) check-in: 899e6070 user: danielk1977 tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to www/pragma.tcl.

     1      1   #
     2      2   # Run this Tcl script to generate the pragma.html file.
     3      3   #
     4         -set rcsid {$Id: pragma.tcl,v 1.20 2007/02/02 12:33:17 drh Exp $}
            4  +set rcsid {$Id: pragma.tcl,v 1.21 2007/03/26 08:41:13 danielk1977 Exp $}
     5      5   source common.tcl
     6      6   header {Pragma statements supported by SQLite}
     7      7   
     8      8   proc Section {name {label {}}} {
     9      9     puts "\n<hr />"
    10     10     if {$label!=""} {
    11     11       puts "<a name=\"$label\"></a>"
................................................................................
    23     23   <ul>
    24     24   <li>Specific pragma statements may be removed and others added in future
    25     25       releases of SQLite. Use with caution!
    26     26   <li>No error messages are generated if an unknown pragma is issued.
    27     27       Unknown pragmas are simply ignored. This means if there is a typo in 
    28     28       a pragma statement the library does not inform the user of the fact.
    29     29   <li>Some pragmas take effect during the SQL compilation stage, not the
    30         -    execution stage. This means if using the C-language sqlite3_compile(), 
           30  +    execution stage. This means if using the C-language sqlite3_prepare(), 
    31     31       sqlite3_step(), sqlite3_finalize() API (or similar in a wrapper 
    32     32       interface), the pragma may be applied to the library during the 
    33         -    sqlite3_compile() call.
           33  +    sqlite3_prepare() call.
    34     34   <li>The pragma command is unlikely to be compatible with any other SQL
    35     35       engine.
    36     36   </ul>
    37     37   
    38     38   <p>The available pragmas fall into four basic categories:</p>
    39     39   <ul>
    40         -<li>Pragmas used to <a href="#schema">query the schema</a> of the current 
    41         -    database.
    42     40   <li>Pragmas used to <a href="#modify">modify the operation</a> of the 
    43     41       SQLite library in some manner, or to query for the current mode of 
    44     42       operation.
           43  +<li>Pragmas used to <a href="#schema">query the schema</a> of the current 
           44  +    database.
    45     45   <li>Pragmas used to <a href="#version">query or modify the databases two 
    46     46       version values</a>, the schema-version and the user-version.
    47     47   <li>Pragmas used to <a href="#debug">debug the library</a> and verify that
    48     48       database files are not corrupted.
    49     49   </ul>
    50     50   }
    51     51   
................................................................................
   231    231       are created using the latest file format which might not be
   232    232       readable or writable by older versions of SQLite.</p>
   233    233   
   234    234       <p>This flag only affects newly created databases.  It has no
   235    235       effect on databases that already exist.</p>
   236    236   </li>
   237    237   
          238  +<a name="pragma_locking_mode"></a>
          239  +<li><p><b>PRAGMA locking_mode;
          240  +       <br>PRAGMA locking_mode = <i>NORMAL | EXCLUSIVE</i></b></p>
          241  +    <p>This pragma sets or queries the database connection locking-mode. 
          242  +    The locking-mode is either NORMAL or EXCLUSIVE.
          243  +
          244  +    <p>In NORMAL locking-mode (the default), a database connection
          245  +    unlocks the database file at the conclusion of each read or
          246  +    write transaction. When the locking-mode is set to EXCLUSIVE, the
          247  +    database connection never releases file-locks. The first time the
          248  +    database is read in EXCLUSIVE mode, a shared lock is obtained and 
          249  +    held. The first time the database is written, an exclusive lock is
          250  +    obtained and held.
          251  +
          252  +    <p>Database locks obtained by a connection in EXCLUSIVE mode may be
          253  +    released either by closing the database connection, or by setting the
          254  +    locking-mode back to NORMAL using this pragma and then accessing the
          255  +    database file (for read or write). Simply setting the locking-mode to
          256  +    NORMAL is not enough, locks not be released until the next time
          257  +    the database file is accessed.
          258  +
          259  +    <p>There are two reasons to set the locking-mode to EXCLUSIVE. One
          260  +    is if the application actually wants to prevent other processes from
          261  +    accessing the database file. The other is that a small number of
          262  +    filesystem operations are saved by optimizations enabled in this
          263  +    mode. This may be significant in embedded environments.
          264  +</li>
   238    265   
   239    266   <a name="pragma_page_size"></a>
   240    267   <li><p><b>PRAGMA page_size;
   241    268          <br>PRAGMA page_size = </b><i>bytes</i><b>;</b></p>
   242    269       <p>Query or set the page-size of the database. The page-size
   243    270       may only be set if the database has not yet been created. The page
   244    271       size must be a power of two greater than or equal to 512 and less