Function Reference


_SQLite_Startup

Loads SQLite3.dll

#include <SQLite.au3>
_SQLite_Startup ( [$sDll_Filename = "" [, $bUTF8ErrorMsg = False [, $iForceLocal = 0 [, $hPrintCallback = $__g_hPrintCallback_SQLite [, $bAutoItTypeConversion = False]]]]] )

Parameters

$sDll_Filename [optional] DLL filename. Default is "sqlite3.dll" or "sqlite3_x64.dll" in X64 mode.
$bUTF8ErrorMsg [optional] to force ConsoleWrite() to display UTF8 chars
$iForceLocal [optional] 1 = use the defined DLL file. No version checking. Automatic "_x64.dll" in X64 mode.
0 = (default) the DLL will be search in @ScriptDir, @WorkingDir, @LocalAppDataDir & "\AutoIt v3\SQLite\", @SystemDir and @WindowsDir.
$hPrintCallback [optional] A variable assigned to the user defined function to display a SQLite diagnostic message. Default = __SQLite_ConsoleWrite(). See remarks.
$bAutoItTypeConversion [optional] Force conversion from String to AutoItType variable ((Default = False). See remark.

Return Value

Success: the path to the opened DLL file.
Failure: sets the @error flag to non-zero.

Remarks

If #include <SQLite.dll.au3> is included the SQLite version is checked.
The SQLite files can be downloaded from https://www.autoitscript.com/autoit3/pkgmgr/sqlite/sqlite3_setup_version.exe that can be stored in @ScriptDir, @WorkingDir, @LocalAppDataDir & "\AutoIt v3\SQLite\" (default), @SystemDir or @WindowsDir.
For use by any user store the SQLite files in @SystemDir or @WindowsDir.
To help the downloading of the correct version you can use the script "Extras\AutoUpdateIt\AutoIt3SQLiteUpdate.au3" (similar to AutoUpdateIt.au3 use to check AutoIt release or beta).

If $bUTF8ErrorMsg is not zero prints UTF8 formated string prints to console.
This allows applications as SciTE to display those characters if configured with output.code.page=65001.
This is the case when running SciTE under a non-english version.

The $hPrintCallback parameter specifies the name of user-defined callback function. This function will be passed a single parameter which is the message to display. The default callback is $__g_hPrintCallback_SQLite. See that function for an example of how to implement your own callback function.

$bAutoItTypeConversion is usefull if the whole script want to return by the _SQlite_FetchData() AutoIt type variables.
Default is to return String or Binary AutoIt Variable.

Related

_SQLite_Shutdown, _SQlite_FetchData

Example

Example 1

; SQLite.dll version must match
#include <MsgBoxConstants.au3>
#include <SQLite.au3>
#include <SQLite.dll.au3>
Local $sSQliteDll= _SQLite_Startup ()
If @error Then
MsgBox ($MB_SYSTEMMODAL,"SQLite Error","SQLite3.dll Can't be Loaded!"&@CRLF &@CRLF &_
"Not FOUND in @ScriptDir, @WorkingDir,"&@CRLF &@TAB &"@LocalAppDataDir\AutoIt v3\SQLite,"&@CRLF &@TAB &"@SystemDir or @WindowsDir")
Exit - 1
EndIf
MsgBox ($MB_SYSTEMMODAL,"SQLite3.dll Loaded",$sSQliteDll&" ("&_SQLite_LibVersion ()&")")
ConsoleWrite ("_SQLite_LibVersion="&_SQLite_LibVersion ()&@CRLF )
_SQLite_Shutdown ()

Example 2

; no version reference so file must exist in @ScriptDir, @WorkingDir, @SystemDir or @WindowsDir
#include <MsgBoxConstants.au3>
#include <SQLite.au3>
#include <SQLite.dll.au3>
Local $sSQliteDll
$sSQliteDll= _SQLite_Startup ()
If @error Then
MsgBox ($MB_SYSTEMMODAL,"SQLite Error","SQLite3.dll Can't be Loaded!"&@CRLF &@CRLF &_
"Not FOUND in @ScriptDir, @WorkingDir, @SystemDir or @WindowsDir")
Exit - 1
EndIf
MsgBox ($MB_SYSTEMMODAL,"SQLite3.dll Loaded",$sSQliteDll&" ("&_SQLite_LibVersion ()&")")
ConsoleWrite ("_SQLite_LibVersion="&_SQLite_LibVersion ()&@CRLF )
_SQLite_Shutdown ()

Example 3

; open SQLite with a specific local file
#include <MsgBoxConstants.au3>
#include <SQLite.au3>
#include <SQLite.dll.au3>
Local $sLocalSQLiteDll= "local SQLite.dll"; to be change to an existing .dll to have no error
Local $sSQliteDll= _SQLite_Startup ($sLocalSQLiteDll,False ,1)
If @error Then
MsgBox ($MB_SYSTEMMODAL,"SQLite Error","'SQLite3.dll' Can't be Loaded!")
Exit - 1
EndIf
MsgBox ($MB_SYSTEMMODAL,"SQLite3.dll Loaded",$sSQliteDll&" ("&_SQLite_LibVersion ()&")")
ConsoleWrite ("_SQLite_LibVersion="&_SQLite_LibVersion ()&@CRLF )
_SQLite_Shutdown ()

AltStyle によって変換されたページ (->オリジナル) /