anthonyjr2 Posted August 9, 2018 Posted August 9, 2018 (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 August 9, 2018 by anthonyjr2 UHJvZmVzc2lvbmFsIENvbXB1dGVyZXI=
Moderators Melba23 Posted August 9, 2018 Moderators Posted August 9, 2018 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 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now