Search in sources :

Example 1 with DefaultTransactionManager

use of com.raizlabs.android.dbflow.structure.database.transaction.DefaultTransactionManager in project DBFlow by Raizlabs.

the class DatabaseDefinition method reset.

/**
     * Performs a full deletion of this database. Reopens the {@link FlowSQLiteOpenHelper} as well.
     *
     * @param context Where the database resides
     */
public void reset(Context context) {
    if (!isResetting) {
        isResetting = true;
        getTransactionManager().stopQueue();
        getHelper().closeDB();
        for (ModelAdapter modelAdapter : modelAdapters.values()) {
            modelAdapter.closeInsertStatement();
            modelAdapter.closeCompiledStatement();
        }
        context.deleteDatabase(getDatabaseFileName());
        // recreate queue after interrupting it.
        if (databaseConfig == null || databaseConfig.transactionManagerCreator() == null) {
            transactionManager = new DefaultTransactionManager(this);
        } else {
            transactionManager = databaseConfig.transactionManagerCreator().createManager(this);
        }
        openHelper = null;
        isResetting = false;
        getHelper().getDatabase();
    }
}
Also used : QueryModelAdapter(com.raizlabs.android.dbflow.structure.QueryModelAdapter) ModelAdapter(com.raizlabs.android.dbflow.structure.ModelAdapter) DefaultTransactionManager(com.raizlabs.android.dbflow.structure.database.transaction.DefaultTransactionManager)

Aggregations

ModelAdapter (com.raizlabs.android.dbflow.structure.ModelAdapter)1 QueryModelAdapter (com.raizlabs.android.dbflow.structure.QueryModelAdapter)1 DefaultTransactionManager (com.raizlabs.android.dbflow.structure.database.transaction.DefaultTransactionManager)1