没有创建Android Sqlite表

时间:2016-03-02 20:49:30

标签: java android sqlite

我正在处理我的应用程序的更新,所以我决定再向我的数据库添加2个表,但它们没有被创建。我不知道我的代码中的错误在哪里。创建了第一个数据库,另外2个不是。

public class Dbhelper extends SQLiteOpenHelper {


    //Table Information
    public static final String TABLE_WORKOUTS_STOCK = "workout_stock";
    public static final String TABLE_WORKOUTS_CUSTOM = "workout_custom";
    public static final String TABLE_WORKOUTS = "workout";

    public static final String WORKOUTS_ID = "_id";
    public static final String WORKOUT_NAME = "name";
    public static final String WORKOUT_BENEFIT_1 = "benefit_1";
    public static final String WORKOUT_BENEFIT_2 = "benefit_2";
    public static final String WORKOUT_BENEFIT_3 = "benefit_3";
    public static final String WORKOUT_TIME = "time";
    public static final String WOKROUT_REQUIRMENTS = "requirments";
    //workout info

    public static final String WORKOUT_ROUNDS = "workout_rounds";

    public static final String WORKOUT_ROUND_1 = "round_1";
    public static final String WORKOUT_ROUND_2 = "round_2";
    public static final String WORKOUT_ROUND_3 = "round_3";
    public static final String WORKOUT_ROUND_4 = "round_4";
    public static final String WORKOUT_ROUND_5 = "round_5";
    public static final String WORKOUT_ROUND_6 = "round_6";
    public static final String WORKOUT_ROUND_7 = "round_7";
    public static final String WORKOUT_ROUND_8 = "round_8";
    public static final String WORKOUT_ROUND_9 = "round_9";
    public static final String WORKOUT_ROUND_10 = "round_10";
    public static final String WORKOUT_ROUND_11 = "round_11";
    public static final String WORKOUT_ROUND_12 = "round_12";


    public static final String WORKOUT_REST_1 = "rest_1";
    public static final String WORKOUT_REST_2 = "rest_2";
    public static final String WORKOUT_REST_3 = "rest_3";
    public static final String WORKOUT_REST_4 = "rest_4";
    public static final String WORKOUT_REST_5 = "rest_5";
    public static final String WORKOUT_REST_6 = "rest_6";
    public static final String WORKOUT_REST_7 = "rest_7";
    public static final String WORKOUT_REST_8 = "rest_8";
    public static final String WORKOUT_REST_9 = "rest_9";
    public static final String WORKOUT_REST_10 = "rest_10";
    public static final String WORKOUT_REST_11 = "rest_11";
    public static final String WORKOUT_REST_12 = "rest_12";


    public static final String WORKOUT_REPS_1 = "reps_1";
    public static final String WORKOUT_REPS_2 = "reps_2";
    public static final String WORKOUT_REPS_3 = "reps_3";
    public static final String WORKOUT_REPS_4 = "reps_4";
    public static final String WORKOUT_REPS_5 = "reps_5";
    public static final String WORKOUT_REPS_6 = "reps_6";
    public static final String WORKOUT_REPS_7 = "reps_7";
    public static final String WORKOUT_REPS_8 = "reps_8";
    public static final String WORKOUT_REPS_9 = "reps_9";
    public static final String WORKOUT_REPS_10 = "reps_10";
    public static final String WORKOUT_REPS_11 = "reps_11";
    public static final String WORKOUT_REPS_12 = "reps_12";

    //for round
    public static final String WORKOUT_ROUND_EXERCISES_1 = "round_exercises_1_main";
    public static final String WORKOUT_ROUND_EXERCISES_2 = "round_exercises_2_main";
    public static final String WORKOUT_ROUND_EXERCISES_3 = "round_exercises_3_main";
    public static final String WORKOUT_ROUND_EXERCISES_4 = "round_exercises_4_main";
    public static final String WORKOUT_ROUND_EXERCISES_5 = "round_exercises_5_main";
    public static final String WORKOUT_ROUND_EXERCISES_6 = "round_exercises_6_main";
    public static final String WORKOUT_ROUND_EXERCISES_7 = "round_exercises_7_main";
    public static final String WORKOUT_ROUND_EXERCISES_8 = "round_exercises_8_main";
    public static final String WORKOUT_ROUND_EXERCISES_9 = "round_exercises_9_main";
    public static final String WORKOUT_ROUND_EXERCISES_10 = "round_exercises_10_main";
    public static final String WORKOUT_ROUND_EXERCISES_11 = "round_exercises_11_main";
    public static final String WORKOUT_ROUND_EXERCISES_12 = "round_exercises_12_main";

