該函數(shù)的語法如下:
_SQLite_GetTable2d($hDB, $sSQL, ByRef $aResult, ByRef $iRows, ByRef $iCols)
參數(shù)說明:文章源自網(wǎng)吧系統(tǒng)維護-http://www.strong-digital.cn/10643.html
- $hDB:數(shù)據(jù)庫句柄,由_SQLite_Open函數(shù)返回。 - $sSQL:要執(zhí)行的SELECT語句。 - $aResult:用于存儲結果集的二維數(shù)組。 - $iRows:用于存儲結果集中的行數(shù)。 - $iCols:用于存儲結果集中的列數(shù)。
下面是一個示例代碼,演示如何使用_SQLite_GetTable2d函數(shù):文章源自網(wǎng)吧系統(tǒng)維護-http://www.strong-digital.cn/10643.html
#include <SQLite.au3> Local $sDBFile = "test.db" Local $hDB = _SQLite_Open($sDBFile) If Not $hDB Then MsgBox(16, "Error", "Failed to open database file.") Exit EndIf Local $aResult, $iRows, $iCols Local $sSQL = "SELECT * FROM mytable" _SQLite_GetTable2d($hDB, $sSQL, $aResult, $iRows, $iCols) If @error Then MsgBox(16, "Error", "Failed to execute SQL statement.") Exit EndIf For $i = 0 To $iRows - 1 For $j = 0 To $iCols - 1 ConsoleWrite($aResult[$i][$j] & @TAB) Next ConsoleWrite(@CRLF) Next _SQLite_Close($hDB)
這個示例代碼打開名為test.db的數(shù)據(jù)庫文件,從mytable表中讀取所有行,并將它們輸出到控制臺。如果有任何錯誤發(fā)生,將顯示錯誤消息。文章源自網(wǎng)吧系統(tǒng)維護-http://www.strong-digital.cn/10643.html
請注意,如果查詢結果集為空,則$aResult將是一個空數(shù)組,$iRows和$iCols將分別為0。文章源自網(wǎng)吧系統(tǒng)維護-http://www.strong-digital.cn/10643.html 文章源自網(wǎng)吧系統(tǒng)維護-http://www.strong-digital.cn/10643.html
版權聲明:文章圖片資源來源于網(wǎng)絡,如有侵權,請留言刪除!!!
評論