Hi,

I was always under the impression that prepared statements can only be
used from one thread at a time, so if 2 threads need to perform the
same query independently, you need to have a prepared statement for
each thread. Now I came across the following which seems to contradict
this:

"
http://www.sqlite.org/c3ref/c_config_getmalloc.html#sqliteconfigserialized

SQLITE_CONFIG_SERIALIZED
There are no arguments to this option. This option sets the threading
mode to Serialized. In other words, this option enables all mutexes
including the recursive mutexes on database connection and prepared
statement objects. In this mode (which is the default when SQLite is
compiled with SQLITE_THREADSAFE=1) the SQLite library will itself
serialize access to database connections and prepared statements so
that the application is free to use the same database connection or
the same prepared statement in different threads at the same time. If
SQLite is compiled with the SQLITE_THREADSAFE=0 compile-time option
then it is not possible to set the Serialized threading mode and
sqlite3_config() will return SQLITE_ERROR if called with the
SQLITE_CONFIG_SERIALIZED configuration option.
"

Or is this section specifically talking about a statement (whose
multiple) row results may be processed by independent threads?


Thanks,

Sander
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to