Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Change the documentation to explain that a database handle can only be used in the same thread in which it was created. Ticket #1272. (CVS 2521) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
59c95731f70ed9b9e135584f62d0a2b0 |
User & Date: | drh 2005-06-16 19:48:39.000 |
Context
2005-06-22
| ||
02:36 | Fix a bug in an assert found while investigating ticket #1287 but otherwise unrelated to that problem. (CVS 2522) (check-in: 60f752ed18 user: drh tags: trunk) | |
2005-06-16
| ||
19:48 | Change the documentation to explain that a database handle can only be used in the same thread in which it was created. Ticket #1272. (CVS 2521) (check-in: 59c95731f7 user: drh tags: trunk) | |
18:47 | Fix the THREADSAFE macro in Makefile.in. We really need to rework the whole autoconf build system.... (CVS 2520) (check-in: 98a4de76e0 user: drh tags: trunk) | |
Changes
Changes to www/capi3ref.tcl.
|
| | | 1 2 3 4 5 6 7 8 | set rcsid {$Id: capi3ref.tcl,v 1.23 2005/06/16 19:48:39 drh Exp $} source common.tcl header {C/C++ Interface For SQLite Version 3} puts { <h2>C/C++ Interface For SQLite Version 3</h2> } proc api {name prototype desc {notused x}} { |
︙ | ︙ | |||
842 843 844 845 846 847 848 849 850 851 852 853 854 855 | as needed. The encoding for the database will be UTF-8 if sqlite3_open() is called and UTF-16 if sqlite3_open16 is used. Whether or not an error occurs when it is opened, resources associated with the sqlite3* handle should be released by passing it to sqlite3_close() when it is no longer required. } api {} { int sqlite3_prepare( sqlite3 *db, /* Database handle */ const char *zSql, /* SQL statement, UTF-8 encoded */ int nBytes, /* Length of zSql in bytes. */ | > > > > > > | 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 | as needed. The encoding for the database will be UTF-8 if sqlite3_open() is called and UTF-16 if sqlite3_open16 is used. Whether or not an error occurs when it is opened, resources associated with the sqlite3* handle should be released by passing it to sqlite3_close() when it is no longer required. The returned sqlite3* can only be used in the same thread in which it was created. It is an error to call sqlite3_open() in one thread then pass the resulting database handle off to another thread to use. This restriction is due to goofy design decisions (bugs?) in the way some threading implementations interact with file locks. } api {} { int sqlite3_prepare( sqlite3 *db, /* Database handle */ const char *zSql, /* SQL statement, UTF-8 encoded */ int nBytes, /* Length of zSql in bytes. */ |
︙ | ︙ | |||
1044 1045 1046 1047 1048 1049 1050 | SQLITE_ERROR means that a run-time error (such as a constraint violation) has occurred. sqlite3_step() should not be called again on the VM. More information may be found by calling sqlite3_errmsg(). SQLITE_MISUSE means that the this routine was called inappropriately. Perhaps it was called on a virtual machine that had already been finalized or on one that had previously returned SQLITE_ERROR or | | | | 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 | SQLITE_ERROR means that a run-time error (such as a constraint violation) has occurred. sqlite3_step() should not be called again on the VM. More information may be found by calling sqlite3_errmsg(). SQLITE_MISUSE means that the this routine was called inappropriately. Perhaps it was called on a virtual machine that had already been finalized or on one that had previously returned SQLITE_ERROR or SQLITE_DONE. Or it could be the case that a database connection is being used by a different thread than the one it was created it. } api {} { void *sqlite3_trace(sqlite3*, void(*xTrace)(void*,const char*), void*); } { Register a function that is called each time an SQL statement is evaluated. The callback function is invoked on the first call to sqlite3_step() after |
︙ | ︙ |
Changes to www/faq.tcl.
1 2 3 | # # Run this script to generated a faq.html output file # | | | 1 2 3 4 5 6 7 8 9 10 11 | # # Run this script to generated a faq.html output file # set rcsid {$Id: faq.tcl,v 1.29 2005/06/16 19:48:40 drh Exp $} source common.tcl header {SQLite Frequently Asked Questions</title>} set cnt 1 proc faq {question answer} { set ::faq($::cnt) [list [string trim $question] [string trim $answer]] incr ::cnt |
︙ | ︙ | |||
48 49 50 51 52 53 54 | unique keys will be sequential until the largest key reaches a value of 2147483647. That is the largest 32-bit signed integer and cannot be incremented, so subsequent insert attempts will revert to the semi-random key generation algorithm of SQLite version 2.3.3 and earlier.</p> <p>Beginning with version 2.2.3, there is a new API function named | | | 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | unique keys will be sequential until the largest key reaches a value of 2147483647. That is the largest 32-bit signed integer and cannot be incremented, so subsequent insert attempts will revert to the semi-random key generation algorithm of SQLite version 2.3.3 and earlier.</p> <p>Beginning with version 2.2.3, there is a new API function named <b>sqlite3_last_insert_rowid()</b> which will return the integer key for the most recent insert operation. See the API documentation for details.</p> <p>SQLite version 3.0 expands the size of the rowid to 64 bits.</p> } faq { |
︙ | ︙ | |||
213 214 215 216 217 218 219 | generally have finer grained locking, such as locking on a single table or a single row within a table. If you have a massively parallel database application, you should consider using a big database server instead of SQLite.</p> <p>When SQLite tries to access a file that is locked by another process, the default behavior is to return SQLITE_BUSY. You can | | | | | | > > > > > > | | 213 214 215 216 217 218 219 220 221 222 223 224 225 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 | generally have finer grained locking, such as locking on a single table or a single row within a table. If you have a massively parallel database application, you should consider using a big database server instead of SQLite.</p> <p>When SQLite tries to access a file that is locked by another process, the default behavior is to return SQLITE_BUSY. You can adjust this behavior from C code using the <b>sqlite3_busy_handler()</b> or <b>sqlite3_busy_timeout()</b> API functions. See the API documentation for details.</p> <p>If two or more processes have the same database open and one process creates a new table or index, the other processes might not be able to see the new table right away. You might have to get the other processes to close and reopen their connection to the database before they will be able to see the new table.</p> } faq { Is SQLite threadsafe? } { <p>Yes. Sometimes. In order to be thread-safe, SQLite must be compiled with the THREADSAFE preprocessor macro set to 1. In the default distribution, the windows binaries are compiled to be threadsafe but the linux binaries are not. If you want to change this, you'll have to recompile.</p> <p>"Threadsafe" in the previous paragraph means that two or more threads can run SQLite at the same time on different "<b>sqlite3</b>" structures returned from separate calls to <b>sqlite3_open()</b>. It is never safe to use the same <b>sqlite3</b> structure pointer simultaneously in two or more threads.</p> <p>An <b>sqlite3</b> structure can only be used in the same thread that called <b>sqlite3_open</b> to create it. You cannot open a database in one thread then pass the handle off to another thread for it to use. This is due to limitations (bugs?) in many common threading implementations such as on RedHat9.</p> <p>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.</p> <p>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.</p> } faq { How do I list all tables/indices contained in an SQLite database } { <p>If you are running the <b>sqlite3</b> command-line access program you can type "<b>.tables</b>" to get a list of all tables. Or you can type "<b>.schema</b>" to see the complete database schema including all tables and indices. Either of these commands can be followed by a LIKE pattern that will restrict the tables that are displayed.</p> <p>From within a C/C++ program (or a script using Tcl/Ruby/Perl/Python bindings) you can get access to table and index names by doing a SELECT |
︙ | ︙ | |||
323 324 325 326 327 328 329 | <p>SQLite version 2.8 limits the amount of data in one row to 1 megabyte. SQLite version 3.0 has no limit on the amount of data that can be stored in a single row. </p> <p>The names of tables, indices, view, triggers, and columns can be as long as desired. However, the names of SQL functions (as created | | | 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 | <p>SQLite version 2.8 limits the amount of data in one row to 1 megabyte. SQLite version 3.0 has no limit on the amount of data that can be stored in a single row. </p> <p>The names of tables, indices, view, triggers, and columns can be as long as desired. However, the names of SQL functions (as created by the <a href="c_interface.html#cfunc">sqlite3_create_function()</a> API) may not exceed 255 characters in length.</p> } faq { What is the maximum size of a VARCHAR in SQLite? } { <p>SQLite does not enforce datatype constraints. |
︙ | ︙ |