Java Code Examples for androidx.sqlite.db.SupportSQLiteOpenHelper#Configuration

The following examples show how to use androidx.sqlite.db.SupportSQLiteOpenHelper#Configuration . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SQLiteCopyOpenHelperFactory.java    From FairEmail with GNU General Public License v3.0 5 votes vote down vote up
@Override
public SupportSQLiteOpenHelper create(SupportSQLiteOpenHelper.Configuration configuration) {
    return new SQLiteCopyOpenHelper(
            configuration.context,
            mCopyFromAssetPath,
            mCopyFromFile,
            configuration.callback.version,
            mDelegate.create(configuration));
}
 
Example 2
Source File: SafeHelperFactory.java    From cwac-saferoom with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public SupportSQLiteOpenHelper create(
  SupportSQLiteOpenHelper.Configuration configuration) {
  return(create(configuration.context, configuration.name,
    configuration.callback));
}
 
Example 3
Source File: RekeyTest.java    From cwac-saferoom with Apache License 2.0 5 votes vote down vote up
@Test(expected = IllegalArgumentException.class)
public void rekeyEditableFramework() throws IOException {
  FrameworkSQLiteOpenHelperFactory factory=new FrameworkSQLiteOpenHelperFactory();
  SupportSQLiteOpenHelper.Configuration cfg=
      SupportSQLiteOpenHelper.Configuration.builder(InstrumentationRegistry.getTargetContext())
          .callback(new Callback(1))
          .name(DB_NAME)
          .build();
  SupportSQLiteOpenHelper helper=factory.create(cfg);
  SupportSQLiteDatabase db=helper.getWritableDatabase();

  SafeHelperFactory.rekey(db, new SpannableStringBuilder(PASSPHRASE));
  db.close();
}
 
Example 4
Source File: RekeyTest.java    From cwac-saferoom with Apache License 2.0 5 votes vote down vote up
@Test(expected = IllegalArgumentException.class)
public void rekeyCharArrayFramework() throws IOException {
  FrameworkSQLiteOpenHelperFactory factory=new FrameworkSQLiteOpenHelperFactory();
  SupportSQLiteOpenHelper.Configuration cfg=
      SupportSQLiteOpenHelper.Configuration.builder(InstrumentationRegistry.getTargetContext())
          .callback(new Callback(1))
          .name(DB_NAME)
          .build();
  SupportSQLiteOpenHelper helper=factory.create(cfg);
  SupportSQLiteDatabase db=helper.getWritableDatabase();

  SafeHelperFactory.rekey(db, PASSPHRASE.toCharArray());
}
 
Example 5
Source File: DbSyncApplication.java    From dbsync with Apache License 2.0 4 votes vote down vote up
@Override
public void onCreate() {
    SupportSQLiteOpenHelper.Configuration  configuration;
    super.onCreate();

    StaticLoggerBinder.init(this);
    log = LoggerFactory.getLogger(DbSyncApplication.class);

    log.info("onCreate");


    configuration = SupportSQLiteOpenHelper.Configuration.builder(this)
            .name("db1")
            .callback(new Db1Callback())
            .build();
    db1OpenHelper = new FrameworkSQLiteOpenHelperFactory()
            .create(configuration);
    db1OpenHelper.getReadableDatabase();

    configuration = SupportSQLiteOpenHelper.Configuration.builder(this)
            .name("db2")
            .callback(new Db2Callback())
            .build();
    db2OpenHelper = new FrameworkSQLiteOpenHelperFactory()
            .create(configuration);
    db2OpenHelper.getReadableDatabase();

    configuration = SupportSQLiteOpenHelper.Configuration.builder(this)
            .name("db3")
            .callback(new Db3Callback())
            .build();
    db3OpenHelper = new FrameworkSQLiteOpenHelperFactory()
            .create(configuration);
    db3OpenHelper.getReadableDatabase();

    configuration = SupportSQLiteOpenHelper.Configuration.builder(this)
            .name("db4")
            .callback(new Db4Callback())
            .build();
    db4OpenHelper = new FrameworkSQLiteOpenHelperFactory()
            .create(configuration);
    db4OpenHelper.getReadableDatabase();


    configuration = SupportSQLiteOpenHelper.Configuration.builder(this)
            .name("db5")
            .callback(new Db5Callback())
            .build();
    db5OpenHelper = new FrameworkSQLiteOpenHelperFactory()
            .create(configuration);
    db5OpenHelper.getReadableDatabase();
}
 
Example 6
Source File: RequerySQLiteOpenHelperFactory.java    From sqlite-android with Apache License 2.0 4 votes vote down vote up
@Override
public SupportSQLiteOpenHelper create(SupportSQLiteOpenHelper.Configuration config) {
    return new CallbackSQLiteOpenHelper(config.context, config.name, config.callback, configurationOptions);
}
 
Example 7
Source File: KriptonSQLCipherHelperFactory.java    From kripton with Apache License 2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public SupportSQLiteOpenHelper create(SupportSQLiteOpenHelper.Configuration configuration) {
	return (create(configuration.context, configuration.name, configuration.callback));
}