Sign in to follow this  
Followers 0
james3mg

SQLite3.dll included with AutoIt

5 posts in this topic

I was taking a look at the change log at sqlite.org and noticed that the version of SQLite3.dll that's included with AutoIt is more than a year old, and missing some bug fixes and (especially) performance enhancements that would be nice. The fixes a few versions ahead of this one include one that prevents the database from being corrupted when multiple threads are accessing the database, which is something I'm doing.

I was just wondering if there are any plans to update the bundled SQLite.dll.au3 file to reflect these changes? I'd be happy to submit the complete updated file to whomever would be responsible for this, if you desired help.

Thanks for letting me know the status on this :P


"There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I was taking a look at the change log at sqlite.org and noticed that the version of SQLite3.dll that's included with AutoIt is more than a year old, and missing some bug fixes and (especially) performance enhancements that would be nice. The fixes a few versions ahead of this one include one that prevents the database from being corrupted when multiple threads are accessing the database, which is something I'm doing.

I was just wondering if there are any plans to update the bundled SQLite.dll.au3 file to reflect these changes? I'd be happy to submit the complete updated file to whomever would be responsible for this, if you desired help.

Thanks for letting me know the status on this :(

I'm working up the binary DLL of version 3.6.3 into an SQLite.dll.au3 file, but you don't have to wait for that.

When you run _SQLite_Startup() you can pass an optional parameter specifying a different (newer) sqlite3.dll file. I haven't tested that the current sqlite3.dll, version 3.6.3, is completely compatible with the SQLite.au3 UDF, but I note that it calls _ArrayCreate() which is a deprecated function and should be edited out of it.

:P

Edit: Version 3.6.3 of SQLite3.DLL, converted to an .au3 include file by the following script:

CODE
; Input file

Global $sInputDllDir = "C:\Downloads\AutoIt\SQLiteDll-3_6_3"

Global $sInputDllFile = "sqlite3.dll"

Global $sInputDll = $sInputDllDir & "\" & $sInputDllFile

ConsoleWrite("Input DLL binary is: " & $sInputDll & @LF)

Global $hInputDll = FileOpen($sInputDll, 16)

If $hInputDll = -1 Then

MsgBox(16, "Error!", "Failed to open input DLL binary!")

Exit

Else

ConsoleWrite("Successfully opened input DLL binary." & @LF)

EndIf

Global $binInputDll = FileRead($hInputDll)

FileClose($hInputDll)

Global $iInputLen = BinaryLen($binInputDll)

ConsoleWrite("Input binary length is " & $iInputLen & " bytes." & @LF)

; Output file

Global $sOutputDllDir = "C:\Downloads\AutoIt\SQLiteDll-3_6_3"

Global $sOutputDllFile = "sqlite3.dll.au3"

Global $sOutputDll = $sOutputDllDir & "\" & $sOutputDllFile

ConsoleWrite("Output .au3 file is: " & $sOutputDll & @LF)

Global $hOutputDll = FileOpen($sOutputDll, 2)

If $hOutputDll = -1 Then

MsgBox(16, "Error!", "Failed to open output .au3 file!")

Exit

Else

ConsoleWrite("Successfully opened output .au3 file." & @LF)

EndIf

Global $sDateTime = @YEAR & "/" & @MON & "/" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC

Global $sDateTimePlain = StringRegExpReplace($sDateTime, "[^[:digit:]]", "")

; Write first lines

FileWriteLine($hOutputDll, "#include-once" & @CRLF & _

@CRLF & _

";Inline SQLite3.dll, Creation Time: " & $sDateTime & @CRLF & _

@CRLF & _

"Func __SQLite_Inline_Modified()" & @CRLF & _

@TAB & "Return '" & $sDateTimePlain & "' ; " & $sDateTime & @CRLF & _

"EndFunc" & @CRLF & _

@CRLF & _

"Func __SQLite_Inline_Version()" & @CRLF & _

@TAB & "Return '3006003'" & @CRLF & _

"EndFunc" & @CRLF & _

@CRLF & _

"Func __SQLite_Inline_SQLite3Dll() ; Dont Tidy me!" & @CRLF & _

@TAB & 'Local $sData')

; Write data blocks

For $n = 1 To $iInputLen Step 2000

ConsoleWrite("Working on byte " & $n & " of " & $iInputLen & " bytes..." & @LF)

FileWrite($hOutputDll, @TAB & "$sData &= '")

For $i = 0 To 1999

If $n + $i <= $iInputLen Then

FileWrite($hOutputDll, Hex(BinaryMid($binInputDll, $n + $i, 1), 2))

Else

ExitLoop

EndIf

Next

FileWrite($hOutputDll, "'" & @CRLF)

Next

; Write closing lines

FileWriteLine($hOutputDll, @TAB & "Return Binary('0x' & $sData)" & @CRLF & _

"EndFunc")

; Close output file

FileClose($hOutputDll)

The resulting version of SQLite.dll.au3 was then converted back into a binary DLL file as SQLite3.dll.bin, simulating the operation of _SQLite_Startup(), with this script:
#include 'C:\Downloads\AutoIt\SQLiteDll-3_6_3\sqlite3.dll.au3'

$binDLL = __SQLite_Inline_SQLite3Dll()
ConsoleWrite("Binary DLL is " & BinaryLen($binDLL) & " bytes long." & @LF)
$hOut = FileOpen('C:\Downloads\AutoIt\SQLiteDll-3_6_3\sqlite3.dll.bin', 16+2)
If $hOut = -1 Then
    MsgBox(16, "Error!", "Failed to open output file!")
    Exit
Else
    ConsoleWrite("Successfully opened output file." & @LF)
EndIf
FileWrite($hOut, $binDLL)
FileClose($hOut)

I compared the original sqlite3.dll downloaded from SQLite.org to the binary created by the UDF process above using the following commandline:

FC /B .\sqlite3.dll .\SQLite3.Dll.au3

There were no differences between the files.

:idea:

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I'm working up the binary DLL of version 3.6.3 into an SQLite.dll.au3 file, but you don't have to wait for that.

When you run _SQLite_Startup() you can pass an optional parameter specifying a different (newer) sqlite3.dll file.

...

No need for that either, for me. I've got a script that creates the SQLite.dll.au3 file straight from the dll...I ran this and just replaced the old SQLite.dll.au3 file in my includes folder with the resulting file. I think the only changes were some of the functions were named __SQLite* and the script named them __SQLite3* because of the name of the dll file. Also, the version number had to be changed in the au3 file from 3.6.3 to 3006003 (for whatever reason, that's how this #include file expects it to be).

I was just wondering if the "official" included version was going to be updated so I didn't have to do this when I upgraded my AutoIt :P

P.S. I tried to post my version of the SQLite.dll.au3 file below, but apparently it was too big :( Let me know if you want me to send it to you.

Edited by james3mg

"There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110

Share this post


Link to post
Share on other sites

Don't stop now, they released 3.6.4 today.

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
Sign in to follow this  
Followers 0