I would like update a particular field with default value only if the DB has been upgraded (version number). I am trying the following:
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion)
{
db.execSQL("DROP TABLE IF EXISTS " + TABLE_A_DETAILS_LOCAL);
db.execSQL("DROP TABLE IF EXISTS " + TABLE_T_DETAILS_LOCAL);
onCreate(db);
updateTable();
}
public void updateTable()
{
SQLiteDatabase db = this.getWritableDatabase();
ContentValues values = new ContentValues();
String logstatus = "temp";
values.put(KEY_USER, logstatus);
db.update(TABLE_USERNAME, values, null, null);
db.close();
}
I am getting error : java.lang.IllegalStateException: getDatabase called recursively
All I need to update table_username field's item with temp this is only when I upgrade my DBvalue.
I am not sure why am I getting an error like this?
Thanks!
Aucun commentaire:
Enregistrer un commentaire