Java Code Examples for android.database.sqlite.SQLiteDatabase.create()

The following are Jave code examples for showing how to use create() of the android.database.sqlite.SQLiteDatabase class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: NotifyTools   File: DaoDBCiMaster.java   View Source Code Vote up 5 votes
@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);

}
 
Example 2
Project: NotifyTools   File: DaoDBMaster.java   View Source Code Vote up 5 votes
@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);

}
 
Example 3
Project: q-mail   File: MigrationTo60Test.java   View Source Code Vote up 5 votes
private SQLiteDatabase createV59Table() {
    SQLiteDatabase database = SQLiteDatabase.create(null);
    database.execSQL("CREATE TABLE pending_commands (" +
            "id INTEGER PRIMARY KEY, " +
            "command TEXT, " +
            "arguments TEXT" +
            ")");
    return database;
}
 
Example 4
Project: q-mail   File: StoreSchemaDefinitionTest.java   View Source Code Vote up 5 votes
@Test
public void doDbUpgrade_withEmptyDatabase_shouldSetsDatabaseVersion() {
    SQLiteDatabase database = SQLiteDatabase.create(null);

    storeSchemaDefinition.doDbUpgrade(database);

    assertEquals(LocalStore.DB_VERSION, database.getVersion());
}
 
Example 5
Project: q-mail   File: StoreSchemaDefinitionTest.java   View Source Code Vote up 5 votes
@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());
        }
    }
}
 
Example 6
Project: GitHub   File: DbTest.java   View Source Code Vote up 5 votes
/** 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);
}
 
Example 7
Project: q-mail   File: StoreSchemaDefinitionTest.java   View Source Code Vote up 4 votes
private SQLiteDatabase createV29Database() {
    SQLiteDatabase database = SQLiteDatabase.create(null);
    initV29Database(database);
    return database;
}
 
Example 8
Project: q-mail   File: StoreSchemaDefinitionTest.java   View Source Code Vote up 4 votes
private SQLiteDatabase createNewDatabase() {
    SQLiteDatabase database = SQLiteDatabase.create(null);
    storeSchemaDefinition.doDbUpgrade(database);
    return database;
}