Start of mssql driver
This commit is contained in:
parent
c034604c94
commit
2e661e24ff
@ -13,7 +13,9 @@ const dbDriverMap = new Map([
|
||||
['postgres', 'Pg'],
|
||||
['pg', 'Pg'],
|
||||
['sqlite3', 'Sqlite'],
|
||||
['sqlite', 'Sqlite']
|
||||
['sqlite', 'Sqlite'],
|
||||
['sqlserver', 'MSSQLServer'],
|
||||
['mssql', 'MSSQLServer']
|
||||
]);
|
||||
|
||||
/**
|
||||
@ -43,7 +45,7 @@ class NodeQuery {
|
||||
constructor (config) {
|
||||
this.instance = null;
|
||||
|
||||
if (config != null) {
|
||||
if (config !== undefined) {
|
||||
let drivername = dbDriverMap.get(config.driver);
|
||||
|
||||
if (!drivername) {
|
||||
@ -55,6 +57,8 @@ class NodeQuery {
|
||||
|
||||
let adapter = new Adapter(config.connection);
|
||||
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
15
test/sql/mssql.sql
Normal 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)
|
||||
);
|
Loading…
Reference in New Issue
Block a user