Ok, let's the C part alone for now.
Compile these:
; reader
#include <SQLite.au3>
#include <SQLite.dll.au3>
Local $aResult, $iRows, $iColumns, $iRval, $sDbName = @ScriptDir & '\test.db'
_SQLite_Startup()
If @error Then
MsgBox(16, "SQLite Error", "SQLite.dll Can't be Loaded!")
Exit -1
EndIf
ConsoleWrite("_SQLite_LibVersion=" & _SQLite_LibVersion() & @CRLF)
Local $hDskDb = _SQLite_Open($sDbName) ;this is the path ; Open a permanent disk database
If @error Then
MsgBox(16, "SQLite Error", "Can't open or create a permanent Database!")
Exit -1
EndIf
_SQLite_Exec($hDskDb, "pragma journal_mode=WAL;") ; do it once (but doing it more than once doesn't harm)
_SQLite_SetTimeout($hDskDb, 1000*60*5) ; 5 minutes timeout!
Local $aRow
For $i = 1 To 400000
$iRval = _SQLite_QuerySingleRow($hDskDb, "SELECT count(*) FROM TESTTable;", $aRow)
If $iRval <> $SQLITE_OK Then
MsgBox(16, "SQLite SELECT Error: " & $iRval, _SQLite_ErrMsg())
EndIf
Next
_SQLite_Close($hDskDb)
_SQLite_Shutdown()
; writer
#include <SQLite.au3>
#include <SQLite.dll.au3>
Local $aResult, $iRows, $iColumns, $iRval, $sDbName = @ScriptDir & '\test.db'
_SQLite_Startup()
If @error Then
MsgBox(16, "SQLite Error", "SQLite.dll Can't be Loaded!")
Exit -1
EndIf
ConsoleWrite("_SQLite_LibVersion=" & _SQLite_LibVersion() & @CRLF)
Local $hDskDb = _SQLite_Open($sDbName) ;this is the path ; Open a permanent disk database
If @error Then
MsgBox(16, "SQLite Error", "Can't open or create a permanent Database!")
Exit -1
EndIf
_SQLite_Exec($hDskDb, "pragma journal_mode=WAL;") ; do it once (but doing it more than once doesn't harm)
_SQLite_SetTimeout($hDskDb, 1000*60*5) ; 5 minutes timeout!
_SQLite_Exec($hDskDb, "create table if not exists testtable (col1 integer not null primary key, col2 text, col3 text, col4 text, col5 text);")
For $i = 1 To 4000
_SQLite_Exec($hDskDb, "insert into teSTTable (col2) values (hex(randomblob(16)));")
If $iRval <> $SQLITE_OK Then
MsgBox(16, "SQLite INSERT Error: " & $iRval, _SQLite_ErrMsg())
EndIf
Sleep(Random(10, 100, 1))
Next
_SQLite_Close($hDskDb)
_SQLite_Shutdown()
Launch a writer, and as many readers and writers you want.
You don't get any msgbox showing an error.