    public static final String WORKOUT_REPS_1_main = "reps_1_main";
    public static final String WORKOUT_REPS_2_main = "reps_2_main";
    public static final String WORKOUT_REPS_3_main = "reps_3_main";
    public static final String WORKOUT_REPS_4_main = "reps_4_main";
    public static final String WORKOUT_REPS_5_main = "reps_5_main";
    public static final String WORKOUT_REPS_6_main = "reps_6_main";
    public static final String WORKOUT_REPS_7_main = "reps_7_main";
    public static final String WORKOUT_REPS_8_main = "reps_8_main";
    public static final String WORKOUT_REPS_9_main = "reps_9_main";
    public static final String WORKOUT_REPS_10_main = "reps_10_main";
    public static final String WORKOUT_REPS_11_main = "reps_11_main";
    public static final String WORKOUT_REPS_12_main = "reps_12_main";

    public static final String WORKOUT_ROUND_EXERCISE_REST_1 = "round_exercose_rest_1";
    public static final String WORKOUT_ROUND_EXERCISE_REST_2 = "round_exercose_rest_2";
    public static final String WORKOUT_ROUND_EXERCISE_REST_3 = "round_exercose_rest_3";
    public static final String WORKOUT_ROUND_EXERCISE_REST_4 = "round_exercose_rest_4";
    public static final String WORKOUT_ROUND_EXERCISE_REST_5 = "round_exercose_rest_5";
    public static final String WORKOUT_ROUND_EXERCISE_REST_6 = "round_exercose_rest_6";
    public static final String WORKOUT_ROUND_EXERCISE_REST_7 = "round_exercose_rest_7";
    public static final String WORKOUT_ROUND_EXERCISE_REST_8 = "round_exercose_rest_8";
    public static final String WORKOUT_ROUND_EXERCISE_REST_9 = "round_exercose_rest_9";
    public static final String WORKOUT_ROUND_EXERCISE_REST_10 = "round_exercose_rest_10";
    public static final String WORKOUT_ROUND_EXERCISE_REST_11 = "round_exercose_rest_11";
    public static final String WORKOUT_ROUND_EXERCISE_REST_12 = "round_exercose_rest_12";

    public static final String WORKOUT_TYPE = "workout_type";


    public static final String WORKOUT_EXERCISES_REPS_DECORATION_1 = "round_exercises_resp_deco_1";
    public static final String WORKOUT_EXERCISES_REPS_DECORATION_2 = "round_exercises_resp_deco_2";
    public static final String WORKOUT_EXERCISES_REPS_DECORATION_3 = "round_exercises_resp_deco_3";
    public static final String WORKOUT_EXERCISES_REPS_DECORATION_4 = "round_exercises_resp_deco_4";
    public static final String WORKOUT_EXERCISES_REPS_DECORATION_5 = "round_exercises_resp_deco_5";
    public static final String WORKOUT_EXERCISES_REPS_DECORATION_6 = "round_exercises_resp_deco_6";
    public static final String WORKOUT_EXERCISES_REPS_DECORATION_7 = "round_exercises_resp_deco_7";
    public static final String WORKOUT_EXERCISES_REPS_DECORATION_8 = "round_exercises_resp_deco_8";
    public static final String WORKOUT_EXERCISES_REPS_DECORATION_9 = "round_exercises_resp_deco_9";
    public static final String WORKOUT_EXERCISES_REPS_DECORATION_10 = "round_exercises_resp_deco_10";
    public static final String WORKOUT_EXERCISES_REPS_DECORATION_11 = "round_exercises_resp_deco_11";
    public static final String WORKOUT_EXERCISES_REPS_DECORATION_12 = "round_exercises_resp_deco_12";

