Name

count_changes — Enable change counts for INSERT, UPDATE, and DELETE

Common Usage

PRAGMA count_changes;
PRAGMA count_changes = switch;

Description

The count_changes pragma gets or sets the return value of data manipulation statements such as INSERT, UPDATE, and DELETE. By default, this pragma is false and these statements do not return anything. If set to true, each data manipulation statement will return a one-column, one-row table consisting of a single integer value. This value indicates how many rows were modified by the statement.

The values returned are very similar to those returned by the SQL function changes(), with one small difference. Rows that are modified by an INSTEAD OF trigger on a view will be counted within the statement return value, but will not be counted by changes().

This pragma affects all statements processed by a given database connection.

See Also

changes() [SQL Func, Ap E], sqlite3_changes() [C API, Ap G]

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.