I'm not sure you can get a count of rows updated after the rows being updated, however you can see the numbers of rows that need to be updated (before the update) based on the "WHERE" statement.
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, exclusive of statements in lower-level triggers. The changes() SQL function is a wrapper around the sqlite3_changes() C/C++ function and hence follows the same rules for counting changes.
So code should be like this:
B4X:
SQLpi.ExecNonQuery("UPDATE " & MyTable & " SET fieldnum=4 WHERE fieldnum=2") ' Or whathever
Dim nbChanged As Int
nbChanged = SQLpi.ExecQuerySingleResult("SELECT changes() FROM " & MyTable)
Log(nbChanged) ' how many records have been updated
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, exclusive of statements in lower-level triggers. The changes() SQL function is a wrapper around the sqlite3_changes() C/C++ function and hence follows the same rules for counting changes.
So code should be like this:
B4X:
SQLpi.ExecNonQuery("UPDATE " & MyTable & " SET fieldnum=4 WHERE fieldnum=2") ' Or whathever
Dim nbChanged As Int
nbChanged = SQLpi.ExecQuerySingleResult("SELECT changes() FROM " & MyTable)
Log(nbChanged) ' how many records have been updated
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.