Jump to content
anthonyjr2

[Solved] SQLite3.exe can't be found

Recommended Posts

anthonyjr2
Posted (edited)

I've been having this issue for like 3 hours today, and no searching has given me any solution. The SQLite.au3 UDF keeps returning $SQLITE_MISUSE when I try to use _SQLite_SQLiteExe(), and I can't seem to get to the bottom of it. I found a thread relating to my issue but apparently I don't have permission to view the updated functions that Melba posted.

Here's my code:

#include <SQLite.au3>

Func importCSV($file, $dbFile)
    ; import (using SQLite3.exe)
    Local $sIn, $sOut, $i, $sCreate = "CREATE TABLE TblImport (";
    For $i = 1 To _StringCountOccurance(FileReadLine($file, 1), ",") + 1
        $sCreate &= "Column_" & $i & ","
    Next
    $sCreate = StringTrimRight($sCreate, 1) & ");"
    $sIn = $sCreate & @CRLF ; Create Table
    $sIn &= ".separator ','" & @CRLF ; Select "," as Separator
    $sIn &= ".import '" & $file & "' TblImport" & @CRLF
    _SQLite_SQLiteExe($dbFile, $sIn, $sOut, @ScriptDir & "\sqlite3.exe", True)

    If @error = 0 Then
        ;Show Table (using SQLite3.dll)
        Local $iRows, $iColumns, $aRes
        _SQLite_Startup()
        ConsoleWrite("_SQLite_LibVersion=" & _SQLite_LibVersion() & @CRLF)
        _SQLite_Open($dbFile)
        _SQLite_GetTable2d(-1, "SELECT ROWID,* FROM TblImport;", $aRes, $iRows, $iColumns)
        _SQLite_Display2DResult($aRes) ; Output to Console
        _SQLite_Close()
        _SQLite_Shutdown()
    Else
        If @error = 2 Then
            ConsoleWrite("ERROR: sqlite3.exe file not found" & @CRLF)
        Else
            ConsoleWrite("ERROR: @error=" & @error & " when calling _SQLite_SQLiteExe" & @CRLF)
        EndIf
    EndIf

EndFunc

For background info, I'm running this in x64 mode, the .exe is in the same directory as my script, I have both (x86 and x64) sqlite dlls in this same directory, and I'm not importing SQLite.dll.au3. My problem happens on the line "_SQLite_SQLiteExe($dbFile, $sIn, $sOut, @ScriptDir & "\sqlite3.exe", True)" which returns @error=2, and following the code in the UDF means it for some reason can't find my executable.

I'm probably missing something stupidly obvious, but figured I'd try posting here first instead of driving myself insane over this.

EDIT: Nevermind, seems my SQL query was incorrect. No idea why it was returning an error code of 2 if that was the case though.

Edited by anthonyjr2

UHJvZmVzc2lvbmFsIENvbXB1dGVyZXI=

Share this post


Link to post
Share on other sites
Melba23

Hi,

Just a note to say that the linked files in the above post were rapid fixes to some previous errors and have now been deleted which is why they are not visible. The various files in question have now been incorporated into AutoIt v3.3.14.5.

M23


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______Open Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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

×