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


Java ModelAdapter.getCreationQuery方法代码示例

本文整理汇总了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");
}
 
开发者ID:EyeSeeTea,项目名称:EDSApp,代码行数:19,代码来源:Migration9RenameTables.java

示例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);
    }
 
开发者ID:EyeSeeTea,项目名称:EDSApp,代码行数:23,代码来源:Migration12UpdateEdsTables.java

示例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");
}
 
开发者ID:EyeSeeTea,项目名称:EDSApp,代码行数:24,代码来源:Migration12UpdateEdsTables.java

示例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");
}
 
开发者ID:EyeSeeTea,项目名称:EDSApp,代码行数:21,代码来源:Migration7RenameEventDate.java

示例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");
}
 
开发者ID:EyeSeeTea,项目名称:EDSApp,代码行数:19,代码来源:Migration10RenameTables.java

示例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");
}
 
开发者ID:EyeSeeTea,项目名称:malariapp,代码行数:21,代码来源:Migration7RenameEventDate.java

示例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");
}
 
开发者ID:EyeSeeTea,项目名称:malariapp,代码行数:19,代码来源:Migration10RenameTables.java


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