函数参考


_SQLite_Changes

返回最后执行操作对数据库影响的行数

#include <SQLite.au3>
_SQLite_Changes ( [ $hDB ] )

参数

$hDB [可选参数] 打开的数据库,默认为最后打开的数据库

返回值

成功: 返回影响的行数
失败: 返回 0
@error 1 - 错误调用 SQLite API 'sqlite3_changes'
2 - 调用被安全模式阻止

注意/说明

Changes due to action of triggers or foreign keys are not part of this count. See _SQLite_TotalChanges()

相关

_SQLite_TotalChanges

示例/演示


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

_SQLite_Startup()
ConsoleWrite("_SQLite_LibVersion=" & _SQLite_LibVersion() & @CRLF)
_SQLite_Open()
_SQLite_Exec(-1, "CREATE TABLE test (a, b);") ; 创建表
_SQLite_Exec(-1, "INSERT INTO test VALUES ('1', '2');") ; 插入第一行
_SQLite_Exec(-1, "INSERT INTO test VALUES ('3', '4');") ; 插入第二行
MsgBox(4096, "SQLite", "The last SQL statement changed " & _SQLite_Changes() & " rows" & @CRLF & _
        "All statements during this session changed " & _SQLite_TotalChanges() & " rows")
_SQLite_Close()
_SQLite_Shutdown()