| 139 | exports.connectAsync = Promise.promisify(exports.connect, { context: exports }); |
| 140 | |
| 141 | var use = function (connection, proto, opts, cb) { |
| 142 | if (DriverAliases[proto]) { |
| 143 | proto = DriverAliases[proto]; |
| 144 | } |
| 145 | if (typeof opts === "function") { |
| 146 | cb = opts; |
| 147 | opts = {}; |
| 148 | } |
| 149 | |
| 150 | try { |
| 151 | var Driver = adapters.get(proto); |
| 152 | var settings = new Settings.Container(exports.settings.get('*')); |
| 153 | var driver = new Driver(null, connection, { |
| 154 | debug : (opts.query && opts.query.debug === 'true'), |
| 155 | settings : settings |
| 156 | }); |
| 157 | |
| 158 | return cb(null, new ORM(proto, driver, settings)); |
| 159 | } catch (ex) { |
| 160 | return cb(ex); |
| 161 | } |
| 162 | } |
| 163 | |
| 164 | exports.Text = Query.Text; |
| 165 | for (var k in Query.Comparators) { |