-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add batch with db transaction #4
base: master
Are you sure you want to change the base?
Conversation
Oups I just saw my commit changed the whole file... this is not normal... I only added 1 method at the end : |
Hi @Shusshu, Thank you for this pull request. Can you clarify what the Can you make your commit not change the whole file ? Adding javadoc and matching current code style would appreciated too. :) Tim |
Hello, I don't get it I apply your code formatter but it just doesn't change anything, actually I didn't even change the formatting so I have no idea why the whole file is marked as changed About db.yieldIfContendedSafely() it is supposed to be able to let other threads use the db during that transaction |
…ure-batch Conflicts: ProviGen/src/com/tjeannin/provigen/ProviGenProvider.java
updated to have a nice diff |
Any plan to include this soon? |
Hi @Shusshu, The idea behind ProviGen is:
There is already a default implementation of the public ContentProviderResult[] applyBatch(ArrayList<ContentProviderOperation> operations)
throws OperationApplicationException {
final int numOperations = operations.size();
final ContentProviderResult[] results = new ContentProviderResult[numOperations];
for (int i = 0; i < numOperations; i++) {
results[i] = operations.get(i).apply(this, results, i);
}
return results;
} Using transactions is a great way to improve performance of the executed It's a bit as if ProviGen was : See issue #28, I would like to discuss the overall organisation of |
Yes you make a good point there :) |
@Override | ||
public ContentProviderResult[] applyBatch(ArrayList<ContentProviderOperation> operations) | ||
throws OperationApplicationException { | ||
SQLiteDatabase db = openHelper.getWritableDatabase(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In ProviGen 2.0.0
SQLiteDatabase db = openHelper(getContext()).getWritableDatabase();
Ability for the ProviGenProvider to execute a bunch of insert/delete/update within a database transaction