Getting the number of affected rows for a SQLite statement using the C API

Viewed 13276

I'm executing a DELETE statement using the SQLite 3 C API, and I'd like to know how to fetch the number of affected rows.

Unfortunately, there is no function such as sqlite3_affected_rows or similar.

2 Answers

Run this.

select changes(),total_changes();

The changes() function returns the number of database rows that were changed or inserted or deleted by the most recently completed INSERT, DELETE, or UPDATE statement

The total_changes() function returns the number of row changes caused by INSERT, UPDATE or DELETE statements since the current database connection was opened.

(emphasis added)

Related