Expand/Shrink

sqlite3_changes

Definition: include pSQLite.e

integer res = sqlite3_changes(sqlite3 db)
--or--
integer res = sqlite3_total_changes(sqlite3 db)
Description: The sqlite3_changes() function returns the number of database rows that were changed (or inserted or deleted) by the most recently completed INSERT, UPDATE, or DELETE statement.
Only changes that are directly specified by the INSERT, UPDATE, or DELETE statement are counted.
Auxiliary changes caused by triggers are not counted.
Use the sqlite3_total_changes() function to find the total number of changes including changes caused by triggers.

Within the body of a trigger, the sqlite3_changes() function does work to report the number of rows that were changed for the most recently completed INSERT, UPDATE, or DELETE statement within the trigger body.

The sqlite3_total_changes() function returns the total number of database rows that have be modified, inserted, or deleted since the database connection was created using sqlite3_open().
All changes are counted, including changes by triggers and changes to TEMP and auxiliary databases.
Except, changes to the SQLITE_MASTER table (caused by statements such as CREATE TABLE) are not counted.
Nor are changes counted when an entire table is deleted using DROP TABLE.

SQLite implements the command "DELETE FROM table" without a WHERE clause by dropping and recreating the table.
(This is much faster than going through and deleting individual elements form the table.)
Because of this optimization, the change count for "DELETE FROM table" will be zero regardless of the number of elements that were originally in the table.
To get an accurate count of the number of rows deleted, use "DELETE FROM table WHERE 1" instead.
pwa/p2js: Not supported