/ Check-in [0b0c0492]
Login

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

Overview
Comment:Fix for ticket #111: Update the documentation to explain that you may not start a transaction in one thread and complete it in another thread under Linux Threads where each thread has its own process ID. (CVS 695)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 0b0c0492cc1e55c1c4feba6e92765ea09896096c
User & Date: drh 2002-07-30 17:42:10
Context
2002-07-30
18:43
Fix for ticket #114: Correctly handle SQLITE_BUSY if it occurs during database initialization. (CVS 696) check-in: 5b814b5d user: drh tags: trunk
17:42
Fix for ticket #111: Update the documentation to explain that you may not start a transaction in one thread and complete it in another thread under Linux Threads where each thread has its own process ID. (CVS 695) check-in: 0b0c0492 user: drh tags: trunk
17:20
Fix for ticket #71: Correctly handle CR and CRLF line terminators in the input files for the COPY command. (CVS 694) check-in: be131575 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to www/c_interface.tcl.

     1      1   #
     2      2   # Run this Tcl script to generate the sqlite.html file.
     3      3   #
     4         -set rcsid {$Id: c_interface.tcl,v 1.31 2002/07/13 17:18:37 drh Exp $}
            4  +set rcsid {$Id: c_interface.tcl,v 1.32 2002/07/30 17:42:10 drh Exp $}
     5      5   
     6      6   puts {<html>
     7      7   <head>
     8      8     <title>The C language interface to the SQLite library</title>
     9      9   </head>
    10     10   <body bgcolor=white>
    11     11   <h1 align=center>
................................................................................
   297    297   </p></dd>
   298    298   <dt>SQLITE_MISUSE</dt>
   299    299   <dd><p>This error might occur if one or more of the SQLite API routines
   300    300   is used incorrectly.  Examples of incorrect usage include calling
   301    301   <b>sqlite_exec()</b> after the database has been closed using
   302    302   <b>sqlite_close()</b> or calling <b>sqlite_exec()</b> with the same
   303    303   database pointer simultaneously from two separate threads.
          304  +This error code will also be returned under Unix if <b>sqlite_exec()</b>
          305  +is called while a transaction is pending that was started in another
          306  +process or thread that has a different process ID.  
   304    307   </p></dd>
   305    308   </dl>
   306    309   </blockquote>
   307    310   
   308    311   <h2>The Extended API</h2>
   309    312   
   310    313   <p>Only the three core routines shown above are required to use
................................................................................
   787    790   
   788    791   <p>
   789    792   SQLite now implements all of its built-in functions using this
   790    793   interface.  For additional information and examples on how to create
   791    794   new SQL functions, review the SQLite source code in the file
   792    795   <b>func.c</b>.
   793    796   </p>
          797  +
          798  +<h2>Multi-Threading And SQLite</h2>
          799  +
          800  +<p>
          801  +If SQLite is compiled with the THREADSAFE preprocessor macro set to 1,
          802  +then it is safe to use SQLite from two or more threads of the same process
          803  +at the same time.  But each thread should have its own <b>sqlite*</b>
          804  +pointer returned from <b>sqlite_open()</b>.  It is never safe for two
          805  +or more threads to access the same <b>sqlite*</b> pointer at the same time.
          806  +</p>
          807  +
          808  +<p>
          809  +In precompiled SQLite libraries available on the website, the Unix
          810  +versions are compiled with THREADSAFE turned off but the windows
          811  +versions are compiled with THREADSAFE turned on.  If you need something
          812  +different that this you will have to recompile.
          813  +</p>
          814  +
          815  +<p>
          816  +Under Unix, an <b>sqlite*</b> pointer should not be carried across a
          817  +<b>fork()</b> system call into the child process.  The child process
          818  +should open its own copy of the database after the <b>fork()</b>.
          819  +</p>
          820  +
          821  +<p>
          822  +When using LinuxThreads (where each thread has its own process ID)
          823  +it is illegal to start a transaction in one thread and then attempt
          824  +to read or write the database from a different thread.  This
          825  +restriction does not apply to Posix threads where all threads share
          826  +the same process ID.
          827  +</p>
   794    828   
   795    829   <h2>Usage Examples</h2>
   796    830   
   797    831   <p>For examples of how the SQLite C/C++ interface can be used,
   798    832   refer to the source code for the <b>sqlite</b> program in the
   799    833   file <b>src/shell.c</b> of the source tree.
   800    834   Additional information about sqlite is available at

Changes to www/faq.tcl.

     1      1   #
     2      2   # Run this script to generated a faq.html output file
     3      3   #
     4         -set rcsid {$Id: faq.tcl,v 1.11 2002/06/25 01:09:13 drh Exp $}
            4  +set rcsid {$Id: faq.tcl,v 1.12 2002/07/30 17:42:10 drh Exp $}
     5      5   
     6      6   puts {<html>
     7      7   <head>
     8      8     <title>SQLite Frequently Asked Questions</title>
     9      9   </head>
    10     10   <body bgcolor="white">
    11     11   <h1 align="center">Frequently Asked Questions</h1>
................................................................................
   227    227     or more threads.</p>
   228    228   
   229    229     <p>Note that if two or more threads have the same database open and one
   230    230     thread creates a new table or index, the other threads might
   231    231     not be able to see the new table right away.  You might have to
   232    232     get the other threads to close and reopen their connection to
   233    233     the database before they will be able to see the new table.</p>
          234  +
          235  +  <p>Under UNIX, you should not carry an open SQLite database across
          236  +  a fork() system call into the child process.  Problems will result
          237  +  if you do.  Under LinuxThreads, because each thread has its own
          238  +  process ID, you may not start a transaction in one thread and attempt
          239  +  to complete it in another.</p>
   234    240   }
   235    241   
   236    242   faq {
   237    243     How do I list all tables/indices contained in an SQLite database
   238    244   } {
   239    245     <p>If you are running the <b>sqlite</b> command-line access program
   240    246     you can type "<b>.tables</b>" to get a list of all tables.  Or you