Skip to content
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

MechanoidContentProvider should respect yield points #229

Open
elincognito opened this issue Mar 7, 2014 · 0 comments
Open

MechanoidContentProvider should respect yield points #229

elincognito opened this issue Mar 7, 2014 · 0 comments

Comments

@elincognito
Copy link

The code

    public ContentProviderResult[] applyBatch(ArrayList<ContentProviderOperation> operations)
            throws OperationApplicationException {
        final SQLiteDatabase db = getOpenHelper().getWritableDatabase();
        db.beginTransaction();
        try {
            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);
            }
            db.setTransactionSuccessful();
            return results;
        } finally {
            db.endTransaction();
        }````

should respect ContentProviderOperation.withYieldAllowed() by 
checking each operation on the for loop if it allows yield and applying a 
db yieldifContentSafely 
example code can be seen in the android contacts provider src code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants