#include <SQLite.au3> ; don't include sqlite.dll.au3 !!!
Local $path = @ScriptDir & "\mydb.sql"
_SQLite_Startup ("System.Data.SQLite.dll")
ConsoleWrite(_SQLite_LibVersion() & @LF)
Local $row
; using encryption
_SQLite_Open($path)
_SQLite_Exec(-1, "pragma key = 'Radu is happy!';create table if not exists test (id integer, val text);" & _
"insert into test values (1, 'abc');")
_SQLite_QuerySingleRow(-1, "select * from test;", $row)
ConsoleWrite($row[1] & @LF)
_SQLite_Close(-1)
; not using encryption over the encrypted DB gives a failure
_SQLite_Open($path)
_SQLite_QuerySingleRow(-1, "select * from test;", $row)
ConsoleWrite(_SQLite_ErrMsg(-1) & @LF)
_SQLite_Close(-1)
; changing back to no encryption
_SQLite_Open($path)
_SQLite_Exec(-1, "pragma key = 'Radu is happy!'")
_SQLite_Exec(-1, "pragma rekey = ''")
_SQLite_QuerySingleRow(-1, "select * from test;", $row)
ConsoleWrite($row[1] & @LF)
_SQLite_Close(-1)
_SQLite_Shutdown()