ILLBeBack Posted June 14, 2011 Posted June 14, 2011 The remarks in the help file for _SQLite_Exec states “The first row in the Callback sequence will be the column names”, and the example script indicates that in the “output”, but the column names are not output. Am I missing something or is the documentation incorrect? Just try the example script in the help file for _SQLite_Exec. AutoIt v3.3.6.1 I doubt it makes any difference, but I’ve tested with SQLite versions 3.7.6.2 & 3.7.6.3.
PsaltyDS Posted June 18, 2011 Posted June 18, 2011 Looks like a documentation error to me. To get the column names via Exec you could do this query: #include <sqlite.au3> #include <sqlite.dll.au3> #include <Array.au3> Local $hQuery, $aRow _SQLite_Startup() ConsoleWrite("_SQLite_LibVersion=" & _SQLite_LibVersion() & @CRLF) _SQLite_Open() ; Without $sCallback it's a resultless statement _SQLite_Exec(-1, "Create table tblTest (a,b int,c single not null);" & _ "Insert into tblTest values ('1',2,3);" & _ "Insert into tblTest values (Null,5,6);") Local $d = _SQLite_Exec(-1, "PRAGMA table_info(tblTest)", "_cb") ; Show table schema for each column Func _cb($aRow) _ArrayDisplay($aRow, "Column Name = " & $aRow[1]) ; [1] = name EndFunc ;==>_cb _SQLite_Close() _SQLite_Shutdown() But it would be easier to use _SQLite_GetTable2d() instead, that does return the column names in the first row. 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
ILLBeBack Posted June 18, 2011 Author Posted June 18, 2011 Looks like a documentation error to me. To get the column names via Exec you could do this query:@PsaltyDS, thanks’s for taking the time to post a script as it may help someone else, and I did test it and can verify it works.The reason I posted this issue was to verify that the documentation is in error before reporting it as a “bug” as I’ve had a very nasty reply from Dev once before when I overlooked something, even though I put in a great deal of time and research beforehand, not to mention developing a script to duplicate the issue. I’ll give it a few more days to see if Dev replies before making a bug report.
jchd Posted June 18, 2011 Posted June 18, 2011 This is a doc error. If you want the headers, just pass ".header on" & @CRLF & $sSQL for the SQL parameter. I never looked at this function as it is essentially useless. 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)
PsaltyDS Posted June 18, 2011 Posted June 18, 2011 Slick workaround, jchd. Thanks. 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
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