samedi 7 mai 2016

Android SQliteOpenHelper delete statement issue

Trying to refresh a catalog items table .. just a basic database operation I'm stuck with this strange behaviour

String purgeItems ="DELETE FROM CatalogItems";

String count = "SELECT * FROM CatalogItems";

SQLiteDatabase db = mDb.getWritableDatabase(); // mDb extends SQLiteOpenHelper

db.beginTransaction();
db.rawQuery(purgeItems,null);
db.setTransactionSuccessful();
db.endTransaction();

Cursor c = db.rawQuery(count, null);
Log.e(TAG, "CatalogItems after purge " + String.valueOf(c.getCount()));

returns 642 ..; the original table contant rows count ... ! perhaps I'm tired ^^. it does work with the Products table ...

Aucun commentaire:

Enregistrer un commentaire