MCPcopy Create free account
hub / github.com/dresende/node-orm2 / Driver

Function Driver

lib/Drivers/DML/sqlite.js:11–42  ·  view source on GitHub ↗
(config, connection, opts)

Source from the content-addressed store, hash-verified

9exports.Driver = Driver;
10
11function 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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected