Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Oracle.prototype.beginTransaction = function(isolationLevel, cb) {
debug('Begin a transaction with isolation level: %s', isolationLevel);
if (isolationLevel !== Transaction.READ_COMMITTED &&
isolationLevel !== Transaction.SERIALIZABLE) {
const err = new Error(g.f('Invalid {{isolationLevel}}: %s',
isolationLevel));
err.statusCode = 400;
return process.nextTick(function() {
cb(err);
});
}
this.pool.getConnection(function(err, connection) {
if (err) return cb(err);
if (isolationLevel) {
const sql = 'SET TRANSACTION ISOLATION LEVEL ' + isolationLevel;
connection.execute(sql, [],
{outFormat: oracle.OBJECT, autoCommit: false}, function(err) {
cb(err, connection);
});