函数参考


_SQLite_FastEscape

Fast escapes a string or number for use as TEXT in SQLite statements

#include <SQLite.au3>
_SQLite_FastEscape ( $sString )

参数

$sString string to escape

返回值

Success: Returns escaped string
Failure: Returns empty string and sets @error
@error: 1 - Data is not a string or a numeric

注意/说明

The escaped string is wrapped with single quotes.
For example "It's a fine day" is turned into "'It''s a fine day'"
For binary data use _SQLite_Encode()
For numeric values to be stored as such, use simple concatenation.

相关

_SQLite_Encode, _SQLite_Escape

示例/演示


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

_SQLite_Startup()
ConsoleWrite("_SQLite_LibVersion=" & _SQLite_LibVersion() & @CRLF)
Local $sTestString, $i, $aRow
For $i = 1 To 32 * 1024 ; a large number of characters in Unicode plane 0
    $sTestString &= ChrW($i)
Next
_SQLite_Open()
_SQLite_Exec(-1, "CREATE TABLE test (a text);")
_SQLite_Exec(-1, "INSERT INTO test VALUES (" & _SQLite_FastEscape($sTestString) & ")")
_SQLite_QuerySingleRow(-1, "SELECT a FROM test;", $aRow)
If $aRow[0] == $sTestString Then ConsoleWrite("! identical !" & @CRLF)
_SQLite_Shutdown()