Tyler Collier Tyler Collier - 11 months ago 76
Android Question

Get updated rows count from SQLite in Android using a raw query?

How can I get the number of rows updated using an

statement in SQLite in Android?

Note that I need to use some type of raw execute of a SQL statement, rather than do anything with
because I need a dynamic query. Thus I can't make use of the
method. For example, I'm running something like

UPDATE my_table
SET field_name = field_name + 1

The methods I know of return void, e.g.
returns a
, but the cursor has zero rows and its count is always -1.

Mat Mat
Answer Source

You could do your insert whichever way you want, and then do a select and use the changes() function to return the number of affected rows.