SQLite Lib Crash
Posted: Thu Aug 21, 2003 8:44 pm
Hey El_Choni (or anyone else that knows), is it safe to use the SQLite userlib functions from inside a thread?
The SQlite guys tell me the windows DLL is compiled with -DTHREADSAFE by default so the library should be OK. The code below crashes big time on the first call of SQLiteExec() in the thread but is fine outside it.
For the database just a test table with three int fields will do.
Thanks!
The SQlite guys tell me the windows DLL is compiled with -DTHREADSAFE by default so the library should be OK. The code below crashes big time on the first call of SQLiteExec() in the thread but is fine outside it.
For the database just a test table with three int fields will do.
Code: Select all
Procedure test_sqlite(go.l)
Protected s_query.s
For count = 1 To 10
s_query.s = "INSERT INTO test values("+Str(Random(1000))+","+Str(Random(1000))+","+Str(Random(1000))+")"
exec_result.l = SQLiteExec(s_query)
If exec_result <> 0
Debug SQLiteError(exec_result)
EndIf
Next
EndProcedure
init_result.l = InitSQLite("sqlite.dll")
If init_result = #False
Debug "Initialize Failed "
End
EndIf
Debug "SQLite Version: " + SQLiteDllVersion()
SQLiteOpen("ix.dat")
CreateThread(@test_sqlite(),1)
End