(config, connection, opts)
| 9 | exports.Driver = Driver; |
| 10 | |
| 11 | function Driver(config, connection, opts) { |
| 12 | this.dialect = 'sqlite'; |
| 13 | this.config = config || {}; |
| 14 | this.opts = opts || {}; |
| 15 | |
| 16 | if (!this.config.timezone) { |
| 17 | this.config.timezone = "local"; |
| 18 | } |
| 19 | |
| 20 | this.query = new Query({ dialect: this.dialect, timezone: this.config.timezone }); |
| 21 | this.customTypes = {}; |
| 22 | |
| 23 | if (connection) { |
| 24 | this.db = connection; |
| 25 | } else { |
| 26 | // on Windows, paths have a drive letter which is parsed by |
| 27 | // url.parse() as the hostname. If host is defined, assume |
| 28 | // it's the drive letter and add ":" |
| 29 | if (process.platform == "win32" && config.host && config.host.match(/^[a-z]$/i)) { |
| 30 | this.db = new sqlite3.Database(decodeURIComponent((config.host ? config.host + ":" : "") + (config.pathname || "")) || ':memory:'); |
| 31 | } else { |
| 32 | this.db = new sqlite3.Database(decodeURIComponent((config.host ? config.host : "") + (config.pathname || "")) || ':memory:'); |
| 33 | } |
| 34 | |
| 35 | } |
| 36 | |
| 37 | this.aggregate_functions = [ "ABS", "ROUND", |
| 38 | "AVG", "MIN", "MAX", |
| 39 | "RANDOM", |
| 40 | "SUM", "COUNT", |
| 41 | "DISTINCT" ]; |
| 42 | } |
| 43 | |
| 44 | _.extend(Driver.prototype, shared, DDL); |
| 45 |
nothing calls this directly
no outgoing calls
no test coverage detected