Hello,
I have an app that stores a database on SD card.
If I don't use beginTransaction/endTransaction, does Android have any
guarantee about the the contents of a database when power is lost? For
example, if I have code like this:
//db.beginTransaction();
//try {
db.delete(TABLE_NAME, "id=123", null);
System.out.println("Deleted 123");
db.delete(TABLE_NAME, "id=456", null);
System.out.println("Deleted 456");
// db.setTransactionSuccessful();
//} finally {
// db.endTransaction();
//}
and the database is in SD card.
When I randomly pull the SD card from the phone, is any of the
following guaranteed to be true if I insert the SD card again and
reload the database:
(1) Order of deletion -- if id=456 has been deleted, then id=123 must
have been deleted.
(2) Immediacy of commit -- if I see the message "Deleted 123" from
logcat, then id=123 must have been deleted.
(3) Non corruption -- rows that are unrelated to id=123 and id=456 are
guaranteed to remain in the database regardless
Note that I am not using transactions because I don't need the two
rows to be atomically deleted. However, I do not want the user has any
surprises -- if I tell them a row has been deleted, then this row
should not appear again when the user re-inserts the SD card.
Thanks!
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en