    //


    //database info
    public static final String DB_NAME = "WORKOUT.DB";
    public static final int DB_VERSION = 2;

    //table creation

    public static final String CREATE_TABLE = "create table " + TABLE_WORKOUTS + "(" + WORKOUTS_ID + " INTEGER PRIMARY KEY AUTOINCREMENT," +
            WORKOUT_NAME + " TEXT NOT NULL," +
            WORKOUT_BENEFIT_1 + " TEXT NOT NULL," +
            WORKOUT_BENEFIT_2 + " TEXT NOT NULL," +
            WORKOUT_BENEFIT_3 + " TEXT NOT NULL," +
            WORKOUT_TIME + " TEXT NOT NULL," +
            WOKROUT_REQUIRMENTS + " TEXT NOT NULL," +

            WORKOUT_ROUNDS + " TEXT NOT NULL," +

            WORKOUT_ROUND_1 + " TEXT NOT NULL," +
            WORKOUT_ROUND_2 + " TEXT NOT NULL," +
            WORKOUT_ROUND_3 + " TEXT NOT NULL," +
            WORKOUT_ROUND_4 + " TEXT NOT NULL," +
            WORKOUT_ROUND_5 + " TEXT NOT NULL," +
            WORKOUT_ROUND_6 + " TEXT NOT NULL," +
            WORKOUT_ROUND_7 + " TEXT NOT NULL," +
            WORKOUT_ROUND_8 + " TEXT NOT NULL," +
            WORKOUT_ROUND_9 + " TEXT NOT NULL," +
            WORKOUT_ROUND_10 + " TEXT NOT NULL," +
            WORKOUT_ROUND_11 + " TEXT NOT NULL," +
            WORKOUT_ROUND_12 + " TEXT NOT NULL," +


            WORKOUT_REST_1 + " TEXT NOT NULL," +
            WORKOUT_REST_2 + " TEXT NOT NULL," +
            WORKOUT_REST_3 + " TEXT NOT NULL," +
            WORKOUT_REST_4 + " TEXT NOT NULL," +
            WORKOUT_REST_5 + " TEXT NOT NULL," +
            WORKOUT_REST_6 + " TEXT NOT NULL," +
            WORKOUT_REST_7 + " TEXT NOT NULL," +
            WORKOUT_REST_8 + " TEXT NOT NULL," +
            WORKOUT_REST_9 + " TEXT NOT NULL," +
            WORKOUT_REST_10 + " TEXT NOT NULL," +
            WORKOUT_REST_11 + " TEXT NOT NULL," +
            WORKOUT_REST_12 + " TEXT NOT NULL," +

            WORKOUT_REPS_1 + " TEXT NOT NULL," +
            WORKOUT_REPS_2 + " TEXT NOT NULL," +
            WORKOUT_REPS_3 + " TEXT NOT NULL," +
            WORKOUT_REPS_4 + " TEXT NOT NULL," +
            WORKOUT_REPS_5 + " TEXT NOT NULL," +
            WORKOUT_REPS_6 + " TEXT NOT NULL," +
            WORKOUT_REPS_7 + " TEXT NOT NULL," +
            WORKOUT_REPS_8 + " TEXT NOT NULL," +
            WORKOUT_REPS_9 + " TEXT NOT NULL," +
            WORKOUT_REPS_10 + " TEXT NOT NULL," +
            WORKOUT_REPS_11 + " TEXT NOT NULL," +
            WORKOUT_REPS_12 + " TEXT NOT NULL," +


            WORKOUT_ROUND_EXERCISES_1 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISES_2 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISES_3 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISES_4 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISES_5 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISES_6 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISES_7 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISES_8 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISES_9 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISES_10 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISES_11 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISES_12 + " TEXT NOT NULL," +


