当前位置: 首页>>代码示例>>Java>>正文


Java DatabaseSource类代码示例

本文整理汇总了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);
}
 
开发者ID:xdtianyu,项目名称:Kindle,代码行数:17,代码来源:AppModule.java

示例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;
    }
}
 
开发者ID:requery,项目名称:requery,代码行数:18,代码来源:SqliteFunctionalTest.java

示例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;
}
 
开发者ID:kbiakov,项目名称:newsreader-mvp-android,代码行数:16,代码来源:DbManager.java

示例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));
}
 
开发者ID:shymmq,项目名称:librus-client,代码行数:12,代码来源:DatabaseManager.java

示例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);
}
 
开发者ID:shymmq,项目名称:librus-client,代码行数:11,代码来源:SqlHelper.java

示例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;
}
 
开发者ID:RoRoche,项目名称:AndroidStarterAlt,代码行数:10,代码来源:MockModuleDatabase.java

示例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;
}
 
开发者ID:dyweb,项目名称:gitlab-android,代码行数:11,代码来源:App.java

示例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;
}
 
开发者ID:pretix,项目名称:pretixdroid,代码行数:10,代码来源:PretixDroid.java

示例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);
}
 
开发者ID:xdtianyu,项目名称:Gallery,代码行数:12,代码来源:AppModule.java

示例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;
}
 
开发者ID:requery,项目名称:requery,代码行数:21,代码来源:PeopleApplication.java

示例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();
}
 
开发者ID:greenrobot,项目名称:android-database-performance,代码行数:8,代码来源:PerfTestRequery.java


注:本文中的io.requery.android.sqlite.DatabaseSource类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。