<NME> SqlDatabaseWrapper.java
<BEF> package com.novoda.downloadmanager;

import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;

import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class SqlDatabaseWrapper {

    private final SQLiteDatabase sqLiteDatabase;

    public SqlDatabaseWrapper(SQLiteDatabase sqLiteDatabase) {
        this.sqLiteDatabase = sqLiteDatabase;
    }

    public Cursor rawQuery(String query) {
        return sqLiteDatabase.rawQuery(query, null);
    }

    public Cursor rawQuery(String query, String selectionArgument, String... selectionArguments) {
        List<String> arguments = new ArrayList<>();
        arguments.add(selectionArgument);
        arguments.addAll(Arrays.asList(selectionArguments));

        return sqLiteDatabase.rawQuery(query, arguments.toArray(new String[arguments.size()]));
    }

    public void close() {
        sqLiteDatabase.close();
    }

    public void deleteDatabase() {
        File outputFile = new File(sqLiteDatabase.getPath());
        if (outputFile.exists()) {
            boolean deleted = outputFile.delete();
        }
    }

    public void delete(String table, String whereClause, String selectionArgument, String... selectionArguments) {
        sqLiteDatabase.beginTransaction();

        List<String> arguments = new ArrayList<>();
        arguments.add(selectionArgument);
        arguments.addAll(Arrays.asList(selectionArguments));

        sqLiteDatabase.delete(table, whereClause, arguments.toArray(new String[arguments.size()]));

        sqLiteDatabase.setTransactionSuccessful();
        sqLiteDatabase.endTransaction();
    }
}
    }
}

<MSG> Start and end transations for both dbs at the same time.

<DFF> @@ -39,16 +39,23 @@ public class SqlDatabaseWrapper {
         }
     }
 
-    public void delete(String table, String whereClause, String selectionArgument, String... selectionArguments) {
+    public void startTransaction() {
         sqLiteDatabase.beginTransaction();
+    }
+
+    public void setTransactionSuccessful() {
+        sqLiteDatabase.setTransactionSuccessful();
+    }
+
+    public void endTransaction() {
+        sqLiteDatabase.endTransaction();
+    }
 
+    public void delete(String table, String whereClause, String selectionArgument, String... selectionArguments) {
         List<String> arguments = new ArrayList<>();
         arguments.add(selectionArgument);
         arguments.addAll(Arrays.asList(selectionArguments));
 
         sqLiteDatabase.delete(table, whereClause, arguments.toArray(new String[arguments.size()]));
-
-        sqLiteDatabase.setTransactionSuccessful();
-        sqLiteDatabase.endTransaction();
     }
 }

{'addition_count': 11, 'commit_subject': 'Start and end transations for both dbs at the same time.', 'deletion_count': 4, 'file_extension': '.java', 'lang': 'java', 'license': 'apache-2.0', 'repo_name': 'novoda/download-manager'}