Jump to content
Stormgrade

SQLite encryption with System.Data.SQLite.dll

Recommended Posts

Stormgrade

Hello,

I'm using Autoit 3.3.14.0.

I want to protect a SQLite db with System.Data.SQLite.dll. I've been searching over internet about it including this forum, JCHD gave a lead to resolve this problem but I can't apply it.

This was the code from jchd :

#include <SQLite.au3>   ; don't include sqlite.dll.au3 !!!
Local $path = @ScriptDir & "\mydb.sql"
_SQLite_Startup ("System.Data.SQLite.dll")
;ConsoleWrite(_SQLite_LibVersion() & @LF)
_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');")
Local $row
_SQLite_QuerySingleRow(-1, "select * from test;", $row)
;ConsoleWrite($row[1] & @LF)
_SQLite_Close()
_SQLite_Shutdown()

It don't work and I tried to use it with my code :

#include <SQLite.au3>
#include <MsgBoxConstants.au3>

Local $aManagerResult, $iManagerRows, $iManagerColumns, $iManagerRval
Local $DBName = "\mydb.sqlite"

Local $sSQliteDll = _SQLite_Startup("System.Data.SQLite.dll")
If @error Then
    MsgBox($MB_SYSTEMMODAL, "SQLite Error", "SQLite3.dll Can't be Loaded!" & @CRLF & @CRLF & _
    "Not FOUND in @SystemDir, @WindowsDir, @ScriptDir, @WorkingDir or from www.autoitscript.com")
    Exit -1
EndIf

Local $sDbName = @ScriptDir & "\" & $DBName
If FileExists($sDbName) = 1 Then
    FileCopy($sDbName,$sDbName & ".bak")
    FileDelete($sDbName)
EndIf

Local $hDskDb = _SQLite_Open($sDbName) ; Open a permanent disk database
If @error Then
    MsgBox($MB_SYSTEMMODAL, "SQLite Error", "Can't open or create a permanent Database!")
    Exit -1
EndIf

If Not _SQLite_Exec(-1, "CREATE TABLE manager (ID Integer PRIMARY KEY AUTOINCREMENT, Name varchar(255) NOT NULL, Login char(50) NOT NULL,Code char(50) NOT NULL);") = $SQLITE_OK Then _
    MsgBox($MB_SYSTEMMODAL, "SQLite Error", _SQLite_ErrMsg())
If Not _SQLite_Exec(-1, "pragma key = 'Radu is happy!';CREATE TABLE access (ID Integer, Login char(50) NOT NULL, Code char(50) NOT NULL);"  & _
        "INSERT INTO access VALUES (1,'admin','admin');") = $SQLITE_OK Then _
    MsgBox($MB_SYSTEMMODAL, "SQLite Error", _SQLite_ErrMsg())
MsgBox($MB_SYSTEMMODAL, "SQLite","Table crée")


_SQLite_Close($hDskDb)
_SQLite_Shutdown()

Without success, I have no clue how to encrypt my SQL db without using the _Crypt_EncryptData function for my passwords.

Thank you in advance for your help.

Share this post


Link to post
Share on other sites
Stormgrade

I saw this topic :

But I'don't understand how to apply it

Share this post


Link to post
Share on other sites
jchd

There are many versions of System.Data.SQLite.dll. You must use the one compatible with your script (x86 or x64) and which is compiled as "static" and "mixed-mode" assembly. For use with AutoIt, the .Net version is irrelevant unless you intend to also use the same library with .Net features from other programs.

Also please note that you must issue the pragma key= before any use of the DB.

  • Like 2

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites
Stormgrade

There are many versions of System.Data.SQLite.dll. You must use the one compatible with your script (x86 or x64) and which is compiled as "static" and "mixed-mode" assembly. For use with AutoIt, the .Net version is irrelevant unless you intend to also use the same library with .Net features from other programs.

Also please note that you must issue the pragma key= before any use of the DB.

Have you any lead about the one I must use ?

I've downloaded this one :

Precompiled Binaries for 32-bit Windows (.NET Framework 4.0)

sqlite-netFx40-binary-Win32-2010-1.0.97.0.zip
(2.16 MiB)
 This binary package contains all the binaries for the x86 version of the System.Data.SQLite 1.0.97.0 (3.8.10.2) package. The Visual C++ 2010 SP1 runtime for x86 and the .NET Framework 4.0 are required.