            WORKOUT_REPS_1_main + " TEXT NOT NULL," +
            WORKOUT_REPS_2_main + " TEXT NOT NULL," +
            WORKOUT_REPS_3_main + " TEXT NOT NULL," +
            WORKOUT_REPS_4_main + " TEXT NOT NULL," +
            WORKOUT_REPS_5_main + " TEXT NOT NULL," +
            WORKOUT_REPS_6_main + " TEXT NOT NULL," +
            WORKOUT_REPS_7_main + " TEXT NOT NULL," +
            WORKOUT_REPS_8_main + " TEXT NOT NULL," +
            WORKOUT_REPS_9_main + " TEXT NOT NULL," +
            WORKOUT_REPS_10_main + " TEXT NOT NULL," +
            WORKOUT_REPS_11_main + " TEXT NOT NULL," +
            WORKOUT_REPS_12_main + " TEXT NOT NULL," +

            WORKOUT_ROUND_EXERCISE_REST_1 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISE_REST_2 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISE_REST_3 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISE_REST_4 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISE_REST_5 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISE_REST_6 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISE_REST_7 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISE_REST_8 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISE_REST_9 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISE_REST_10 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISE_REST_11 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISE_REST_12 + " TEXT NOT NULL," +
            WORKOUT_TYPE + " TEXT NOT NULL," +


            WORKOUT_EXERCISES_REPS_DECORATION_1 + " TEXT NOT NULL," +
            WORKOUT_EXERCISES_REPS_DECORATION_2 + " TEXT NOT NULL," +
            WORKOUT_EXERCISES_REPS_DECORATION_3 + " TEXT NOT NULL," +
            WORKOUT_EXERCISES_REPS_DECORATION_4 + " TEXT NOT NULL," +
            WORKOUT_EXERCISES_REPS_DECORATION_5 + " TEXT NOT NULL," +
            WORKOUT_EXERCISES_REPS_DECORATION_6 + " TEXT NOT NULL," +
            WORKOUT_EXERCISES_REPS_DECORATION_7 + " TEXT NOT NULL," +
            WORKOUT_EXERCISES_REPS_DECORATION_8 + " TEXT NOT NULL," +
            WORKOUT_EXERCISES_REPS_DECORATION_9 + " TEXT NOT NULL," +
            WORKOUT_EXERCISES_REPS_DECORATION_10 + " TEXT NOT NULL," +
            WORKOUT_EXERCISES_REPS_DECORATION_11 + " TEXT NOT NULL," +
            WORKOUT_EXERCISES_REPS_DECORATION_12 + " TEXT NOT NULL);";


    public static final String CREATE_TABLE_STOCK = "create table " + TABLE_WORKOUTS_STOCK + "(" + WORKOUTS_ID + " INTEGER PRIMARY KEY AUTOINCREMENT," +
            WORKOUT_NAME + " TEXT NOT NULL," +
            WORKOUT_BENEFIT_1 + " TEXT NOT NULL," +
            WORKOUT_BENEFIT_2 + " TEXT NOT NULL," +
            WORKOUT_BENEFIT_3 + " TEXT NOT NULL," +
            WORKOUT_TIME + " TEXT NOT NULL," +
            WOKROUT_REQUIRMENTS + " TEXT NOT NULL," +

            WORKOUT_ROUNDS + " TEXT NOT NULL," +

            WORKOUT_ROUND_1 + " TEXT NOT NULL," +
            WORKOUT_ROUND_2 + " TEXT NOT NULL," +
            WORKOUT_ROUND_3 + " TEXT NOT NULL," +
            WORKOUT_ROUND_4 + " TEXT NOT NULL," +
            WORKOUT_ROUND_5 + " TEXT NOT NULL," +
            WORKOUT_ROUND_6 + " TEXT NOT NULL," +
            WORKOUT_ROUND_7 + " TEXT NOT NULL," +
            WORKOUT_ROUND_8 + " TEXT NOT NULL," +
            WORKOUT_ROUND_9 + " TEXT NOT NULL," +
            WORKOUT_ROUND_10 + " TEXT NOT NULL," +
            WORKOUT_ROUND_11 + " TEXT NOT NULL," +
            WORKOUT_ROUND_12 + " TEXT NOT NULL," +


