I'm using transactions to insert data into several tables with foreign
key relationships.  Basically I have a wrapper for each table.  Each
wrapper creates it's own SQLiteOpenHelper and holds onto the
SQLiteDatabase that comes from the getWriteableDatabase() call.

Now here's the problem,

When I insert a row into the main table I begin a transaction.
After the main data is inserted I do an insert for the other tables
with FK relationships to the main table.  Each of those inserts is
contained in a wrapper for the specific table, and begins it's own
transaction.

Each level checks to see if anything failed before setting its
transaction to complete.

The problem is when I go to a second level, my transaction dies
because the database is locked, presumably from the first level.

Here are the error messages I get.

08-24 14:54:53.105: ERROR/Database(468): CREATE TABLE android_metadata
failed
08-24 14:54:53.120: ERROR/Database(468): Failed to setLocale() when
constructing, closing the database
08-24 14:54:53.120: ERROR/Database(468):
android.database.sqlite.SQLiteException: database is locked

This is happening on the open call to the second level.

How can I avoid this?

Thanks,
Brandon

-- 
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

Reply via email to