You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using execute() with a select query returns the number of rows changed in the last database altering query. It would be better to return 0.
I have a select query for which I'm only interested in the number of returned rows. https://docs.rs/diesel/1.4.2/diesel/query_dsl/trait.RunQueryDsl.html#method.execute only spoke about returning the number of "affected rows". Though the description still made me wonder whether it is the correct function to use. After testing, everything seemed to work as expected (due to the above issue of returning a stale number of changed rows from a previous insert). Now I spent way too long to figure out what was wrong with the application.
We can check that sqlite3_column_count returns 0. But it doesn't work with some PRAGMA.
We can also check that sqlite3_stmt_readonly returns false.
There is already a check here. But it does not work if your SELECT returns nothing.
Using
execute()
with a select query returns the number of rows changed in the last database altering query. It would be better to return 0.I have a select query for which I'm only interested in the number of returned rows. https://docs.rs/diesel/1.4.2/diesel/query_dsl/trait.RunQueryDsl.html#method.execute only spoke about returning the number of "affected rows". Though the description still made me wonder whether it is the correct function to use. After testing, everything seemed to work as expected (due to the above issue of returning a stale number of changed rows from a previous insert). Now I spent way too long to figure out what was wrong with the application.
rusqlite
could use https://www.sqlite.org/c3ref/total_changes.html before and after the query instead ofsqlite3_changes
to prevent the return of a stale number of affected rows.The text was updated successfully, but these errors were encountered: