Name

sqlite3_changes() — Get the number of changes made by an SQL statement

Definition

int sqlite3_changes( sqlite3* db );
db

A database connection.

Returns

The number of rows modified by the last SQL statement that was executed.

Description

This function returns the number of rows that were modified by the most recent INSERT, UPDATE, or DELETE statement. Only rows directly affected by the table named in the SQL command are counted. Changes made by triggers, foreign key actions, or conflict resolutions are not counted.

If called from within a trigger, the count only includes modifications made at this trigger level. It will not include changes made by an enclosing scope, nor will it include changes made by subsequent trigger or foreign key actions.

This function is exposed to the SQL environment as the SQL function changes().

See Also

sqlite3_total_changes(), count_changes [PRAGMA, Ap F], changes() [SQL Func, Ap E]

Get Using SQLite now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.