在Android中使用Savepoint SQL
命令:
final SQLiteDatabase db = dbHelper.getWritableDatabase();
db.beginTransaction();
try{
String savePointStr = "SAVEPOINT latestFilterConfig";
db.execSQL(savePointStr);
db.setTransactionSuccessful();
}catch (Exception e){
e.printStackTrace();
}finally {
db.endTransaction();
}
使用Rollback
命令:
final SQLiteDatabase db = dbHelper.getWritableDatabase();
try{
db.beginTransaction();
String rollbackStr = ";rollback to savepoint latestFilterConfig";
db.execSQL(rollbackStr);
db.setTransactionSuccessful();
}catch (Exception e){
e.printStackTrace();
}finally {
db.endTransaction();
}
执行我的rollback命令时,会导致以下异常
android.database.sqlite.SQLiteException: no such savepoint: latestFilterConfig (code 1)
请帮我解决这个问题。我需要回滚到保存点。