(sha1: 404a5c35683d78eba1fa4de78546a8e6dd0d7f74)

Share this post


Link to post
Share on other sites
jchd

I just downloaded this version then copied the DLL in the @scriptdir from the zip file. Then this exemple works as intended:

#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()

 

Edited by jchd
pragma is rekey to change key
  • Like 4

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites
Stormgrade

I just downloaded this version then copied the DLL in the @scriptdir from the zip file. Then this exemple works as intended:

 

I'm very sorry I don't understand, I've downloaded the zip file then I decompress "System.Data.SQLite.dll" (Later I've used all files inside the zip)

I make my au3 file in the same folder as this dll and I copy paste your code but It won't work :

"......\test2.au3" (26) : ==> Subscript used on non-accessible variable.:
ConsoleWrite($row[1] & @LF)
ConsoleWrite($row^ ERROR

It won't create the  mydb.sql file, Do you use autoit 3.3.14.0 ?

Did It work for someone else maybe I'm doing it wrong somewhere?

Share this post


Link to post
Share on other sites
Stormgrade

Works for me 3.3.12.0

Not tried of 3.3.14.0

Well it work with 3.3.12.0 ...

It return this :

3.8.10.2
abc
!   SQLite.au3 Error
--> Function: _SQLite_Query
--> Query:    select * from test;
--> Error:    file is encrypted or is not a database

file is encrypted or is not a database
abc
+>16:06:25 AutoIt3.exe ended.rc:0
+>16:06:25 AutoIt3Wrapper Finished.
>Exit code: 0    Time: 1.244

The file was created.

I've got a similar problem with CryptEncrypt function when I have upgraded to 3.3.14.

Any idea for a workaround or I must keep my 3.3.12.0 version ?

Share this post


Link to post
Share on other sites
jchd

Work with both release 3.3.14.0 and beta 3.3.15.0, both x86.

Can you paste the Scite console output, showing SQLite error msg, if any?

Note that if the DB file exists encrypted before running the script it will fail. Just delete the file for the example to work.

For more information about how to use pragmas key and rekey and how to attach encrypted DBs, see this document under "Using the "key" PRAGMA" and "Using The ATTACH Command". The encryption offered by System.Data.SQLite is not SEE, so forget about the specifics in the official document (SEE is payware).

Edited by jchd

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites
Stormgrade

Work with both release 3.3.14.0 and beta 3.3.15.0, both x86.

Can you paste the Scite console output, showing SQLite error msg, if any?

Note that if the DB file exists encrypted before running the script it will fail. Just delete the file for the example to work.

For more information about how to use pragmas key and rekey and how to attach encrypted DBs, see this document under "Using the "key" PRAGMA" and "Using The ATTACH Command". The encryption offered by System.Data.SQLite is not SEE, so forget about the specifics in the official document (SEE is payware).

Well we'll see that tomorrow because it work well in my home but not at my office, something is wrong on my office computeur.

The output for 3.3.14.0 was :

0
"......\test2.au3" (26) : ==> Subscript used on non-accessible variable.:
ConsoleWrite($row[1] & @LF)
ConsoleWrite($row^ ERROR

I'll reinstall autoit.

Share this post


Link to post
Share on other sites
jchd

Well we'll see that tomorrow because it work well in my home but not at my office, something is wrong on my office computeur.

The output for 3.3.14.0 was :

0
"......\test2.au3" (26) : ==> Subscript used on non-accessible variable.:
ConsoleWrite($row[1] & @LF)
ConsoleWrite($row^ ERROR

I'll reinstall autoit.

The first line carrying '0' means the DLL wasn't found. Noo need to reinstal, just sort out why the DLL is not there.


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites
Stormgrade

I've uninstalled autoit and I do a clean install.

It work now.

Thank you for your help.

Share this post


Link to post
Share on other sites
jchd

Glad to see it works for you too. There must have been something gone mad with the previous AutoIt environment/setup causing havoc.

Reading the document mentionned above, you'll see that you can use pragma hexkey = 'A40F38D5CC20E6' to use a hex password and pragma hexrekey to change it to some other hex value. If you look at a non-encrypted DB you'll see the string "SQLite format 3" at the start of file and the DB DML in plain text following the header, but once the DB is encrypted, nothing is human- readable, not even a little hint that this file is an SQLite DB.

@guinness,

Yes, the static mixed-mode assembly carries the standard C DLL interface plus the .net one (hence the mixed-mode term). This worked from day one of this library and still does now that Joe Mistachkin has taken the over .Net development as part of the official SQLite dev team. It's now unlikely that encryption support will be dropped for there are way too many users relying on it.

Edited by jchd
  • Like 1

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites
guinness

I had no clue System.Data.SQLite.dll would work. Learnt something new.


UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites
Stormgrade

Glad to see it works for you too. There must have been something gone mad with the previous AutoIt environment/setup causing havoc.

Reading the document mentionned above, you'll see that you can use pragma hexkey = 'A40F38D5CC20E6' to use a hex password and pragma hexrekey to change it to some other hex value. If you look at a non-encrypted DB you'll see the string "SQLite format 3" at the start of file and the DB DML in plain text following the header, but once the DB is encrypted, nothing is human- readable, not even a little hint that this file is an SQLite DB.

@guinness,

Yes, the static mixed-mode assembly carries the standard C DLL interface plus the .net one (hence the mixed-mode term). This worked from day one of this library and still does now that Joe Mistachkin has taken the over .Net development as part of the official SQLite dev team. It's now unlikely that encryption support will be dropped for there are way too many users relying on it.

Thank you for the pragma hexkey tip, I'm trying to make an Internet Password keeper like Firefox Secure login, thanks for your help !!

Share this post


Link to post
Share on other sites
jchd
On 29/07/2015 at 3:28 PM, JohnOne said:

Are we talking about encryption of data here

@JohnOne,

This is plain whole DB file encryption. SQlite works with I/O blocks it calls pages inside a DB file. This encryption layer encrypts/decrypts pages on the fly when SQLite needs to write/read (resp.) pages from the file.

On 29/07/2015 at 6:26 PM, JohnOne said:

What type and level of encryption is it?

I don't know precisely, it would take reading the source code for that, but it must be a decent level like SHA2 ou something. Don't fear breaking by sister kid.

On 29/07/2015 at 3:28 PM, JohnOne said:

or just the data base having a password?

There is an SQLite add-on available in source form which allows SQLite to perform user anthentication (a completely distinct feature from encryption).

The module can be found in the source distribution, under ext\userauth and I can say it works pretty well. The caveat is that it uses the same file format as non authentication-enabled DBs, which means that if you can gain access to the DB, you can use any standard tool to read/write it without being authenticated. The feature is meant to restrict user access rights on a per-user basis, where the file is priviledge-protected inside a server or non-user area. Read user-auth.txt for details.

  • Like 1

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Similar Content

    • dangr82
      By dangr82
       
      I have created this function for a database, but I can not make it work. I always have two error messages: "not an error" ... and the file created, in the script directory, does not contain anything.
      Global $sDBName = "Hen.db" Func DatabaseTable() Local $sConnDB _SQLite_Startup() If @error Then MsgBox($MB_SYSTEMMODAL, "SQLite Error", "SQLite.dll Can't be Loaded!") Exit -1 EndIf $sConnDB = _SQLite_Open($sDBName) If @error Then MsgBox($MB_SYSTEMMODAL, "SQLite Error", "Can't Load Database!") Exit -1 EndIf If Not _SQLite_Exec($sDBName, 'CREATE TABLE Animal ("Name", "Age");') = $SQLITE_OK Then MsgBox($MB_SYSTEMMODAL, "SQLite Error", _SQLite_ErrMsg()) If Not _SQLite_Exec($sDBName, 'INSERT INTO Animale VALUES ("Charlie","5");') = $SQLITE_OK Then MsgBox($MB_SYSTEMMODAL, "SQLite Error", _SQLite_ErrMsg()) _SQLite_Close($sConnDB) _SQLite_Shutdown() EndFunc  
    • Eminence
      By Eminence
      Hello,
      I've been searching on how to select the first row in my database which includes a time column based on the latest start_time date for today's date.
      This is my current code:
      Local $iCurrentDate = _Now() Local $sqlHandle = _dbOpen($sDbPath) Local $aResult, $iRows, $iCols _SQLite_GetTable2d($sqlHandle, "SELECT start_time FROM " & $srawDb & " ORDER BY datetime(start_time) DESC LIMIT 1", $aResult, $iRows, $iCols) _ArrayDisplay($aResult) _dbClose($sDbpath) What it does is it gets the first row entry in the database however it does not select the latest start_time entry in the database, it always select the first row. I've tried changing DESC to ASC to see if that will do it but the issue still remains. Any thoughts on this? Thanks in advance.
       
      *EDIT
      The date format in the database is by MM/DD/YYYY HH:MM:SS.
    • Seminko
      By Seminko
      In my recent project I'm downloading a bunch of data, so I decided to store it in a SQLite database. NOTE: I'm using sqlite3_x64.dll
      Everything is working just fine but I'm struggling with getting the Median value. SQLite has an Average function but not a Median one.
      I googled but all of the provided solutions are way above my pay-grade. After some more searching I found 'extension-functions.c' on the SQLite site where Median is included. After almost an hour of struggling I was able to successfully compile it into a DLL.
      So I downloaded @jchd's SQLiteExtLoad.au3 as seen here:
      But I'm getting these errors:
      "Path\SQLiteExtLoad.au3"(21,40) : warning: $g_hDll_SQLite: possibly used before declaration. Local $RetVal = DllCall($g_hDll_SQLite, ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ "Path\SQLiteExtLoad.au3"(21,40) : error: $g_hDll_SQLite: undeclared global variable. Local $RetVal = DllCall($g_hDll_SQLite, ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ So I tried, copying the function to my file and changing the DLL variable ($g_hDll_SQLite) directly to the DLL location (C:\...\.. .dll), but now this error fires
      If __SQLite_hChk($hConn, 1) Then Return SetError(@error, 0, $SQLITE_MISUSE) To be honest, I don't know what to use as the $hConn - handle of connection.
      I would appreciate any help, be it getting the median using SQLite queries or getting the DLL extension loaded using AutoIt.
      Thanks, S.
       
      EDIT: well, I suspect the $hConn variable refers to the return value of the _SQLite_Open function. Well, at least now _SQLite_EnableExtensions doesn't give errors. Now I run into problems with _SQLite_LoadExtension, which gives error -1, and extended 1. Apparently the 1 constant is a generic error where other error do not apply.
      BTW, anybody knows whether I need to compile the extension DLL "into" x64 when I use a x64 SQLite? That might be the problem...
       
      EDIT2: I recompiled the dll and tried it using the SQLite3.exe and it works, so I'm confident the extension DLL has been created correctly

    • AdamUL
      By AdamUL
      I have been testing AutoIt 3.3.14.3 with SQLite, and the Help File examples.  The examples that I have tested are throwing errors or not doing anything.  I have sqlite3.dll, sqlite3_x64.dll, and sqlite3.exe in the directories with the testing script.  I am copying the examples directly from the help file into a test script for testing with no edits.  The _SQLite_GetTable2d example is returning an error ("Library used incorrectly") with each _SQLite_Exec command.  The _SQLite_FastEncode example returns an empty dialog box.  The _SQLite_Exec example only prints out the SQLite version, and nothing else in the SciTE console.  Currently, I'm still searching for what is causing this issue.  I'm on Windows 7 Enterprise 64-bit.  Is anyone else having this issue?  
       
      Adam
       
    • Burgs
      By Burgs
      Greetings,
        I have SQLite setup within my AutoIT program...I'm trying to accomplish what should be a relatively simple task.  I want to be able to return an array of 'table' names for an established database...I believe this might be possible using the '_SQLite_SQLiteExe' command...since it seems to be able to access SQLite schemas...?  The ".tables" command is one of them...if I am not mistaken that command returns a list of all table names in the active database.
        I am attempting the following:
      #include <SQLite.au3> #include <SQLite.dll.au3> Global $hDb, $sIn, $sOut ... $sIn = ".tables" & @CRLF _SQLite_SQLiteExe($hDb, $sIn, $sOut) if @error == 0 Then ;Show Table (using SQLite3.dll) Else if @error == 2 Then ConsoleWrite("ERROR: Sqlite3.exe file not found" & @CRLF) Else ConsoleWrite("ERROR: @error=" & @error & " when calling _SQLite_SQLiteExe" & @CRLF) EndIf ;@error is "2"...OR NOT... EndIf ;@error is "0"...OR NOT... ...   The error being thrown is "ERROR: Sqlite3.exe file not found" ...
        Am I required to have the Sqlite3.exe installed in my directory (i.e. @ScriptsDir)...???  I do not have it in there at present because I did not believe it was necessary with the 'include' calls to "SQLite.au3" and "SQLite.dll.au3"...any advice appreciated.  Thanks in advance. 
      Regards
       
       
       
       
       
       
       
×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.