
Originally Posted by
ThiagoPSanches
Now it worked!
I tested it with the SqlCipher version 3 and 4.
Here are some notes, in case anyone needs...
Code:
Dim sCn As New cConnection
Dim sRs As New cRecordset
'*** Define 'CodecType' before 'OpenDB'
sCn.CodecType = CODEC_TYPE_SQLCIPHER
'*** Inform the Path and DB File to open
'*** Do not enter the 'EncrKey' parameter here
sCn.OpenDB "C:\Users\Th\Desktop\Cipher3.db"
'*** Indicate that the file is a 'SqlCipher 3' (if the file is 'SqlCipher 4', it is also necessary to indicate here: legacy=4)
sCn.Execute "PRAGMA legacy=3;"
'*** Inform 'EncrKey' here, that way and after setting the 'legacy' parameter
sCn.Execute "PRAGMA key=123;"
Nice!
Here are some more PRAGMAs which set useful non-default settings that I'm successfully using with sqlite
Code:
Set slcn = New cConnection
slcn.OpenDB m_sDbFile
slcn.Execute "PRAGMA auto_vacuum=incremental"
slcn.Execute "PRAGMA journal_mode=WAL"
slcn.Execute "PRAGMA temp_store=MEMORY"
slcn.Execute "PRAGMA cache_spill=OFF"
slcn.Execute "PRAGMA synchronous=FULL"
slcn.BusyTimeOutSeconds = 5
The synchronous=FULL minimizes db corruption (and slowing down transaction commits) while journal_mode=WAL makes sqlite super efficient even for single reader/single writer scenario.
cheers,
</wqw>