本文整理汇总了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);
}
示例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);
}
示例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;
}
示例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());
}
示例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());
}
}
}
示例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);
}
示例7: createV29Database
import android.database.sqlite.SQLiteDatabase; //导入方法依赖的package包/类
private SQLiteDatabase createV29Database() {
SQLiteDatabase database = SQLiteDatabase.create(null);
initV29Database(database);
return database;
}
示例8: createNewDatabase
import android.database.sqlite.SQLiteDatabase; //导入方法依赖的package包/类
private SQLiteDatabase createNewDatabase() {
SQLiteDatabase database = SQLiteDatabase.create(null);
storeSchemaDefinition.doDbUpgrade(database);
return database;
}