Start of mssql driver

This commit is contained in:
Timothy Warren 2016-11-17 21:30:41 -05:00
parent c034604c94
commit 2e661e24ff
2 changed files with 21 additions and 2 deletions

View File

@ -13,7 +13,9 @@ const dbDriverMap = new Map([
['postgres', 'Pg'], ['postgres', 'Pg'],
['pg', 'Pg'], ['pg', 'Pg'],
['sqlite3', 'Sqlite'], ['sqlite3', 'Sqlite'],
['sqlite', 'Sqlite'] ['sqlite', 'Sqlite'],
['sqlserver', 'MSSQLServer'],
['mssql', 'MSSQLServer']
]); ]);
/** /**
@ -43,7 +45,7 @@ class NodeQuery {
constructor (config) { constructor (config) {
this.instance = null; this.instance = null;
if (config != null) { if (config !== undefined) {
let drivername = dbDriverMap.get(config.driver); let drivername = dbDriverMap.get(config.driver);
if (!drivername) { if (!drivername) {
@ -55,6 +57,8 @@ class NodeQuery {
let adapter = new Adapter(config.connection); let adapter = new Adapter(config.connection);
this.instance = new QueryBuilder(driver, adapter); this.instance = new QueryBuilder(driver, adapter);
} else {
throw new Error('What am I supposed to do without any config options, guess?');
} }
} }

15
test/sql/mssql.sql Normal file
View File

@ -0,0 +1,15 @@
DROP TABLE IF EXISTS [create_join];
DROP TABLE IF EXISTS [create_test];
-- Table create_join
CREATE TABLE [create_join] (
[id] INTEGER,
[key] VARCHAR(255),
[val] NVARCHAR(2048)
);
CREATE TABLE [create_test] (
[id] INTEGER,
[key] VARCHAR(255),
[val] NVARCHAR(2048)
);