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


Java SQLiteDatabase.create方法代码示例

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


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

示例1: onCreate

import android.database.sqlite.SQLiteDatabase; //导入方法依赖的package包/类
@Override
public void onCreate(Database db) {
    Log.i("greenDAO", "Creating tables for schema version " + SCHEMA_VERSION);
    //createAllTables(db, true);
    SQLiteDatabase database =SQLiteDatabase.create(null);
    //String t_user_sql = "CREATE TABLE tangshi (\n"
    //    + "    _id        INTEGER PRIMARY KEY AUTOINCREMENT,\n"
    //    + "    author     BLOB,\n"
    //    + "    title      BLOB,\n"
    //    + "    paragraphs BLOB,\n"
    //    + "    strains    BLOB\n"
    //    + ");\n)";
    //database.execSQL(t_user_sql);

}
 
开发者ID:yippeesoft,项目名称:NotifyTools,代码行数:16,代码来源:DaoDBCiMaster.java

示例2: onCreate

import android.database.sqlite.SQLiteDatabase; //导入方法依赖的package包/类
@Override
public void onCreate(Database db) {
    Log.i("greenDAO", "Creating tables for schema version " + SCHEMA_VERSION);
    //createAllTables(db, true);
    SQLiteDatabase database =SQLiteDatabase.create(null);
    String t_user_sql = "CREATE TABLE tangshi (\n"
        + "    _id        INTEGER PRIMARY KEY AUTOINCREMENT,\n"
        + "    author     BLOB,\n"
        + "    title      BLOB,\n"
        + "    paragraphs BLOB,\n"
        + "    strains    BLOB\n"
        + ");\n)";
    database.execSQL(t_user_sql);

}
 
开发者ID:yippeesoft,项目名称:NotifyTools,代码行数:16,代码来源:DaoDBMaster.java

示例3: createV59Table

import android.database.sqlite.SQLiteDatabase; //导入方法依赖的package包/类
private SQLiteDatabase createV59Table() {
    SQLiteDatabase database = SQLiteDatabase.create(null);
    database.execSQL("CREATE TABLE pending_commands (" +
            "id INTEGER PRIMARY KEY, " +
            "command TEXT, " +
            "arguments TEXT" +
            ")");
    return database;
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:10,代码来源:MigrationTo60Test.java

示例4: doDbUpgrade_withEmptyDatabase_shouldSetsDatabaseVersion

import android.database.sqlite.SQLiteDatabase; //导入方法依赖的package包/类
@Test
public void doDbUpgrade_withEmptyDatabase_shouldSetsDatabaseVersion() {
    SQLiteDatabase database = SQLiteDatabase.create(null);

    storeSchemaDefinition.doDbUpgrade(database);

    assertEquals(LocalStore.DB_VERSION, database.getVersion());
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:9,代码来源:StoreSchemaDefinitionTest.java

示例5: doDbUpgrade_withBadDatabase_shouldThrowInDebugBuild

import android.database.sqlite.SQLiteDatabase; //导入方法依赖的package包/类
@Test
public void doDbUpgrade_withBadDatabase_shouldThrowInDebugBuild() {
    if (BuildConfig.DEBUG) {
        SQLiteDatabase database = SQLiteDatabase.create(null);
        database.setVersion(29);

        try {
            storeSchemaDefinition.doDbUpgrade(database);
            fail("Expected Error");
        } catch (Error e) {
            assertEquals("Exception while upgrading database", e.getMessage());
        }
    }
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:15,代码来源:StoreSchemaDefinitionTest.java

示例6: createDatabase

import android.database.sqlite.SQLiteDatabase; //导入方法依赖的package包/类
/** May be overriden by sub classes to set up a different db. */
protected Database createDatabase() {
    SQLiteDatabase sqLiteDatabase;
    if (inMemory) {
        sqLiteDatabase = SQLiteDatabase.create(null);

    } else {
        getContext().deleteDatabase(DB_NAME);
        sqLiteDatabase = getContext().openOrCreateDatabase(DB_NAME, 0, null);
    }
    return new StandardDatabase(sqLiteDatabase);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:13,代码来源:DbTest.java

示例7: createV29Database

import android.database.sqlite.SQLiteDatabase; //导入方法依赖的package包/类
private SQLiteDatabase createV29Database() {
    SQLiteDatabase database = SQLiteDatabase.create(null);
    initV29Database(database);
    return database;
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:6,代码来源:StoreSchemaDefinitionTest.java

示例8: createNewDatabase

import android.database.sqlite.SQLiteDatabase; //导入方法依赖的package包/类
private SQLiteDatabase createNewDatabase() {
    SQLiteDatabase database = SQLiteDatabase.create(null);
    storeSchemaDefinition.doDbUpgrade(database);
    return database;
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:6,代码来源:StoreSchemaDefinitionTest.java


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