marcello.botrugno at dedalus.eu wrote:
Hi all,
I am new of SQLite and I am developing a multithread application using
SQLite 3.7.9 on MS Windows.
I am using the precompiled version of SQLite downloaded from www.sqlite.org.
Each thread of the application, opens a private connection to the database.
Im observing that, if for example an SQL command in a transaction is
uncorrect, the rollback does not work: the previously inserted records
are not removed.
Executing from sqlite3.exe the command:
PRAGMA compile_options;
I get the following data:
ENABLE_FTS3
ENABLE_RTREE
TEMP_STORE=1
THREADSAFE=0
I deduce that the library I am using is not thread safe.
I don't know if the behavior of rollback depends on this but I should
like to use a version of SQLite copiled with THREADSAFE=1.
Do know if I need to compile the library by myself or is it possible to
get a precompiled version of SQLite (threadsafe) somewhere ?
Thanks for any help.
Are you using the precompiled DLL? If so, running sqlite3.exe is not
going to tell you anything about whether the DLL was compiled with
SQLITE_THREADSAFE > 0. You need to call sqlite3_threadsafe() to be
sure, but the precompiled DLL is threadsafe as demonstrated by compiling
and running the following code:
#include <iostream>
#include <Windows.h>
using namespace std;
int main(int argc, char* argv[])
{
HMODULE hm = LoadLibrary("sqlite3.dll");
if (hm) {
FARPROC fp = GetProcAddress(hm, "sqlite3_threadsafe");
if (fp) {
int threadsafe = fp();
cout << "sqlite3_threadsafe returns " << threadsafe;
}
else
cout << "NoProc";
}
else
cout << "Noload";
Sleep(5000);
return 0;
}
Getting to your real issue, I see no reason to think that passing bad
SQL (or other malformed commands) to the prepare function should affect
the course of a transaction. There is SQL to begin, abort, rollback, or
commit transactions. Your malformed command never reaches the execution
engine.
--
Larry Brasfield
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users