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
Add support for multiple database interactions in one transaction. Implementing this will enhance performance while inserting a large amount of data into the database; and reduce the risk of getting a inconsistent database state if the application is closed during long running db operations (rollback).
The text was updated successfully, but these errors were encountered:
Two ways to implement this behavior are possible. By [using](http://developer.android.com/reference/android/content/ContentProvider.html#bulkInsert%28android.net.Uri, android.content.ContentValues[]%29) ContentProvider.bulkInsert(Uri uri, ContentValues[] values) multiple inserts into one table could be chained together. This would be just a minor adjustment to the current code as the basic implementation of bulkInsert is already provided by Android. The limitation of this method is that only inserts for one specific table are chainable.
The second and more complete option is usingContentProvider.applyBatch(ArrayList<ContentProviderOperation> operations)
This approach is neither limited to a single table nor to insert actions only. Unfortunately it is also a lot more complicated.
This question on Stackoverflow suggests using the second approach.
Add support for multiple database interactions in one transaction. Implementing this will enhance performance while inserting a large amount of data into the database; and reduce the risk of getting a inconsistent database state if the application is closed during long running db operations (rollback).
The text was updated successfully, but these errors were encountered: