public static synchronized void closeDatabase() { sDatabaseHelper.close(); }
@Override public void onCreate(SQLiteDatabase db) { executePragmas(db); executeCreate(db); executeMigrations(db, -1, db.getVersion()); executeCreateIndex(db); }
@Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { executePragmas(db); executeCreate(db); executeMigrations(db, oldVersion, newVersion); }
private void executeSqlScript(SQLiteDatabase db, String file) { InputStream stream = null; try { stream = Cache.getContext().getAssets().open(MIGRATION_PATH + "/" + file); if (Configuration.SQL_PARSER_DELIMITED.equalsIgnoreCase(mSqlParser)) { executeDelimitedSqlScript(db, stream); } else { executeLegacySqlScript(db, stream); } } catch (IOException e) { Log.e("Failed to execute " + file, e); } finally { IOUtils.closeQuietly(stream); } }
public DatabaseHelper(Configuration configuration) { super(configuration.getContext(), configuration.getDatabaseName(), null, configuration.getDatabaseVersion()); copyAttachedDatabase(configuration.getContext(), configuration.getDatabaseName()); mSqlParser = configuration.getSqlParser(); }
@Override public void onOpen(SQLiteDatabase db) { executePragmas(db); };
public static synchronized void initialize(Configuration configuration) { if (sIsInitialized) { Log.v("ActiveAndroid already initialized."); return; } sContext = configuration.getContext(); sModelInfo = new ModelInfo(configuration); sDatabaseHelper = new DatabaseHelper(configuration); // TODO: It would be nice to override sizeOf here and calculate the memory // actually used, however at this point it seems like the reflection // required would be too costly to be of any benefit. We'll just set a max // object size instead. sEntities = new LruCache<String, Model>(configuration.getCacheSize()); openDatabase(); sIsInitialized = true; Log.v("ActiveAndroid initialized successfully."); }
executeSqlScript(db, file); migrationExecuted = true;
@Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { executePragmas(db); executeCreate(db); executeMigrations(db, oldVersion, newVersion); }
private void executeSqlScript(SQLiteDatabase db, String file) { InputStream stream = null; try { stream = Cache.getContext().getAssets().open(MIGRATION_PATH + "/" + file); if (Configuration.SQL_PARSER_DELIMITED.equalsIgnoreCase(mSqlParser)) { executeDelimitedSqlScript(db, stream); } else { executeLegacySqlScript(db, stream); } } catch (IOException e) { Log.e("Failed to execute " + file, e); } finally { IOUtils.closeQuietly(stream); } }
public DatabaseHelper(Configuration configuration) { super(configuration.getContext(), configuration.getDatabaseName(), null, configuration.getDatabaseVersion()); copyAttachedDatabase(configuration.getContext(), configuration.getDatabaseName()); mSqlParser = configuration.getSqlParser(); }
@Override public void onOpen(SQLiteDatabase db) { executePragmas(db); };
public static synchronized void initialize(Configuration configuration) { if (sIsInitialized) { Log.v("ActiveAndroid already initialized."); return; } sContext = configuration.getContext(); sModelInfo = new ModelInfo(configuration); sDatabaseHelper = new DatabaseHelper(configuration); // TODO: It would be nice to override sizeOf here and calculate the memory // actually used, however at this point it seems like the reflection // required would be too costly to be of any benefit. We'll just set a max // object size instead. sEntities = new LruCache<String, Model>(configuration.getCacheSize()); openDatabase(); sIsInitialized = true; Log.v("ActiveAndroid initialized successfully."); }
executeSqlScript(db, file); migrationExecuted = true;
@Override public void onCreate(SQLiteDatabase db) { executePragmas(db); executeCreate(db); executeMigrations(db, -1, db.getVersion()); executeCreateIndex(db); }
@Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { executePragmas(db); executeCreate(db); executeMigrations(db, oldVersion, newVersion); }
private void executeSqlScript(SQLiteDatabase db, String file) { InputStream stream = null; try { stream = Cache.getContext().getAssets().open(MIGRATION_PATH + "/" + file); if (Configuration.SQL_PARSER_DELIMITED.equalsIgnoreCase(mSqlParser)) { executeDelimitedSqlScript(db, stream); } else { executeLegacySqlScript(db, stream); } } catch (IOException e) { Log.e("Failed to execute " + file, e); } finally { IOUtils.closeQuietly(stream); } }
public DatabaseHelper(Configuration configuration) { super(configuration.getContext(), configuration.getDatabaseName(), null, configuration.getDatabaseVersion()); copyAttachedDatabase(configuration.getContext(), configuration.getDatabaseName()); mSqlParser = configuration.getSqlParser(); }
@Override public void onOpen(SQLiteDatabase db) { executePragmas(db); };
public static synchronized void closeDatabase() { sDatabaseHelper.close(); }