            WORKOUT_REST_1 + " TEXT NOT NULL," +
            WORKOUT_REST_2 + " TEXT NOT NULL," +
            WORKOUT_REST_3 + " TEXT NOT NULL," +
            WORKOUT_REST_4 + " TEXT NOT NULL," +
            WORKOUT_REST_5 + " TEXT NOT NULL," +
            WORKOUT_REST_6 + " TEXT NOT NULL," +
            WORKOUT_REST_7 + " TEXT NOT NULL," +
            WORKOUT_REST_8 + " TEXT NOT NULL," +
            WORKOUT_REST_9 + " TEXT NOT NULL," +
            WORKOUT_REST_10 + " TEXT NOT NULL," +
            WORKOUT_REST_11 + " TEXT NOT NULL," +
            WORKOUT_REST_12 + " TEXT NOT NULL," +

            WORKOUT_REPS_1 + " TEXT NOT NULL," +
            WORKOUT_REPS_2 + " TEXT NOT NULL," +
            WORKOUT_REPS_3 + " TEXT NOT NULL," +
            WORKOUT_REPS_4 + " TEXT NOT NULL," +
            WORKOUT_REPS_5 + " TEXT NOT NULL," +
            WORKOUT_REPS_6 + " TEXT NOT NULL," +
            WORKOUT_REPS_7 + " TEXT NOT NULL," +
            WORKOUT_REPS_8 + " TEXT NOT NULL," +
            WORKOUT_REPS_9 + " TEXT NOT NULL," +
            WORKOUT_REPS_10 + " TEXT NOT NULL," +
            WORKOUT_REPS_11 + " TEXT NOT NULL," +
            WORKOUT_REPS_12 + " TEXT NOT NULL," +


            WORKOUT_ROUND_EXERCISES_1 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISES_2 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISES_3 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISES_4 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISES_5 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISES_6 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISES_7 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISES_8 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISES_9 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISES_10 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISES_11 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISES_12 + " TEXT NOT NULL," +


            WORKOUT_REPS_1_main + " TEXT NOT NULL," +
            WORKOUT_REPS_2_main + " TEXT NOT NULL," +
            WORKOUT_REPS_3_main + " TEXT NOT NULL," +
            WORKOUT_REPS_4_main + " TEXT NOT NULL," +
            WORKOUT_REPS_5_main + " TEXT NOT NULL," +
            WORKOUT_REPS_6_main + " TEXT NOT NULL," +
            WORKOUT_REPS_7_main + " TEXT NOT NULL," +
            WORKOUT_REPS_8_main + " TEXT NOT NULL," +
            WORKOUT_REPS_9_main + " TEXT NOT NULL," +
            WORKOUT_REPS_10_main + " TEXT NOT NULL," +
            WORKOUT_REPS_11_main + " TEXT NOT NULL," +
            WORKOUT_REPS_12_main + " TEXT NOT NULL," +

            WORKOUT_ROUND_EXERCISE_REST_1 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISE_REST_2 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISE_REST_3 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISE_REST_4 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISE_REST_5 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISE_REST_6 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISE_REST_7 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISE_REST_8 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISE_REST_9 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISE_REST_10 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISE_REST_11 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISE_REST_12 + " TEXT NOT NULL," +
            WORKOUT_TYPE + " TEXT NOT NULL," +


            WORKOUT_EXERCISES_REPS_DECORATION_1 + " TEXT NOT NULL," +
            WORKOUT_EXERCISES_REPS_DECORATION_2 + " TEXT NOT NULL," +
            WORKOUT_EXERCISES_REPS_DECORATION_3 + " TEXT NOT NULL," +
            WORKOUT_EXERCISES_REPS_DECORATION_4 + " TEXT NOT NULL," +
            WORKOUT_EXERCISES_REPS_DECORATION_5 + " TEXT NOT NULL," +
            WORKOUT_EXERCISES_REPS_DECORATION_6 + " TEXT NOT NULL," +
            WORKOUT_EXERCISES_REPS_DECORATION_7 + " TEXT NOT NULL," +
            WORKOUT_EXERCISES_REPS_DECORATION_8 + " TEXT NOT NULL," +
            WORKOUT_EXERCISES_REPS_DECORATION_9 + " TEXT NOT NULL," +
            WORKOUT_EXERCISES_REPS_DECORATION_10 + " TEXT NOT NULL," +
            WORKOUT_EXERCISES_REPS_DECORATION_11 + " TEXT NOT NULL," +
            WORKOUT_EXERCISES_REPS_DECORATION_12 + " TEXT NOT NULL);";



