mercredi 23 mars 2016

how to make changes to one table in onupgrade method of database of five tables ignoring the rest in oncreate method

i have five tables in my sqlite db, the five tables are created in oncreate method if i make changes to one table in upgrade method based on the previous db version when i launched the app d changes are made i can see through my logcat but it calls oncreate method and say the 4 tables already exist , how can i handle this error.

public void onUpgrade(SQLiteDatabase database, int version_old, int current_version) {

    if (version_old < 3) {
        database.execSQL(queryFive);
    }

on onCreate i have statements that creates table initially which is then called again after onUpgrade and triggering the error they already exist.how can i handle this

Aucun commentaire:

Enregistrer un commentaire