函数参考


_SQLite_QuerySingleRow

读出指定查询结果的第一行.

#include <SQLite.au3>
_SQLite_QuerySingleRow ( $hDB, $sSQL, ByRef $aRow )

参数

$hDB 打开的数据库,如为 -1, 则使用最后打开的数据库
$sSQL 要执行的语句
$aRow 传递出的数据行数

返回值

成功: 返回 $SQLITE_OK
失败: 返回值可能违反 $SQLITE_* 常量@错误:
-1 - SQLite 报告错误 (检查返回值)
1 - 错误调用 _SQLite_Query
2 - 调用被安全模式阻止
3 - 错误调用 _SQLite_FetchData
4 - 错误调用 _SQLite_QueryFinalize

注意/说明

None.

相关

_SQLite_Query

示例/演示


#include <SQLite.au3>
#include <SQLite.dll.au3>

Local $aRow
_SQLite_Startup()
ConsoleWrite("_SQLite_LibVersion=" & _SQLite_LibVersion() & @CRLF)
_SQLite_Open() ; 打开 :memory: 数据库
_SQLite_Exec(-1, "CREATE TEMP TABLE settings (key,value);")
_SQLite_Exec(-1, "INSERT INTO settings (key,value) VALUES ('1','setting one');")
_SQLite_Exec(-1, "INSERT INTO settings (key,value) VALUES ('2','setting two');")
_SQLite_Exec(-1, "INSERT INTO settings (key,value) VALUES ('3','setting Three');")
_SQLite_Exec(-1, "INSERT INTO settings (key,value) VALUES ('4','setting Four');")
_SQLite_QuerySingleRow(-1, "SELECT value FROM settings WHERE key > '2';", $aRow) ; 读取单行且单个字段
MsgBox(4096, "One of the values for key > 2:", $aRow[0])
_SQLite_Close()
_SQLite_Shutdown()