On Wednesday, July 31, 2013 12:35:04 PM UTC-7, Nobu Games wrote:
>
> Just another related thought: SQLiteDatabase contains some implicit 
> "transaction magic" under the hood which is meant to prevent "accidents" 
> due to simultaneous accesses from different threads. That does not always 
> work that great and can lead to some kind of indefinite deadlock situation. 
> You can ease that problem by making sure to only give one thread 
> "ownership" of the db connection by letting it open and query the 
> connection.
>
>
A single thread is but there are multiple ones querying .  

 

> You also must make sure not to open the same database connection multiple 
> times.

So far, it looks like I am. 
 

> In older Android versions that error was not treated gracefully and the 
> database file could get corrupted. In newer versions you are greeted with 
> an exception. When the database file gets corrupted, the default behavior 
> of SQLiteDatabase is "silently" dropping the whole database file and 
> creating a new one, so basically you start from scratch in such a situation 
> and probably your table creation / setup routines kick in and start fresh.
>

Sounds horrible, and has probably happened to a few unfortunate users.  

Nathan

 

-- 
-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to