SQLite get the old value after update
For my Android app i'd need to开发者_开发知识库 make uptades in some rows of a table and show the to the user the old and the new value. Is there any way of doing that with a single query to the db (with a method that returns the updated rows or similar? )? or I must use two query: fetch old values and then update with the new ones?
Thanks in advance
You need to do that with two queries. You can begin a transaction prior to the read if you want to be assured that its value doesn't change before you write -- just be sure to commit the transaction to enable your change.
As far as I know SQLite doesn't support the fetch-from-update clause like other DBs so you're best to run two queries.
精彩评论