Index: www/c_interface.tcl ================================================================== --- www/c_interface.tcl +++ www/c_interface.tcl @@ -1,9 +1,9 @@ # # Run this Tcl script to generate the sqlite.html file. # -set rcsid {$Id: c_interface.tcl,v 1.31 2002/07/13 17:18:37 drh Exp $} +set rcsid {$Id: c_interface.tcl,v 1.32 2002/07/30 17:42:10 drh Exp $} puts {
This error might occur if one or more of the SQLite API routines is used incorrectly. Examples of incorrect usage include calling sqlite_exec() after the database has been closed using sqlite_close() or calling sqlite_exec() with the same database pointer simultaneously from two separate threads. +This error code will also be returned under Unix if sqlite_exec() +is called while a transaction is pending that was started in another +process or thread that has a different process ID.
+If SQLite is compiled with the THREADSAFE preprocessor macro set to 1, +then it is safe to use SQLite from two or more threads of the same process +at the same time. But each thread should have its own sqlite* +pointer returned from sqlite_open(). It is never safe for two +or more threads to access the same sqlite* pointer at the same time. +
+ ++In precompiled SQLite libraries available on the website, the Unix +versions are compiled with THREADSAFE turned off but the windows +versions are compiled with THREADSAFE turned on. If you need something +different that this you will have to recompile. +
+ ++Under Unix, an sqlite* pointer should not be carried across a +fork() system call into the child process. The child process +should open its own copy of the database after the fork(). +
+ ++When using LinuxThreads (where each thread has its own process ID) +it is illegal to start a transaction in one thread and then attempt +to read or write the database from a different thread. This +restriction does not apply to Posix threads where all threads share +the same process ID. +
For examples of how the SQLite C/C++ interface can be used, refer to the source code for the sqlite program in the Index: www/faq.tcl ================================================================== --- www/faq.tcl +++ www/faq.tcl @@ -1,9 +1,9 @@ # # Run this script to generated a faq.html output file # -set rcsid {$Id: faq.tcl,v 1.11 2002/06/25 01:09:13 drh Exp $} +set rcsid {$Id: faq.tcl,v 1.12 2002/07/30 17:42:10 drh Exp $} puts {
Note that if two or more threads have the same database open and one thread creates a new table or index, the other threads might not be able to see the new table right away. You might have to get the other threads to close and reopen their connection to the database before they will be able to see the new table.
+ +Under UNIX, you should not carry an open SQLite database across + a fork() system call into the child process. Problems will result + if you do. Under LinuxThreads, because each thread has its own + process ID, you may not start a transaction in one thread and attempt + to complete it in another.
} faq { How do I list all tables/indices contained in an SQLite database } {