Passes out a 2Dimensional array containing data of executed query
#include <SQLite.au3>
_SQLite_GetTableData2D ( $hDB, $sSQL, ByRef $aResult, ByRef $iRows, ByRef $aNames )
The number of values inserted into $aResult will be ($iRows) * ($iColumns).
A NULL will be returned as Numeric 0.
This function uses more memory than _SQLite_Query() / _SQLite_Fetch*()... but it's faster.
If you do not need a result (or if there will be none) consider using SQLite_Exec().
_SQLite_Display2DResult, _SQLite_Exec, _SQLite_GetTable, _SQLite_GetTable2d, _SQLite_Query
#include <MsgBoxConstants.au3> #include <SQLite.au3> #include <SQLite.dll.au3> Local $aResult,$iRows,$aNames,$iRval _SQLite_Startup () If @error Then MsgBox ($MB_SYSTEMMODAL,"SQLite Error","SQLite3.dll Can't be Loaded!") Exit - 1 EndIf ConsoleWrite ("_SQLite_LibVersion="&_SQLite_LibVersion ()&@CRLF ) _SQLite_Open (); Open a :memory: database If @error Then MsgBox ($MB_SYSTEMMODAL,"SQLite Error","Can't Load Database!") Exit - 1 EndIf ; Example Table ; Name | Age ; ----------------------- ; Alice | 43 ; Bob | 28 ; Cindy | 21 If Not _SQLite_Exec (-1,"CREATE TEMP TABLE persons (Name, Age);")= $SQLITE_OKThen _ MsgBox ($MB_SYSTEMMODAL,"SQLite Error",_SQLite_ErrMsg ()) If Not _SQLite_Exec (-1,"INSERT INTO persons VALUES ('Alice','43');")= $SQLITE_OKThen _ MsgBox ($MB_SYSTEMMODAL,"SQLite Error",_SQLite_ErrMsg ()) If Not _SQLite_Exec (-1,"INSERT INTO persons VALUES ('Bob','28');")= $SQLITE_OKThen _ MsgBox ($MB_SYSTEMMODAL,"SQLite Error",_SQLite_ErrMsg ()) If Not _SQLite_Exec (-1,"INSERT INTO persons VALUES ('Cindy','21');")= $SQLITE_OKThen _ MsgBox ($MB_SYSTEMMODAL,"SQLite Error",_SQLite_ErrMsg ()) $iRval= _SQLite_GetTableData2D (-1,"SELECT * FROM persons;",$aResult,$iRows,$aNames) If $iRval= $SQLITE_OKThen _SQLite_Display2DResult ($aResult) ; $aResult looks like this: ; Alice 43 ; Bob 28 ; Cindy 21 Else MsgBox ($MB_SYSTEMMODAL,"SQLite Error: "&$iRval,_SQLite_ErrMsg ()) EndIf _SQLite_Close () _SQLite_Shutdown ()