Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
};
return extQuery;
}
db.define = function (opt) {
var t = extendedTable(sql.define.apply(sql, arguments), opt);
db.models[opt.name] = t;
return t;
};
db.functions = sql.functions;
db.makeFunction = sql.functionCallCreator;
db.close = function() {
if (pool) pool.close.apply(pool, arguments);
pool = null;
};
db.begin = function() {
var tx = pool.begin();
return wrapTransaction(tx);
};
db.transaction = function(f) {
return P.try(function() {
return wrapTransaction(pool.begin());
}).then(function(tx) {
return P.try(f, tx).then(function(res) {