    public static final String CREATE_TABLE_CUSTOM = "create table " + TABLE_WORKOUTS_CUSTOM + "(" + WORKOUTS_ID + " INTEGER PRIMARY KEY AUTOINCREMENT," +
            WORKOUT_NAME + " TEXT NOT NULL," +
            WORKOUT_BENEFIT_1 + " TEXT NOT NULL," +
            WORKOUT_BENEFIT_2 + " TEXT NOT NULL," +
            WORKOUT_BENEFIT_3 + " TEXT NOT NULL," +
            WORKOUT_TIME + " TEXT NOT NULL," +
            WOKROUT_REQUIRMENTS + " TEXT NOT NULL," +

            WORKOUT_ROUNDS + " TEXT NOT NULL," +

            WORKOUT_ROUND_1 + " TEXT NOT NULL," +
            WORKOUT_ROUND_2 + " TEXT NOT NULL," +
            WORKOUT_ROUND_3 + " TEXT NOT NULL," +
            WORKOUT_ROUND_4 + " TEXT NOT NULL," +
            WORKOUT_ROUND_5 + " TEXT NOT NULL," +
            WORKOUT_ROUND_6 + " TEXT NOT NULL," +
            WORKOUT_ROUND_7 + " TEXT NOT NULL," +
            WORKOUT_ROUND_8 + " TEXT NOT NULL," +
            WORKOUT_ROUND_9 + " TEXT NOT NULL," +
            WORKOUT_ROUND_10 + " TEXT NOT NULL," +
            WORKOUT_ROUND_11 + " TEXT NOT NULL," +
            WORKOUT_ROUND_12 + " TEXT NOT NULL," +


            WORKOUT_REST_1 + " TEXT NOT NULL," +
            WORKOUT_REST_2 + " TEXT NOT NULL," +
            WORKOUT_REST_3 + " TEXT NOT NULL," +
            WORKOUT_REST_4 + " TEXT NOT NULL," +
            WORKOUT_REST_5 + " TEXT NOT NULL," +
            WORKOUT_REST_6 + " TEXT NOT NULL," +
            WORKOUT_REST_7 + " TEXT NOT NULL," +
            WORKOUT_REST_8 + " TEXT NOT NULL," +
            WORKOUT_REST_9 + " TEXT NOT NULL," +
            WORKOUT_REST_10 + " TEXT NOT NULL," +
            WORKOUT_REST_11 + " TEXT NOT NULL," +
            WORKOUT_REST_12 + " TEXT NOT NULL," +

            WORKOUT_REPS_1 + " TEXT NOT NULL," +
            WORKOUT_REPS_2 + " TEXT NOT NULL," +
            WORKOUT_REPS_3 + " TEXT NOT NULL," +
            WORKOUT_REPS_4 + " TEXT NOT NULL," +
            WORKOUT_REPS_5 + " TEXT NOT NULL," +
            WORKOUT_REPS_6 + " TEXT NOT NULL," +
            WORKOUT_REPS_7 + " TEXT NOT NULL," +
            WORKOUT_REPS_8 + " TEXT NOT NULL," +
            WORKOUT_REPS_9 + " TEXT NOT NULL," +
            WORKOUT_REPS_10 + " TEXT NOT NULL," +
            WORKOUT_REPS_11 + " TEXT NOT NULL," +
            WORKOUT_REPS_12 + " TEXT NOT NULL," +


