c.haslam Posted January 6, 2019 Share Posted January 6, 2019 When run, this example shows in the Console: >"F:\Program Files\AutoIt3\SciTE\..\AutoIt3.exe" "F:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "F:\Program Files\AutoIt3\Examples\Helpfile\_SQLite_FetchData.au3" /UserParams +>14:27:39 Starting AutoIt3Wrapper v.17.224.935.0 SciTE v.3.7.3.0 Keyboard:00000409 OS:WIN_7/Service Pack 1 CPU:X64 OS:X86 Environment(Language:0409) CodePage:0 utf8.auto.check:4 +> SciTEDir => F:\Program Files\AutoIt3\SciTE UserDir => C:\Users\Chris\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper SCITE_USERHOME => C:\Users\Chris\AppData\Local\AutoIt v3\SciTE >Running AU3Check (3.3.14.5) from:F:\Program Files\AutoIt3 input:F:\Program Files\AutoIt3\Examples\Helpfile\_SQLite_FetchData.au3 +>14:27:40 AU3Check ended.rc:0 >Running:(3.3.14.5):F:\Program Files\AutoIt3\autoit3.exe "F:\Program Files\AutoIt3\Examples\Helpfile\_SQLite_FetchData.au3" --> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop _SQLite_LibVersion=0 "F:\Program Files\AutoIt3\Examples\Helpfile\_SQLite_FetchData.au3" (14) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.: ConsoleWrite(StringFormat(" %-10s %-10s %-10s %-10s ", $aNames[0], $aNames[1], $aNames[2], $aNames[3]) & @CRLF) ConsoleWrite(StringFormat(" %-10s %-10s %-10s %-10s ", $aNames[0], ^ ERROR ->14:27:42 AutoIt3.exe ended.rc:1 +>14:27:42 AutoIt3Wrapper Finished. >Exit code: 1 Time: 5.684 Thoughts? Spoiler CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard Link to comment Share on other sites More sharing options...
TheXman Posted January 6, 2019 Share Posted January 6, 2019 (edited) The most likely reason is that it cannot find the sqlite3.dll file. I think the error comes from when the SQLite.dll.au3 udf used to download the sqlite dll file if it wasn't found. Try this slightly modified example. Make sure you have the correct path for the sqlite3.dll file. #include <Constants.au3> #include <SQLite.au3> ;~ #include <SQLite.dll.au3> Local $hQuery, $aRow, $aNames _SQLite_Startup("c:\program files\sqlite\sqlite3.dll", False, True) ;<== Change to your sqlite3 path If @error Then Exit MsgBox($MB_ICONERROR, "SQLITE ERROR", "Unable to start up SQLite") ConsoleWrite("_SQLite_LibVersion=" & _SQLite_LibVersion() & @CRLF) _SQLite_Open() ; open :memory: Database _SQLite_Exec(-1, "CREATE TABLE aTest (A,B,C);") _SQLite_Exec(-1, "INSERT INTO aTest(a,b,c) VALUES ('c','2','World');") _SQLite_Exec(-1, "INSERT INTO aTest(a,b,c) VALUES ('b','3',' ');") _SQLite_Exec(-1, "INSERT INTO aTest(a,b,c) VALUES ('a','1','Hello');") _SQLite_Query(-1, "SELECT ROWID,* FROM aTest ORDER BY a;", $hQuery) _SQLite_FetchNames($hQuery, $aNames) ConsoleWrite(StringFormat(" %-10s %-10s %-10s %-10s ", $aNames[0], $aNames[1], $aNames[2], $aNames[3]) & @CRLF) While _SQLite_FetchData($hQuery, $aRow, False, False) = $SQLITE_OK ; Read Out the next Row ConsoleWrite(StringFormat(" %-10s %-10s %-10s %-10s ", $aRow[0], $aRow[1], $aRow[2], $aRow[3]) & @CRLF) WEnd _SQLite_QueryFinalize($hQuery) _SQLite_Exec(-1, "DROP TABLE aTest;") _SQLite_Close() _SQLite_Shutdown() ; Output: ; rowid A B C ; 3 a 1 Hello ; 2 b 3 ; 1 c 2 World Edited January 6, 2019 by TheXman fixed a typo CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman Link to comment Share on other sites More sharing options...
jchd Posted January 7, 2019 Share Posted January 7, 2019 BTW, prefer higher-level functions (GetTable[2d]) instead of looping "fetch" by yourself. 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 hereRegExp tutorial: enough to get startedPCRE 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) Link to comment Share on other sites More sharing options...
c.haslam Posted January 7, 2019 Author Share Posted January 7, 2019 Thank you to both. My point (which I failed to make) is that an Example Script doesn't work out-of-the-box. Either it should work when someone clicks on "Open this script" and runs it, or what to do when it doesn't run should show in a message box. I suggest that the Help needs to be fixed, in some way. BTW I have just copied this script to a folder where I have the .dll . It works AOK there. Spoiler CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard Link to comment Share on other sites More sharing options...
jchd Posted January 7, 2019 Share Posted January 7, 2019 (edited) It was decided by Jon long time ago that the _SQLite_OpenStartup function of the standard UDF wouldn't any more check the DLL version and download the latest, since it was eating a very high percentage of the AutoIt website load. It's now the responsability of the app designer to provide the DLL. Edited January 7, 2019 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 hereRegExp tutorial: enough to get startedPCRE 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) Link to comment Share on other sites More sharing options...
TheXman Posted January 7, 2019 Share Posted January 7, 2019 7 minutes ago, jchd said: _SQLite_Open function of the standard UDF wouldn't any more check the DLL version and download the latest I think you meant _SQLite_Startup(). CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman Link to comment Share on other sites More sharing options...
jchd Posted January 7, 2019 Share Posted January 7, 2019 Oh yes, my thinko. 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 hereRegExp tutorial: enough to get startedPCRE 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) Link to comment Share on other sites More sharing options...
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