Jump to content

Latest SQLite.au3 and SQLite.dll.au3 versions


 Share

Go to solution Solved by Andreik,

Recommended Posts

Hello,

Please direct me to the latest SQLite.au3 and SQLite.dll.au3 versions.

I get this error when running the below script:

Can't open the database: test.db
Error code: 3
Error message: Library used incorrectly

Thank you.

taurus905

#include <SQLite.au3>
#include <SQLite.dll.au3>

; Initialize SQLite
_SQLite_Startup()
ConsoleWrite("SQLite version: " & _SQLite_LibVersion() & @CRLF)

; Open the database
Global $sDatabasePath = @ScriptDir & "\test.db"
_SQLite_Open($sDatabasePath)
If @error Then
    MsgBox($MB_ICONERROR, "Error", "Can't open the database: " & $sDatabasePath & @CRLF & "Error code: " & @error & @CRLF & "Error message: " & _SQLite_ErrMsg())
Else
    MsgBox($MB_ICONINFORMATION, "Success", "Database opened successfully.")
EndIf

; Clean up
_SQLite_Close()
_SQLite_Shutdown()

 

"Never mistake kindness for weakness."-- Author Unknown --"The highest point to which a weak but experienced mind can rise is detecting the weakness of better men."-- Georg Lichtenberg --Simple Obfuscator (Beta not needed.), Random names for Vars and Funcs

Link to comment
Share on other sites

I may have misidentified my issue.

I cannot get "Example 1" in the Help File to run.

I get this error even though the SQLite3.dll is in the same directory as the script.

I've tried the x86 version, as well as the x64.

It looks like my issue is with the naming, since some state "SQLite3.dll" and other are without the "3".

SQLite Error
---------------------------
SQLite3.dll Can't be Loaded!
Not FOUND in @ScriptDir, @WorkingDir,
    @LocalAppDataDir\AutoIt v3\SQLite,
    @SystemDir or @WindowsDir

; SQLite.dll version must match

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

Local $sSQliteDll = _SQLite_Startup()

If @error Then
        MsgBox($MB_SYSTEMMODAL, "SQLite Error", "SQLite3.dll Can't be Loaded!" & @CRLF & @CRLF & _
                        "Not FOUND in @ScriptDir, @WorkingDir," & @CRLF & @TAB & "@LocalAppDataDir\AutoIt v3\SQLite," & @CRLF & @TAB & "@SystemDir or @WindowsDir")
        Exit -1
EndIf

MsgBox($MB_SYSTEMMODAL, "SQLite3.dll Loaded", $sSQliteDll & " (" & _SQLite_LibVersion() & ")")
ConsoleWrite("_SQLite_LibVersion=" & _SQLite_LibVersion() & @CRLF)
_SQLite_Shutdown()

Any help in clearing this up for me would be greatly appreciated.

I believe I had this same problem years ago and just moved on.

One working example is all I need.

taurus905

"Never mistake kindness for weakness."-- Author Unknown --"The highest point to which a weak but experienced mind can rise is detecting the weakness of better men."-- Georg Lichtenberg --Simple Obfuscator (Beta not needed.), Random names for Vars and Funcs

Link to comment
Share on other sites

1 hour ago, taurus905 said:

One working example is all I need.

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

Local $sSQliteDll = _SQLite_Startup(@ScriptDir & "\sqlite3" & (@AutoItX64 ? "_x64" : "") & ".dll", False, 1) ; open localy
If @error Then $sSQliteDll = _SQLite_Startup() ; _SQLite_Startup ( [$sDll_Filename = "" [, $bUTF8ErrorMsg = False [, $iForceLocal = 0 [, $hPrintCallback = $__g_hPrintCallback_SQLite]]]] )
If @error Then
        MsgBox($MB_SYSTEMMODAL, "SQLite Error", "SQLite3" & (@AutoItX64 ? "_x64" : "") & ".dll Can't be Loaded!" & @CRLF & @CRLF & _
                        "Not FOUND in @ScriptDir, @WorkingDir," & @CRLF & @TAB & "@LocalAppDataDir\AutoIt v3\SQLite," & @CRLF & @TAB & "@SystemDir or @WindowsDir")
        Exit -1
EndIf

MsgBox($MB_SYSTEMMODAL, "SQLite3" & (@AutoItX64 ? "_x64" : "") & ".dll Loaded", $sSQliteDll & " (" & _SQLite_LibVersion() & ")")
ConsoleWrite("_SQLite_LibVersion=" & _SQLite_LibVersion() & @CRLF)

; Open the database
Global $sDatabasePath = @ScriptDir & "\test.db"
_SQLite_Open($sDatabasePath)
If @error Then
    MsgBox($MB_ICONERROR, "Error", "Can't open the database: " & $sDatabasePath & @CRLF & "Error code: " & @error & @CRLF & "Error message: " & _SQLite_ErrMsg())
Else
    MsgBox($MB_ICONINFORMATION, "Success", "Database opened successfully.")
EndIf

; Clean up
_SQLite_Close()
_SQLite_Shutdown()

hope this is clear enough 

Edited by argumentum
better code

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Link to comment
Share on other sites

23 hours ago, argumentum said:

hope this is clear enough 

@argumentum Thank you for trying to help me.

But I still get this same error.

I will figure it out in time.

taurus905


SQLite Error
---------------------------
SQLite3.dll Can't be Loaded!

Not FOUND in @ScriptDir, @WorkingDir,
    @LocalAppDataDir\AutoIt v3\SQLite,
    @SystemDir or @WindowsDir

"Never mistake kindness for weakness."-- Author Unknown --"The highest point to which a weak but experienced mind can rise is detecting the weakness of better men."-- Georg Lichtenberg --Simple Obfuscator (Beta not needed.), Random names for Vars and Funcs

Link to comment
Share on other sites

18 hours ago, ioa747 said:

An example that impressed me with the simplicity of using SQLite can be found in the link below
https://www.autoitscript.com/forum/topic/210140-bulldozer

@ioa747 Thank you for the example.

I will take a look.

taurus905

"Never mistake kindness for weakness."-- Author Unknown --"The highest point to which a weak but experienced mind can rise is detecting the weakness of better men."-- Georg Lichtenberg --Simple Obfuscator (Beta not needed.), Random names for Vars and Funcs

Link to comment
Share on other sites

17 hours ago, Andreik said:

Edit: check the attached archive and run the example and let me know if it works

@Andreik You're the best!

It works.

Thank you.

taurus905

"Never mistake kindness for weakness."-- Author Unknown --"The highest point to which a weak but experienced mind can rise is detecting the weakness of better men."-- Georg Lichtenberg --Simple Obfuscator (Beta not needed.), Random names for Vars and Funcs

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...