-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Closed
Labels
Description
If I have decided to use "beginTransaction" in my code, How to set isolation level for the transaction?
Here is my code :
pool.getConnection(function(err, connection) {
if (err) {
//log error to file
return callback(err, null);
}
else {
connection.beginTransaction(function(err) {
if (err) { return callback(err, null); }
connection.query({ 'sql' : query, 'timeout': timeout}, function(err, rows, fields) {
connection.release(); //send back to pool
if (err) {
connection.rollback(function() {
//log error to file
return callback(err, null);
})
}
connection.commit(function(err) {
if (err) {
connection.rollback(function() {
self.delParams(aParam);
return callback(err, null);
});
}
return callback && callback(null, rows);
});
})
})
}
})
Now how to set isolation level like 'read commit' in my case? Do you have some example?