Escapes a string or number for use as TEXT in SQLite statements
#include <SQLite.au3>
_SQLite_Escape ( $sString )
$sString | 将要换码的字符串 |
成功: | 返回字符串换码 |
失败: | 返回空字符串,设置 @error |
@error: | 1 - 错误调用 SQLite API 'sqlite3_mprintf' |
2 - 字符串转换为 UTF - 8 错误 | |
3 - 读换码字符串错误 |
#include <SQLite.au3>
#include <SQLite.dll.au3>
_SQLite_Startup()
ConsoleWrite("_SQLite_LibVersion=" & _SQLite_LibVersion() & @CRLF)
Local $sTestString, $i, $aRow
For $i = 1 To 255
$sTestString &= Chr($i)
Next
_SQLite_Open()
_SQLite_Exec(-1, "CREATE TABLE test (a)")
_SQLite_Exec(-1, "INSERT INTO test VALUES (" & _SQLite_Escape($sTestString) & ")")
_SQLite_QuerySingleRow(-1, "SELECT a FROM test LIMIT 1", $aRow)
If $aRow[0] = $sTestString Then ConsoleWrite("! identical !" & @CRLF)
_SQLite_Shutdown()