本文整理汇总了Java中com.raizlabs.android.dbflow.structure.ModelAdapter.getCreationQuery方法的典型用法代码示例。如果您正苦于以下问题:Java ModelAdapter.getCreationQuery方法的具体用法?Java ModelAdapter.getCreationQuery怎么用?Java ModelAdapter.getCreationQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.raizlabs.android.dbflow.structure.ModelAdapter
的用法示例。
在下文中一共展示了ModelAdapter.getCreationQuery方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: migrateSurveyTable
import com.raizlabs.android.dbflow.structure.ModelAdapter; //导入方法依赖的package包/类
private void migrateSurveyTable(SQLiteDatabase database) {
ModelAdapter myAdapter = FlowManager.getModelAdapter(Survey.class);
//Create temporal table
String sql=myAdapter.getCreationQuery();
Log.d("DBMIGRATION", "old table " + sql);
sql=sql.replace("Survey", "Survey_temp");
Log.d("DBMIGRATION", "create temp table " + sql);
database.execSQL(sql);
//Insert the data in temporal table
String sqlCopy="INSERT INTO Survey_temp(id_survey, id_tab_group, id_org_unit, id_user, creation_date, completion_date, upload_date, schedule_date, status, eventuid) SELECT id_survey, id_tab_group, id_org_unit, id_user, creationDate, completionDate, uploadedDate, scheduledDate, status, eventuid FROM Survey";
database.execSQL(sqlCopy);
//Replace old table by new table with the new column name.
database.execSQL("DROP TABLE IF EXISTS Survey");
database.execSQL("ALTER TABLE Survey_temp RENAME TO Survey");
}
示例2: migrateProgramTable
import com.raizlabs.android.dbflow.structure.ModelAdapter; //导入方法依赖的package包/类
private void migrateProgramTable(SQLiteDatabase database) {
ModelAdapter myAdapter = FlowManager.getModelAdapter(Program.class);
String programTable = "Program";
String programTempTable = "Program_temp";
//Create temporal table
String sql = myAdapter.getCreationQuery();
Log.d("DBMIGRATION", "old table " + sql);
sql = sql.replace(programTable, programTempTable);
Log.d("DBMIGRATION", "create temp table " + sql);
database.execSQL(sql);
//Insert the data in temporal table
String sqlCopy = "INSERT INTO " + programTempTable
+ "(id_program, uid, name, stage_uid) SELECT id_program, uid, name, programStage "
+ "FROM "
+ programTable;
database.execSQL(sqlCopy);
//Replace old table by new table with the new column name.
database.execSQL("DROP TABLE IF EXISTS " + programTable);
database.execSQL("ALTER TABLE " + programTempTable + " RENAME TO " + programTable);
}
示例3: migrateSurveyTable
import com.raizlabs.android.dbflow.structure.ModelAdapter; //导入方法依赖的package包/类
private void migrateSurveyTable(SQLiteDatabase database) {
ModelAdapter myAdapter = FlowManager.getModelAdapter(Survey.class);
//Create temporal table
String sql = myAdapter.getCreationQuery();
Log.d("DBMIGRATION", "old table " + sql);
sql = sql.replace("Survey", "Survey_temp");
Log.d("DBMIGRATION", "create temp table " + sql);
database.execSQL(sql);
//Insert the data in temporal table
String sqlCopy =
"INSERT INTO Survey_temp(id_survey, id_program, id_org_unit, id_user, "
+ "creation_date, completion_date, upload_date, scheduled_date, status, "
+ "eventuid) SELECT id_survey, id_program, id_org_unit, id_user, "
+ "creation_date, completion_date, upload_date, schedule_date, status, "
+ "eventuid FROM Survey";
database.execSQL(sqlCopy);
//Replace old table by new table with the new column name.
database.execSQL("DROP TABLE IF EXISTS Survey");
database.execSQL("ALTER TABLE Survey_temp RENAME TO Survey");
}
示例4: migrate
import com.raizlabs.android.dbflow.structure.ModelAdapter; //导入方法依赖的package包/类
@Override
public void migrate(SQLiteDatabase database) {
//The column name can't be renamed in sqlite. It is needed create a temporal table with the new column name.
ModelAdapter myAdapter = FlowManager.getModelAdapter(Survey.class);
//Create temporal table
String sql=myAdapter.getCreationQuery();
Log.d("DBMIGRATION", "old table " + sql);
sql=sql.replace("Survey", "Survey_temp");
Log.d("DBMIGRATION", "create temp table " + sql);
database.execSQL(sql);
//Insert the data in temporal table
String sqlCopy="INSERT INTO Survey_temp(id_survey, id_tab_group, id_org_unit, id_user, creationDate, completionDate, uploadedDate, scheduledDate, status, eventuid) SELECT id_survey, id_tab_group, id_org_unit, id_user, creationDate, completionDate, eventDate, scheduledDate, status, eventuid FROM Survey";
database.execSQL(sqlCopy);
//Replace old table by new table with the new column name.
database.execSQL("DROP TABLE IF EXISTS Survey");
database.execSQL("ALTER TABLE Survey_temp RENAME TO Survey");
}
示例5: migrateSurveyTable
import com.raizlabs.android.dbflow.structure.ModelAdapter; //导入方法依赖的package包/类
private void migrateSurveyTable(SQLiteDatabase database) {
ModelAdapter myAdapter = FlowManager.getModelAdapter(Survey.class);
//Create temporal table
String sql=myAdapter.getCreationQuery();
Log.d("DBMIGRATION", "old table " + sql);
sql=sql.replace("Survey", "Survey_temp");
Log.d("DBMIGRATION", "create temp table " + sql);
database.execSQL(sql);
//Insert the data in temporal table
String sqlCopy="INSERT INTO Survey_temp(id_survey, id_program, id_org_unit, id_user, creation_date, completion_date, upload_date, scheduled_date, status, eventuid) SELECT id_survey, id_tab_group, id_org_unit, id_user, creationDate, completionDate, uploadedDate, scheduledDate, status, eventuid FROM Survey";
database.execSQL(sqlCopy);
//Replace old table by new table with the new column name.
database.execSQL("DROP TABLE IF EXISTS Survey");
database.execSQL("ALTER TABLE Survey_temp RENAME TO Survey");
}
示例6: migrate
import com.raizlabs.android.dbflow.structure.ModelAdapter; //导入方法依赖的package包/类
@Override
public void migrate(DatabaseWrapper database) {
//The column name can't be renamed in sqlite. It is needed create a temporal table with the new column name.
ModelAdapter myAdapter = FlowManager.getModelAdapter(Survey.class);
//Create temporal table
String sql=myAdapter.getCreationQuery();
Log.d("DBMIGRATION", "old table " + sql);
sql=sql.replace("Survey", "Survey_temp");
Log.d("DBMIGRATION", "create temp table " + sql);
database.execSQL(sql);
//Insert the data in temporal table
String sqlCopy="INSERT INTO Survey_temp(id_survey, id_tab_group, id_org_unit, id_user, creationDate, completionDate, uploadedDate, scheduledDate, status, eventuid) SELECT id_survey, id_tab_group, id_org_unit, id_user, creationDate, completionDate, eventDate, scheduledDate, status, eventuid FROM Survey";
database.execSQL(sqlCopy);
//Replace old table by new table with the new column name.
database.execSQL("DROP TABLE IF EXISTS Survey");
database.execSQL("ALTER TABLE Survey_temp RENAME TO Survey");
}
示例7: migrateSurveyTable
import com.raizlabs.android.dbflow.structure.ModelAdapter; //导入方法依赖的package包/类
private void migrateSurveyTable(DatabaseWrapper database) {
ModelAdapter myAdapter = FlowManager.getModelAdapter(Survey.class);
//Create temporal table
String sql=myAdapter.getCreationQuery();
Log.d("DBMIGRATION", "old table " + sql);
sql=sql.replace("Survey", "Survey_temp");
Log.d("DBMIGRATION", "create temp table " + sql);
database.execSQL(sql);
//Insert the data in temporal table
String sqlCopy="INSERT INTO Survey_temp(id_survey, id_program, id_org_unit, id_user, creation_date, completion_date, upload_date, scheduled_date, status, eventuid) SELECT id_survey, id_tab_group, id_org_unit, id_user, creationDate, completionDate, uploadedDate, scheduledDate, status, eventuid FROM Survey";
database.execSQL(sqlCopy);
//Replace old table by new table with the new column name.
database.execSQL("DROP TABLE IF EXISTS Survey");
database.execSQL("ALTER TABLE Survey_temp RENAME TO Survey");
}