# Function Reference

# _SQLite_Close

Close an open database

#include <SQLite.au3>
_SQLite_Close ( [$hDB = -1] )

## Parameters

$hDB | [optional] Database handle.

## Return Value

Success: | $SQLITE_OK.
Failure: | a value can be compared against $SQLITE_* constants.
@error: | -1 - SQLite reported an error (Check Return value) 1 - Error calling SQLite API 'sqlite3_close' 2 - Call prevented by SafeMode

## Remarks

It waits for SQLite <> $SQLITE_BUSY until 'global Timeout' has elapsed.
If no database handle is given, the last opened database will be closed.
Prior to calling _SQLite_Close(), the application must invoke _SQLite_QueryFinalize() for each query explicitely left unfinalized.

## Related

_SQLite_Open

## Example

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

    _SQLite_Startup()
    If @error Then
        MsgBox($MB_SYSTEMMODAL, "SQLite Error", "SQLite3.dll Can't be Loaded!")
        Exit -1
    EndIf
    ConsoleWrite("_SQLite_LibVersion=" & _SQLite_LibVersion() & @CRLF)
    _SQLite_Open() ; Open a :memory: database
    If @error Then
        MsgBox($MB_SYSTEMMODAL, "SQLite Error", "Can't Load Database!")
        Exit -1
    EndIf
    _SQLite_Close()
    _SQLite_Shutdown()