Function Reference


_SQLite_QuerySingleRow

Read out the first row of the result from the specified query

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

Parameters

$hDB An open database, use -1 to use last opened database
$sSQL SQL statement to be executed
$aRow Passes out the amount of 'data' rows

Return Value

Success: $SQLITE_OK.
Failure: a value that can be compared against $SQLITE_* constants.
@error: -1 - SQLite Reported an Error (Check Return value)
1 - Error Calling _SQLite_Query()
2 - Call prevented by SafeMode
3 - Error Calling _SQLite_FetchData()
4 - Error Calling _SQLite_QueryFinalize()

Related

_SQLite_Query

Example

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

Local $aRow
_SQLite_Startup()
ConsoleWrite("_SQLite_LibVersion=" & _SQLite_LibVersion() & @CRLF)
_SQLite_Open() ; open :memory: Database
_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) ; Select single row and single field !
MsgBox($MB_SYSTEMMODAL, "One of the values for key > 2:", $aRow[0])
_SQLite_Close()
_SQLite_Shutdown()