Android sqlite delete doesn't actually delete rows

I use a fairly simple command to try to delete rows in a SQLite database. However, after successful execution of the command, the rows remain in the database !?

SQLiteDatabase dbinst = mydb.getWritableDatabase(); try { dbinst.beginTransaction(); int del = dbinst.delete("sms", "wassent = ? or waserror = ? or wasaborted = ?", new String[] {"1", "1", "1"} ); clog.debug("Rows deleted: " + del); dbinst.setTransactionSuccessful(); } catch(Exception e) { clog.error(e.toString(),e); } dbinst.close(); 

The registrar says that "lines deleted: 3" and no exceptions are raised. However, when you execute the query right after that, do the rows still exist?

Any obvious thing I'm doing wrong here?

+4
source share
1 answer

You need to call endTransaction to actually commit the changes. More information can be found here: beginTransaction () documentation

+1
source

All Articles