I'm doing update of my app, the goals of this, is to send data trough a SOAP service, my idea is to drop table at each app update, or uninstallation and reinstallation, so I did this:
private static final int DATABASE_VERSION = 2;
private static final String DATABASE_NAME = "name.db";
private static final String TABLE_DEMANDES = "demandes";
private static final String KEY_ID = "id";
private static final String KEY_XML = "xml";
private static final String KEY_STATUTENVOIE = "statutEnvoie";
private static final String KEY_DATEENVOIE = "dateEnvoie";
public DatabaseHandler(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL("DROP TABLE IF EXISTS " + TABLE_DEMANDES);
String CREATE_DEMANDES_TABLE = "CREATE TABLE " + TABLE_DEMANDES + "(" + KEY_ID + " INTEGER PRIMARY KEY," + KEY_XML + " TEXT," + KEY_STATUTENVOIE + " INTEGER," + KEY_DATEENVOIE + " DATETIME" + ")";
db.execSQL(CREATE_DEMANDES_TABLE);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
onCreate(db);
}
But when my SOAP service do a loop on my database and look at the data not sent, I found an old data, but I don't understand why because I delete table at onCreate, so why I get back this data ? I reinstalled my app.
Aucun commentaire:
Enregistrer un commentaire