# Function Reference

# _SQLite_QueryReset

Reset a _SQLite_Query() based query

#include <SQLite.au3>
_SQLite_QueryReset ( $hQuery )

## Parameters

$hQuery | Query handle generated by _SQLite_Query()

## 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 API 'sqlite3_reset' 2 - Call prevented by SafeMode

## Remarks

This will reset an unfinalized query so that the resulting rowset can be forward scanned again.

## Related

_SQLite_Query, _SQLite_QueryFinalize

## Example

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

    Local $hQuery, $aRow, $iSwitch
    _SQLite_Startup()
    If @error Then
        MsgBox($MB_SYSTEMMODAL, "SQLite Error", "SQLite3.dll Can't be Loaded!")
        Exit -1
    EndIf
    _SQLite_Open()
    _SQLite_Exec(-1, "CREATE TABLE tblTest (a,b,c);")
    _SQLite_Exec(-1, "INSERT INTO tblTest VALUES ('1','1','1');" & _ ; Row 1
            "INSERT INTO tblTest VALUES ('2','2','2');" & _ ; Row 2
            "INSERT INTO tblTest VALUES ('3','3','3');") ; Row 3
    _SQLite_Query(-1, "SELECT RowID,* FROM tblTest;", $hQuery)
    While _SQLite_FetchData($hQuery, $aRow) = $SQLITE_OK
        $iSwitch = MsgBox(($MB_YESNO + $MB_SYSTEMMODAL), "Row: " & $aRow[0], $aRow[1] & "," & $aRow[2] & "," & $aRow[3] & @CRLF & _
                "Continue Looping?")
        If $iSwitch = 6 Then ; Yes
            If $aRow[0] = 3 Then _SQLite_QueryReset($hQuery)
        Else ; No
            _SQLite_QueryFinalize($hQuery)
            ExitLoop
        EndIf
    WEnd
    _SQLite_Close()
    _SQLite_Shutdown()