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


Java DatabaseAdapter.setDatabaseName方法代码示例

本文整理汇总了Java中com.orm.androrm.DatabaseAdapter.setDatabaseName方法的典型用法代码示例。如果您正苦于以下问题:Java DatabaseAdapter.setDatabaseName方法的具体用法?Java DatabaseAdapter.setDatabaseName怎么用?Java DatabaseAdapter.setDatabaseName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.orm.androrm.DatabaseAdapter的用法示例。


在下文中一共展示了DatabaseAdapter.setDatabaseName方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: syncDB

import com.orm.androrm.DatabaseAdapter; //导入方法依赖的package包/类
/**
 * Tell AndOrm about the Models that will be used to read and write to the database.
 */
public void syncDB() {
    List<Class<? extends Model>> models = new ArrayList<Class<? extends Model>>();
    models.add(GameSession.class);
    models.add(MarketRequest.class);
    models.add(RequestItem.class);
    models.add(InventoryItem.class);
    models.add(DefaultTile.class);
    models.add(LetterTile.class);
    models.add(WordTile.class);
    models.add(LetterBuilder.class);
    models.add(WordTileBuilder.class);
    models.add(WordBuilder.class);
    models.add(WorkshopBuilder.class);
    models.add(GameTile.class);
    models.add(GameTileBuilder.class);
    models.add(GameTileTimer.class);
    models.add(DecorationTile.class);

    DatabaseAdapter.setDatabaseName("game_db");
    DatabaseAdapter adapter = DatabaseAdapter.getInstance(PhoeniciaContext.context);
    adapter.setModels(models);
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:26,代码来源:GameActivity.java

示例2: setUp

import com.orm.androrm.DatabaseAdapter; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
    super.setUp();
    PhoeniciaContext.context = getContext();
    assertNotNull("Null context", PhoeniciaContext.context);

    List<Class<? extends Model>> models = new ArrayList<Class<? extends Model>>();
    models.add(GameSession.class);

    DatabaseAdapter.setDatabaseName("game_db");
    DatabaseAdapter adapter = DatabaseAdapter.getInstance(PhoeniciaContext.context);
    adapter.setModels(models);

    this.session = new GameSession();
    session.session_name.set("test session");
    session.locale_pack.set("test-locale");
    session.current_level.set("test-level");
    session.save(PhoeniciaContext.context);

    assertNotNull(session.getId());
    Bank.init(session);

}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:24,代码来源:BankTest.java

示例3: setUp

import com.orm.androrm.DatabaseAdapter; //导入方法依赖的package包/类
public void setUp() throws Exception {
    super.setUp();
    PhoeniciaContext.context = getContext();
    assertNotNull("Null context", PhoeniciaContext.context);

    List<Class<? extends Model>> models = new ArrayList<Class<? extends Model>>();
    models.add(GameSession.class);
    models.add(InventoryItem.class);

    DatabaseAdapter.setDatabaseName("game_db");
    DatabaseAdapter adapter = DatabaseAdapter.getInstance(PhoeniciaContext.context);
    adapter.setModels(models);


    GameSession session = new GameSession();
    session.session_name.set("test session");
    session.locale_pack.set("test-locale");
    session.current_level.set("test-level");
    session.save(PhoeniciaContext.context);

    assertNotNull(session.getId());
    Inventory.init(session);
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:24,代码来源:InventoryTest.java

示例4: initializeDatabase

import com.orm.androrm.DatabaseAdapter; //导入方法依赖的package包/类
/**
 * 初始化数据库
 * 两个表:一个是搜索历史,一个是收藏
 */
private void initializeDatabase() {
    List<Class<? extends Model>> models = new ArrayList<>(0);
    models.add(SearchHistory.class);
    models.add(Favorites.class);
    String dbName = this.getResources().getString(R.string.database_name);
    DatabaseAdapter.setDatabaseName(dbName);
    DatabaseAdapter adapter = new DatabaseAdapter(sAppContext);
    adapter.setModels(models);
}
 
开发者ID:dxjia,项目名称:DoubanTop,代码行数:14,代码来源:DoubanTopApplication.java

示例5: CacheManager

import com.orm.androrm.DatabaseAdapter; //导入方法依赖的package包/类
public CacheManager(Context context) {
    this.context = context;
    /**
     * Set the database name and init the database adapter.
     */
    DatabaseAdapter.setDatabaseName(DATABASE_NAME);
    databaseAdapter = DatabaseAdapter.getInstance(context);
    List<Class<? extends Model>> models = new ArrayList<Class<? extends Model>>();
    models.add(Cache.class);
    databaseAdapter.setModels(models);
}
 
开发者ID:shunix,项目名称:Daily-Pushups,代码行数:12,代码来源:CacheManager.java

示例6: DatabaseManager

import com.orm.androrm.DatabaseAdapter; //导入方法依赖的package包/类
public DatabaseManager(Context context, String dbName) {
	this.context = context;
	DatabaseAdapter.setDatabaseName(dbName);
	adapter = DatabaseAdapter.getInstance(context);
	List<Class<? extends Model>> models = new ArrayList<Class<? extends Model>>();
	models.add(PortalsInfo.class);
	adapter.setModels(models);
	adapter.beginTransaction();
}
 
开发者ID:shunix,项目名称:Ingress-Portals-Navigation,代码行数:10,代码来源:DatabaseManager.java

示例7: syncDB

import com.orm.androrm.DatabaseAdapter; //导入方法依赖的package包/类
public static void syncDB(Context app) {
    final String DB_NAME = "sm.db";
    List<Class<? extends Model>> models =
            new ArrayList<Class<? extends Model>>();
    SharedPreferences prefs =
            PreferenceManager.getDefaultSharedPreferences(app);
    int dbVersion = prefs.getInt(PREF_VERSION, 0);
    //int dbVersion = 0;
    Log.d(SMApp.TAG, "syncing DB, version " + dbVersion);

    models.add(Book.class);
    models.add(Scripture.class);
    DatabaseAdapter.setDatabaseName(DB_NAME);
    DatabaseAdapter.getInstance(app)
            .setModels(models);

    if (Book.objects(app).count() == 0) {
        if (app.getDatabasePath(DBHandler.DB_NAME).exists()) {
            migrate(app);
        } else {
            populate(app);
            prefs.edit().putInt(PREF_VERSION, VERSION).apply();
            dbVersion = VERSION;
        }
    }
    if (dbVersion < VERSION) {
        upgrade(app, dbVersion);
        prefs.edit().putInt(PREF_VERSION, VERSION).apply();
    }
    Log.d(SMApp.TAG, "done syncing DB");
}
 
开发者ID:tooke7,项目名称:sm-helper,代码行数:32,代码来源:SyncDB.java


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