1
續訂回滾在我的事務中不起作用。在原始查詢中將事務回滾事務回滾不起作用
這是一個例子代碼:
return sequelize.transaction({
isolationLevel: "SERIALIZABLE",
autocommit: false
},function (t) {
return sequelize.query('DELETE FROM Task WHERE id=:id',
{
replacements:{"id":id},
type: sequelize.QueryTypes.SELECT
})
.then(function() {
// the query was successful but I still want to roll back
t.rollback();
});
});
我檢查控制檯:
執行(aaf94974-d646-4056-9cfa-0c53f1b1b3e3):START TRANSACTION;
執行(aaf94974-d646-4056-9cfa-0c53f1b1b3e3):SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
執行(默認):DELETE FROM任務WHERE ID = 6
執行(aaf94974-d646-4056-9cfa-0c53f1b1b3e3):ROLLBACK;
但是回滾不起作用。