I'm dealing with the execSQL function from Android SQLite API. Since I pass query as a parameter, I execute it straight through this function, so I'm not processing it (and I'd prefer not to do it) to know if we are CREATING, INSERTING, DELETING, ...
The point is: is there any generic way to know if the SQL execution has succeed?
Thank you in advance !
execSQL throws SQLException if the SQL string is invalid. You can also wrap your statement into transaction using the model:
db.beginTransaction();
try {
...
db.setTransactionSuccessful();
} finally {
db.endTransaction();
}
I usually wrap my try{...}finally{...}
blocks with a listener ( beginTransactionWithListener(SQLiteTransactionListener transactionListener)
), and use the transactionListner
to check whether everything went well within the transaction, in addition to everything within the try/finally.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With