本文整理汇总了Java中io.requery.android.sqlite.DatabaseSource类的典型用法代码示例。如果您正苦于以下问题:Java DatabaseSource类的具体用法?Java DatabaseSource怎么用?Java DatabaseSource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DatabaseSource类属于io.requery.android.sqlite包,在下文中一共展示了DatabaseSource类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: provideDatabaseSource
import io.requery.android.sqlite.DatabaseSource; //导入依赖的package包/类
@Singleton
@Provides
public EntityDataStore<Persistable> provideDatabaseSource() {
Observable.<Void>just(null).observeOn(Schedulers.io()).subscribe(new Action1<Void>() {
@Override
public void call(Void aVoid) {
raw2data(app, DB_NAME, R.raw.books);
}
});
DatabaseSource source = new DatabaseSource(app, Models.DEFAULT, DB_NAME, DB_VERSION);
source.setLoggingEnabled(BuildConfig.DEBUG);
Configuration configuration = source.getConfiguration();
return new EntityDataStore<>(configuration);
}
示例2: SqliteFunctionalTest
import io.requery.android.sqlite.DatabaseSource; //导入依赖的package包/类
public SqliteFunctionalTest(Type type) {
EntityModel model = Models.DEFAULT;
Context context = InstrumentationRegistry.getContext();
dbName = type.toString().toLowerCase() + ".db";
switch (type) {
default:
case ANDROID:
dataSource = new DatabaseSource(context, model, dbName, 1);
break;
case SUPPORT:
dataSource = new SqlitexDatabaseSource(context, model, dbName, 1);
break;
case SQLCIPHER:
dataSource = new SqlCipherDatabaseSource(context, model, dbName, "test123", 1);
break;
}
}
示例3: getData
import io.requery.android.sqlite.DatabaseSource; //导入依赖的package包/类
@NonNull
public ReactiveEntityStore<Persistable> getData() throws RuntimeException {
if (dataStore == null) {
// override onUpgrade to handle migrating to a new version
DatabaseSource source = new DatabaseSource(getReflectedContext(), Models.DEFAULT, 1);
if (BuildConfig.DEBUG) {
// use this in development mode to drop and recreate the tables on every upgrade
source.setTableCreationMode(TableCreationMode.DROP_CREATE);
}
Configuration configuration = source.getConfiguration();
dataStore = ReactiveSupport.toReactiveStore(
new EntityDataStore<Persistable>(configuration));
}
return dataStore;
}
示例4: DatabaseManager
import io.requery.android.sqlite.DatabaseSource; //导入依赖的package包/类
@Inject
public DatabaseManager(Context context, @Named("login") String login) {
this.context = context;
this.login = login;
DatabaseSource source = new DatabaseSource(context, Models.DEFAULT, databaseName(login), 24);
source.setTableCreationMode(TableCreationMode.DROP_CREATE);
if (BuildConfig.DEBUG) {
source.setLoggingEnabled(true);
}
dataStore = ReactiveSupport.toReactiveStore(SqlHelper.getDataStore(source));
}
示例5: getDataStore
import io.requery.android.sqlite.DatabaseSource; //导入依赖的package包/类
public static EntityDataStore<Persistable> getDataStore(DatabaseSource source) {
Configuration configuration = new ConfigurationBuilder(source, Models.DEFAULT)
.setMapping(new MainMapping())
.setStatementCacheSize(100)
.setEntityCache(new EntityCacheBuilder(Models.DEFAULT)
.useReferenceCache(true)
.build())
.build();
return new EntityDataStore<>(configuration);
}
示例6: provideDataStore
import io.requery.android.sqlite.DatabaseSource; //导入依赖的package包/类
@Provides
@Singleton
@Override
public SingleEntityStore<Persistable> provideDataStore(@NonNull final Context poContext) {
final DatabaseSource loSource = new DatabaseSource(poContext, Models.DEFAULT, "mock_android_starter_alt.sqlite", 1);
final Configuration loConfiguration = loSource.getConfiguration();
final SingleEntityStore<Persistable> loDataStore = RxSupport.toReactiveStore(new EntityDataStore<>(loConfiguration));
return loDataStore;
}
示例7: getData
import io.requery.android.sqlite.DatabaseSource; //导入依赖的package包/类
public static SingleEntityStore<Persistable> getData() {
if (dataStore == null) {
// override onUpgrade to handle migrating to a new version
DatabaseSource source = new DatabaseSource(context, Models.DEFAULT, 1);
Configuration configuration = source.getConfiguration();
dataStore = RxSupport.toReactiveStore(
new EntityDataStore<Persistable>(configuration));
}
return dataStore;
}
示例8: getData
import io.requery.android.sqlite.DatabaseSource; //导入依赖的package包/类
public BlockingEntityStore<Persistable> getData() {
if (dataStore == null) {
// override onUpgrade to handle migrating to a new version
DatabaseSource source = new DatabaseSource(this, Models.DEFAULT, 3);
Configuration configuration = source.getConfiguration();
dataStore = new EntityDataStore<Persistable>(configuration);
}
return dataStore;
}
示例9: provideDatabaseSource
import io.requery.android.sqlite.DatabaseSource; //导入依赖的package包/类
@Singleton
@Provides
public EntityDataStore<Persistable> provideDatabaseSource() {
DatabaseSource source = new DatabaseSource(mApplication, Models.DEFAULT, DB_NAME,
DB_VERSION);
source.setLoggingEnabled(BuildConfig.DEBUG);
Configuration configuration = source.getConfiguration();
return new EntityDataStore<>(configuration);
}
示例10: getData
import io.requery.android.sqlite.DatabaseSource; //导入依赖的package包/类
/**
* @return {@link EntityDataStore} single instance for the application.
* <p/>
* Note if you're using Dagger you can make this part of your application level module returning
* {@code @Provides @Singleton}.
*/
ReactiveEntityStore<Persistable> getData() {
if (dataStore == null) {
// override onUpgrade to handle migrating to a new version
DatabaseSource source = new DatabaseSource(this, Models.DEFAULT, 1);
if (BuildConfig.DEBUG) {
// use this in development mode to drop and recreate the tables on every upgrade
source.setTableCreationMode(TableCreationMode.DROP_CREATE);
}
Configuration configuration = source.getConfiguration();
dataStore = ReactiveSupport.toReactiveStore(
new EntityDataStore<Persistable>(configuration));
}
return dataStore;
}
示例11: setupDatabase
import io.requery.android.sqlite.DatabaseSource; //导入依赖的package包/类
private void setupDatabase() {
DatabaseSource source = new DatabaseSource(getTargetContext(), Models.DEFAULT,
DATABASE_VERSION);
Configuration configuration = new ConfigurationBuilder(source,
Models.DEFAULT).setEntityCache(new EmptyEntityCache()).build();
database = new EntityDataStore<>(configuration).toBlocking();
}