Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
module.exports = function (opt) {
var pool,
db = {},
dialect = extractDialect(opt.url);
sql.setDialect(dialect);
db.open = function() {
if (pool) return; // already open
if (dialect == 'sqlite') {
try {
var SQLitePool = require('./lib/sqlite-pool');
pool = new SQLitePool(opt.url, opt.connections);
} catch (e) {
throw new Error("Unable to load sqlite pool: " + e.message);
}
}
else {
pool = new AnyDBPool(opt.url, opt.connections);
}
pool._mainpool = true;
};