            WORKOUT_ROUND_EXERCISES_1 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISES_2 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISES_3 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISES_4 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISES_5 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISES_6 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISES_7 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISES_8 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISES_9 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISES_10 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISES_11 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISES_12 + " TEXT NOT NULL," +


            WORKOUT_REPS_1_main + " TEXT NOT NULL," +
            WORKOUT_REPS_2_main + " TEXT NOT NULL," +
            WORKOUT_REPS_3_main + " TEXT NOT NULL," +
            WORKOUT_REPS_4_main + " TEXT NOT NULL," +
            WORKOUT_REPS_5_main + " TEXT NOT NULL," +
            WORKOUT_REPS_6_main + " TEXT NOT NULL," +
            WORKOUT_REPS_7_main + " TEXT NOT NULL," +
            WORKOUT_REPS_8_main + " TEXT NOT NULL," +
            WORKOUT_REPS_9_main + " TEXT NOT NULL," +
            WORKOUT_REPS_10_main + " TEXT NOT NULL," +
            WORKOUT_REPS_11_main + " TEXT NOT NULL," +
            WORKOUT_REPS_12_main + " TEXT NOT NULL," +

            WORKOUT_ROUND_EXERCISE_REST_1 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISE_REST_2 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISE_REST_3 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISE_REST_4 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISE_REST_5 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISE_REST_6 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISE_REST_7 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISE_REST_8 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISE_REST_9 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISE_REST_10 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISE_REST_11 + " TEXT NOT NULL," +
            WORKOUT_ROUND_EXERCISE_REST_12 + " TEXT NOT NULL," +
            WORKOUT_TYPE + " TEXT NOT NULL," +


            WORKOUT_EXERCISES_REPS_DECORATION_1 + " TEXT NOT NULL," +
            WORKOUT_EXERCISES_REPS_DECORATION_2 + " TEXT NOT NULL," +
            WORKOUT_EXERCISES_REPS_DECORATION_3 + " TEXT NOT NULL," +
            WORKOUT_EXERCISES_REPS_DECORATION_4 + " TEXT NOT NULL," +
            WORKOUT_EXERCISES_REPS_DECORATION_5 + " TEXT NOT NULL," +
            WORKOUT_EXERCISES_REPS_DECORATION_6 + " TEXT NOT NULL," +
            WORKOUT_EXERCISES_REPS_DECORATION_7 + " TEXT NOT NULL," +
            WORKOUT_EXERCISES_REPS_DECORATION_8 + " TEXT NOT NULL," +
            WORKOUT_EXERCISES_REPS_DECORATION_9 + " TEXT NOT NULL," +
            WORKOUT_EXERCISES_REPS_DECORATION_10 + " TEXT NOT NULL," +
            WORKOUT_EXERCISES_REPS_DECORATION_11 + " TEXT NOT NULL," +
            WORKOUT_EXERCISES_REPS_DECORATION_12 + " TEXT NOT NULL);";


    public Dbhelper(Context context) {
        super(context, DB_NAME, null, DB_VERSION);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        db.execSQL(CREATE_TABLE_STOCK);
        db.execSQL(CREATE_TABLE_CUSTOM);
        db.execSQL(CREATE_TABLE);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        db.execSQL("DROP TABLE IF EXSISTS" + TABLE_WORKOUTS_CUSTOM);
        db.execSQL("DROP TABLE IF EXSISTS" + TABLE_WORKOUTS_STOCK);
        db.execSQL("DROP TABLE IF EXSISTS" + TABLE_WORKOUTS);

        onCreate(db);

    }
}

以下是我收到的错误:  *

  

java.lang.RuntimeException:无法启动活动   ComponentInfo {com.spartanbodyweightworkouts / com.spartanbodyweightworkouts.SplashScreen}:   android.database.sqlite.SQLiteException:near" EXSISTSworkout_custom":   语法错误(代码1):,编译时:DROP TABLE IF   EXSISTSworkout_custom                                                                                      在   android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)

1 个答案:

答案 0 :(得分:2)

onUpgrade()重复了两个问题:

  1. EXSISTS中有一个拼写错误。它应该是EXISTS

  2. EXISTS和表名之间应该有空格。