xref: /netbsd-src/external/public-domain/sqlite/man/sqlite3_total_changes.3 (revision b9988867a8ad969c45a52aa7628bc932ec98d46b)
1.Dd January 24, 2024
2.Dt SQLITE3_TOTAL_CHANGES 3
3.Os
4.Sh NAME
5.Nm sqlite3_total_changes ,
6.Nm sqlite3_total_changes64
7.Nd total number of rows modified
8.Sh SYNOPSIS
9.In sqlite3.h
10.Ft int
11.Fo sqlite3_total_changes
12.Fa "sqlite3*"
13.Fc
14.Ft sqlite3_int64
15.Fo sqlite3_total_changes64
16.Fa "sqlite3*"
17.Fc
18.Sh DESCRIPTION
19These functions return the total number of rows inserted, modified
20or deleted by all INSERT, UPDATE or DELETE statements
21completed since the database connection was opened, including those
22executed as part of trigger programs.
23The two functions are identical except for the type of the return value
24and that if the number of rows modified by the connection exceeds the
25maximum value supported by type "int", then the return value of sqlite3_total_changes()
26is undefined.
27Executing any other type of SQL statement does not affect the value
28returned by sqlite3_total_changes().
29.Pp
30Changes made as part of foreign key actions are
31included in the count, but those made as part of REPLACE constraint
32resolution are not.
33Changes to a view that are intercepted by INSTEAD OF triggers are not
34counted.
35.Pp
36The sqlite3_total_changes(D) interface only
37reports the number of rows that changed due to SQL statement run against
38database connection D.
39Any changes by other database connections are ignored.
40To detect changes against a database file from other database connections
41use the PRAGMA data_version command or the SQLITE_FCNTL_DATA_VERSION
42file control.
43.Pp
44If a separate thread makes changes on the same database connection
45while
46.Fn sqlite3_total_changes
47is running then the value returned is unpredictable and not meaningful.
48.Pp
49.Sh IMPLEMENTATION NOTES
50These declarations were extracted from the
51interface documentation at line 2661.
52.Bd -literal
53SQLITE_API int sqlite3_total_changes(sqlite3*);
54SQLITE_API sqlite3_int64 sqlite3_total_changes64(sqlite3*);
55.Ed
56.Sh SEE ALSO
57.Xr sqlite3_changes 3 ,
58.Xr sqlite3_file_control 3 ,
59.Xr SQLITE_FCNTL_LOCKSTATE 3
60