該函數(shù)的語(yǔ)法如下:
_SQLite_GetTable2d($hDB, $sSQL, ByRef $aResult, ByRef $iRows, ByRef $iCols)
參數(shù)說(shuō)明:文章源自網(wǎng)吧系統(tǒng)維護(hù)-http://www.hvig.cn/10643.html
- $hDB:數(shù)據(jù)庫(kù)句柄,由_SQLite_Open函數(shù)返回。 - $sSQL:要執(zhí)行的SELECT語(yǔ)句。 - $aResult:用于存儲(chǔ)結(jié)果集的二維數(shù)組。 - $iRows:用于存儲(chǔ)結(jié)果集中的行數(shù)。 - $iCols:用于存儲(chǔ)結(jié)果集中的列數(shù)。
下面是一個(gè)示例代碼,演示如何使用_SQLite_GetTable2d函數(shù):文章源自網(wǎng)吧系統(tǒng)維護(hù)-http://www.hvig.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)
這個(gè)示例代碼打開(kāi)名為test.db的數(shù)據(jù)庫(kù)文件,從mytable表中讀取所有行,并將它們輸出到控制臺(tái)。如果有任何錯(cuò)誤發(fā)生,將顯示錯(cuò)誤消息。文章源自網(wǎng)吧系統(tǒng)維護(hù)-http://www.hvig.cn/10643.html
請(qǐng)注意,如果查詢結(jié)果集為空,則$aResult將是一個(gè)空數(shù)組,$iRows和$iCols將分別為0。文章源自網(wǎng)吧系統(tǒng)維護(hù)-http://www.hvig.cn/10643.html 文章源自網(wǎng)吧系統(tǒng)維護(hù)-http://www.hvig.cn/10643.html
版權(quán)聲明:文章圖片資源來(lái)源于網(wǎng)絡(luò),如有侵權(quán),請(qǐng)留言刪除!!!


評(píng)論