@l-v-yonsama/multi-platform-database-drivers 0.1.249 → 0.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/built/src/drivers/DBDriverResolver.js +4 -0
- package/built/src/drivers/DBDriverResolver.js.map +1 -1
- package/built/src/drivers/MySQLDriver.d.ts +2 -0
- package/built/src/drivers/MySQLDriver.js +6 -0
- package/built/src/drivers/MySQLDriver.js.map +1 -1
- package/built/src/drivers/PostgresDriver.d.ts +2 -0
- package/built/src/drivers/PostgresDriver.js +6 -0
- package/built/src/drivers/PostgresDriver.js.map +1 -1
- package/built/src/drivers/RDSBaseDriver.d.ts +3 -1
- package/built/src/drivers/RDSBaseDriver.js +4 -1
- package/built/src/drivers/RDSBaseDriver.js.map +1 -1
- package/built/src/drivers/SQLServerDriver.d.ts +38 -0
- package/built/src/drivers/SQLServerDriver.js +558 -0
- package/built/src/drivers/SQLServerDriver.js.map +1 -0
- package/built/src/drivers/index.d.ts +1 -0
- package/built/src/drivers/index.js +1 -0
- package/built/src/drivers/index.js.map +1 -1
- package/built/src/examples/mssql.d.ts +1 -0
- package/built/src/examples/mssql.js +35 -0
- package/built/src/examples/mssql.js.map +1 -0
- package/built/src/examples/mysql.js +9 -1
- package/built/src/examples/mysql.js.map +1 -1
- package/built/src/helpers/SQLHelper.d.ts +4 -2
- package/built/src/helpers/SQLHelper.js +26 -15
- package/built/src/helpers/SQLHelper.js.map +1 -1
- package/built/src/resource/DbResource.d.ts +2 -1
- package/built/src/resource/DbResource.js +1 -0
- package/built/src/resource/DbResource.js.map +1 -1
- package/built/src/resource/GeneralColumnUtil.js +12 -1
- package/built/src/resource/GeneralColumnUtil.js.map +1 -1
- package/built/src/types/drivers/SQLServer.d.ts +14 -0
- package/built/src/types/drivers/SQLServer.js +3 -0
- package/built/src/types/drivers/SQLServer.js.map +1 -0
- package/built/src/types/drivers/index.d.ts +1 -0
- package/built/src/types/drivers/index.js +1 -0
- package/built/src/types/drivers/index.js.map +1 -1
- package/built/src/types/helpers/index.d.ts +2 -0
- package/built/src/types/helpers/index.js.map +1 -1
- package/built/src/types/resource/ConnectionSetting.d.ts +5 -0
- package/built/src/types/resource/DBType.d.ts +2 -1
- package/built/src/types/resource/DBType.js +1 -0
- package/built/src/types/resource/DBType.js.map +1 -1
- package/built/src/types/resource/GeneralColumnType.d.ts +1 -0
- package/built/src/types/resource/GeneralColumnType.js +1 -0
- package/built/src/types/resource/GeneralColumnType.js.map +1 -1
- package/built/src/types/resource/SQLServerColumnType.d.ts +42 -0
- package/built/src/types/resource/SQLServerColumnType.js +148 -0
- package/built/src/types/resource/SQLServerColumnType.js.map +1 -0
- package/built/src/types/resource/index.d.ts +1 -0
- package/built/src/types/resource/index.js +1 -0
- package/built/src/types/resource/index.js.map +1 -1
- package/package.json +5 -1
|
@@ -0,0 +1,558 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SQLServerDriver = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const mssql_1 = require("mssql");
|
|
6
|
+
const enum_values_1 = require("enum-values");
|
|
7
|
+
const resource_1 = require("../resource");
|
|
8
|
+
const types_1 = require("../types");
|
|
9
|
+
const RDSBaseDriver_1 = require("./RDSBaseDriver");
|
|
10
|
+
const EXPLAIN_COLUMNS = [
|
|
11
|
+
(0, resource_1.createRdhKey)({
|
|
12
|
+
name: 'StmtText',
|
|
13
|
+
type: types_1.GeneralColumnType.TEXT,
|
|
14
|
+
align: 'left',
|
|
15
|
+
width: 300,
|
|
16
|
+
}),
|
|
17
|
+
(0, resource_1.createRdhKey)({ name: 'PhysicalOp', type: types_1.GeneralColumnType.TEXT, width: 20 }),
|
|
18
|
+
(0, resource_1.createRdhKey)({
|
|
19
|
+
name: 'LogicalOp',
|
|
20
|
+
type: types_1.GeneralColumnType.TEXT,
|
|
21
|
+
width: 20,
|
|
22
|
+
}),
|
|
23
|
+
(0, resource_1.createRdhKey)({
|
|
24
|
+
name: 'Argument',
|
|
25
|
+
type: types_1.GeneralColumnType.TEXT,
|
|
26
|
+
width: 20,
|
|
27
|
+
}),
|
|
28
|
+
(0, resource_1.createRdhKey)({
|
|
29
|
+
name: 'DefinedValues',
|
|
30
|
+
type: types_1.GeneralColumnType.TEXT,
|
|
31
|
+
width: 20,
|
|
32
|
+
}),
|
|
33
|
+
(0, resource_1.createRdhKey)({
|
|
34
|
+
name: 'EstimateRows',
|
|
35
|
+
type: types_1.GeneralColumnType.INTEGER,
|
|
36
|
+
width: 40,
|
|
37
|
+
}),
|
|
38
|
+
(0, resource_1.createRdhKey)({
|
|
39
|
+
name: 'EstimateIO',
|
|
40
|
+
type: types_1.GeneralColumnType.REAL,
|
|
41
|
+
width: 40,
|
|
42
|
+
}),
|
|
43
|
+
(0, resource_1.createRdhKey)({
|
|
44
|
+
name: 'EstimateCPU',
|
|
45
|
+
type: types_1.GeneralColumnType.REAL,
|
|
46
|
+
width: 40,
|
|
47
|
+
}),
|
|
48
|
+
(0, resource_1.createRdhKey)({
|
|
49
|
+
name: 'AvgRowSize',
|
|
50
|
+
type: types_1.GeneralColumnType.INTEGER,
|
|
51
|
+
width: 40,
|
|
52
|
+
}),
|
|
53
|
+
(0, resource_1.createRdhKey)({
|
|
54
|
+
name: 'TotalSubtreeCost',
|
|
55
|
+
type: types_1.GeneralColumnType.REAL,
|
|
56
|
+
width: 40,
|
|
57
|
+
}),
|
|
58
|
+
(0, resource_1.createRdhKey)({
|
|
59
|
+
name: 'OutputList',
|
|
60
|
+
type: types_1.GeneralColumnType.UNKNOWN,
|
|
61
|
+
width: 20,
|
|
62
|
+
}),
|
|
63
|
+
(0, resource_1.createRdhKey)({
|
|
64
|
+
name: 'Warnings',
|
|
65
|
+
type: types_1.GeneralColumnType.TEXT,
|
|
66
|
+
width: 40,
|
|
67
|
+
}),
|
|
68
|
+
(0, resource_1.createRdhKey)({
|
|
69
|
+
name: 'Type',
|
|
70
|
+
type: types_1.GeneralColumnType.TEXT,
|
|
71
|
+
width: 40,
|
|
72
|
+
}),
|
|
73
|
+
(0, resource_1.createRdhKey)({
|
|
74
|
+
name: 'Parallel',
|
|
75
|
+
type: types_1.GeneralColumnType.BOOLEAN,
|
|
76
|
+
width: 40,
|
|
77
|
+
}),
|
|
78
|
+
(0, resource_1.createRdhKey)({
|
|
79
|
+
name: 'EstimateExecutions',
|
|
80
|
+
type: types_1.GeneralColumnType.INTEGER,
|
|
81
|
+
width: 40,
|
|
82
|
+
}),
|
|
83
|
+
];
|
|
84
|
+
class SQLServerDriver extends RDSBaseDriver_1.RDSBaseDriver {
|
|
85
|
+
constructor(conRes) {
|
|
86
|
+
super(conRes);
|
|
87
|
+
}
|
|
88
|
+
begin() {
|
|
89
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
90
|
+
this.tran = this.con.transaction();
|
|
91
|
+
yield this.tran.begin();
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
commit() {
|
|
95
|
+
var _a;
|
|
96
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
97
|
+
try {
|
|
98
|
+
yield ((_a = this.tran) === null || _a === void 0 ? void 0 : _a.commit());
|
|
99
|
+
}
|
|
100
|
+
finally {
|
|
101
|
+
this.tran = undefined;
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
rollback() {
|
|
106
|
+
var _a;
|
|
107
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
108
|
+
try {
|
|
109
|
+
yield ((_a = this.tran) === null || _a === void 0 ? void 0 : _a.rollback());
|
|
110
|
+
}
|
|
111
|
+
finally {
|
|
112
|
+
this.tran = undefined;
|
|
113
|
+
}
|
|
114
|
+
this.tran = undefined;
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
setAutoCommit(value) {
|
|
118
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
fieldInfo2Key(fieldInfo, useTableColumnType, table) {
|
|
122
|
+
var _a, _b;
|
|
123
|
+
const mssqlColumnTypename = enum_values_1.EnumValues.getNameFromValue(types_1.SQLServerColumnType, types_1.SQLServerColumnType.parseByFieldInfo(fieldInfo));
|
|
124
|
+
const tableColumn = (_a = table === null || table === void 0 ? void 0 : table.children) === null || _a === void 0 ? void 0 : _a.find((it) => it.name === fieldInfo.name);
|
|
125
|
+
const key = (0, resource_1.createRdhKey)({
|
|
126
|
+
name: fieldInfo.name,
|
|
127
|
+
type: (0, resource_1.parseColumnType)(mssqlColumnTypename),
|
|
128
|
+
comment: (_b = tableColumn === null || tableColumn === void 0 ? void 0 : tableColumn.comment) !== null && _b !== void 0 ? _b : '',
|
|
129
|
+
required: (tableColumn === null || tableColumn === void 0 ? void 0 : tableColumn.nullable) === false,
|
|
130
|
+
});
|
|
131
|
+
if (useTableColumnType && tableColumn) {
|
|
132
|
+
key.type = tableColumn.colType;
|
|
133
|
+
}
|
|
134
|
+
return key;
|
|
135
|
+
}
|
|
136
|
+
connectWithTest() {
|
|
137
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
138
|
+
let errorMessage = '';
|
|
139
|
+
this.con = yield this.createConnection();
|
|
140
|
+
try {
|
|
141
|
+
errorMessage = yield this.test();
|
|
142
|
+
}
|
|
143
|
+
catch (e) {
|
|
144
|
+
errorMessage = e.message;
|
|
145
|
+
}
|
|
146
|
+
try {
|
|
147
|
+
}
|
|
148
|
+
catch (e) {
|
|
149
|
+
errorMessage = e.message;
|
|
150
|
+
}
|
|
151
|
+
return errorMessage;
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
kill() {
|
|
155
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
156
|
+
let message = '';
|
|
157
|
+
try {
|
|
158
|
+
if (!this.con && !this.req) {
|
|
159
|
+
return message;
|
|
160
|
+
}
|
|
161
|
+
this.req.cancel();
|
|
162
|
+
}
|
|
163
|
+
catch (e) {
|
|
164
|
+
message = e.message;
|
|
165
|
+
}
|
|
166
|
+
finally {
|
|
167
|
+
this.req = undefined;
|
|
168
|
+
}
|
|
169
|
+
return message;
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
getTestSqlStatement() {
|
|
173
|
+
return "SELECT name as test_result FROM sys.databases WHERE name='master'";
|
|
174
|
+
}
|
|
175
|
+
requestSqlSub(params) {
|
|
176
|
+
var _a, _b;
|
|
177
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
178
|
+
const { sql, conditions, dbTable, meta } = params;
|
|
179
|
+
let rdb;
|
|
180
|
+
if (!this.con) {
|
|
181
|
+
throw new Error('No connection');
|
|
182
|
+
}
|
|
183
|
+
const binds = (_a = conditions === null || conditions === void 0 ? void 0 : conditions.binds) !== null && _a !== void 0 ? _a : [];
|
|
184
|
+
const startTime = new Date().getTime();
|
|
185
|
+
if (this.tran) {
|
|
186
|
+
this.req = this.tran.request();
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
this.req = this.con.request();
|
|
190
|
+
}
|
|
191
|
+
binds.forEach((bind, idx) => {
|
|
192
|
+
this.req.input(`${idx + 1}`, bind);
|
|
193
|
+
});
|
|
194
|
+
this.req.arrayRowMode = true;
|
|
195
|
+
const result = yield this.req.query(sql);
|
|
196
|
+
const elapsedTimeMilli = new Date().getTime() - startTime;
|
|
197
|
+
const columns = (_b = result['columns']) === null || _b === void 0 ? void 0 : _b[0];
|
|
198
|
+
if (columns === undefined) {
|
|
199
|
+
rdb = new resource_1.ResultSetDataBuilder(['affectedRows']);
|
|
200
|
+
rdb.addRow({
|
|
201
|
+
affectedRows: result.rowsAffected[0],
|
|
202
|
+
});
|
|
203
|
+
rdb.setSummary({
|
|
204
|
+
elapsedTimeMilli,
|
|
205
|
+
affectedRows: result.rowsAffected[0],
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
209
|
+
rdb = new resource_1.ResultSetDataBuilder(columns.map((f) => this.fieldInfo2Key(f, (meta === null || meta === void 0 ? void 0 : meta.editable) === true, dbTable)));
|
|
210
|
+
result.recordset.forEach((recordValues) => {
|
|
211
|
+
const values = {};
|
|
212
|
+
columns.forEach((it) => {
|
|
213
|
+
values[it.name] = recordValues[it.index];
|
|
214
|
+
});
|
|
215
|
+
rdb.addRow(values);
|
|
216
|
+
});
|
|
217
|
+
rdb.setSummary({
|
|
218
|
+
elapsedTimeMilli,
|
|
219
|
+
selectedRows: rdb.rs.rows.length,
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
return rdb;
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
explainSqlSub(params) {
|
|
226
|
+
var _a, _b;
|
|
227
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
228
|
+
const req = this.con.request();
|
|
229
|
+
yield req.batch(`SET SHOWPLAN_ALL ON`);
|
|
230
|
+
try {
|
|
231
|
+
const binds = (_b = (_a = params.conditions) === null || _a === void 0 ? void 0 : _a.binds) !== null && _b !== void 0 ? _b : [];
|
|
232
|
+
binds.forEach((bind, idx) => {
|
|
233
|
+
this.req.input(`${idx + 1}`, bind);
|
|
234
|
+
});
|
|
235
|
+
const result = yield req.query(params.sql);
|
|
236
|
+
const rdb = new resource_1.ResultSetDataBuilder(EXPLAIN_COLUMNS);
|
|
237
|
+
result.recordset.forEach((recordValues) => {
|
|
238
|
+
const values = {};
|
|
239
|
+
rdb.rs.keys.forEach((it) => {
|
|
240
|
+
values[it.name] = recordValues[it.name];
|
|
241
|
+
});
|
|
242
|
+
rdb.addRow(values);
|
|
243
|
+
});
|
|
244
|
+
return rdb;
|
|
245
|
+
}
|
|
246
|
+
finally {
|
|
247
|
+
yield req.batch(`SET SHOWPLAN_ALL OFF`);
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
explainAnalyzeSqlSub(params) {
|
|
252
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
253
|
+
throw new Error('SQL Server does not support explain analyze');
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
getInfomationSchemasSub() {
|
|
257
|
+
var _a;
|
|
258
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
259
|
+
const st = new Date().getTime();
|
|
260
|
+
const dbResources = new Array();
|
|
261
|
+
const dbDatabase = new resource_1.RdsDatabase(this.conRes.database);
|
|
262
|
+
dbResources.push(dbDatabase);
|
|
263
|
+
const currentSchemaName = yield this.getCurrentSchema();
|
|
264
|
+
if (((_a = this.conRes.sqlServer) === null || _a === void 0 ? void 0 : _a.onlyDefaultSchema) === true) {
|
|
265
|
+
const schemaRes = new resource_1.DbSchema(currentSchemaName);
|
|
266
|
+
dbDatabase.addChild(schemaRes);
|
|
267
|
+
}
|
|
268
|
+
else {
|
|
269
|
+
const dbSchemas = yield this.getSchemas(dbDatabase);
|
|
270
|
+
dbSchemas.forEach((res) => {
|
|
271
|
+
dbDatabase.addChild(res);
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
this.resetDefaultSchema(dbDatabase, currentSchemaName);
|
|
275
|
+
for (const dbSchema of dbDatabase.children) {
|
|
276
|
+
const dbTables = yield this.getTables(dbSchema);
|
|
277
|
+
dbTables.forEach((res) => dbSchema.addChild(res));
|
|
278
|
+
yield this.setColumns(dbSchema);
|
|
279
|
+
}
|
|
280
|
+
const defaultSchema = dbDatabase.getSchema({ isDefault: true });
|
|
281
|
+
yield this.setForinKeys(defaultSchema);
|
|
282
|
+
yield this.setUniqueKeys(defaultSchema);
|
|
283
|
+
return dbResources;
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
getCurrentSchema() {
|
|
287
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
288
|
+
const r = yield this.con.request().query('SELECT SCHEMA_NAME() as name');
|
|
289
|
+
return r.recordset[0].name;
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
getSchemas(dbDatabase) {
|
|
293
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
294
|
+
const rdh = yield this.requestSql({
|
|
295
|
+
sql: `SELECT SCHEMA_NAME as name, DEFAULT_CHARACTER_SET_NAME
|
|
296
|
+
FROM INFORMATION_SCHEMA.SCHEMATA
|
|
297
|
+
WHERE CATALOG_NAME = '${dbDatabase.name}'
|
|
298
|
+
AND SCHEMA_NAME NOT IN ('guest', 'INFORMATION_SCHEMA', 'sys',
|
|
299
|
+
'db_owner', 'db_accessadmin', 'db_securityadmin', 'db_ddladmin',
|
|
300
|
+
'db_backupoperator', 'db_datareader', 'db_datawriter', 'db_denydatareader',
|
|
301
|
+
'db_denydatawriter'
|
|
302
|
+
)
|
|
303
|
+
`,
|
|
304
|
+
});
|
|
305
|
+
return rdh.rows.map((r) => {
|
|
306
|
+
const res = new resource_1.DbSchema(r.values.name);
|
|
307
|
+
return res;
|
|
308
|
+
});
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
getTables(dbSchema) {
|
|
312
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
313
|
+
const rdh = yield this.requestSql({
|
|
314
|
+
sql: `SELECT
|
|
315
|
+
m.TABLE_NAME as name,
|
|
316
|
+
CASE m.TABLE_TYPE
|
|
317
|
+
WHEN 'BASE TABLE' THEN 'TABLE'
|
|
318
|
+
WHEN 'VIEW' THEN 'VIEW'
|
|
319
|
+
ELSE 'TABLE' END AS table_type,
|
|
320
|
+
s.comment
|
|
321
|
+
FROM INFORMATION_SCHEMA.TABLES as m
|
|
322
|
+
LEFT JOIN (
|
|
323
|
+
SELECT
|
|
324
|
+
t.name as table_name,
|
|
325
|
+
s.name as schema_name,
|
|
326
|
+
ep.value as comment
|
|
327
|
+
FROM sys.tables t
|
|
328
|
+
INNER JOIN sys.schemas s ON (t.schema_id = s.schema_id)
|
|
329
|
+
INNER JOIN sys.extended_properties ep
|
|
330
|
+
ON ( ep.major_id = t.object_id AND ep.minor_id = 0 AND ep.name = 'MS_Description')
|
|
331
|
+
WHERE s.name = '${dbSchema.name}'
|
|
332
|
+
) s ON (m.TABLE_SCHEMA=s.schema_name AND m.TABLE_NAME = s.table_name)
|
|
333
|
+
WHERE m.TABLE_SCHEMA = '${dbSchema.name}'`,
|
|
334
|
+
});
|
|
335
|
+
return rdh.rows.map((r) => {
|
|
336
|
+
const res = new resource_1.DbTable(r.values.name, r.values.table_type, r.values.comment);
|
|
337
|
+
return res;
|
|
338
|
+
});
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
setColumns(dbSchema) {
|
|
342
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
343
|
+
const binds = [dbSchema.name];
|
|
344
|
+
const rdh = yield this.requestSql({
|
|
345
|
+
sql: `SELECT
|
|
346
|
+
m.TABLE_NAME as tname,
|
|
347
|
+
m.COLUMN_NAME as name,
|
|
348
|
+
m.COLUMN_DEFAULT as col_default,
|
|
349
|
+
m.DATA_TYPE as col_type,
|
|
350
|
+
CASE
|
|
351
|
+
WHEN m.IS_NULLABLE = 'YES' THEN 1
|
|
352
|
+
ELSE 0
|
|
353
|
+
END as nullable,
|
|
354
|
+
s.is_identity,
|
|
355
|
+
s.comment
|
|
356
|
+
FROM
|
|
357
|
+
INFORMATION_SCHEMA.COLUMNS m
|
|
358
|
+
LEFT JOIN (
|
|
359
|
+
SELECT
|
|
360
|
+
schema_name(so.schema_id) as schema_name,
|
|
361
|
+
so.name as table_name,
|
|
362
|
+
sc.name as column_name,
|
|
363
|
+
sc.is_identity,
|
|
364
|
+
sep.value as comment
|
|
365
|
+
FROM sys.extended_properties sep
|
|
366
|
+
INNER join sys.objects so On sep.major_id = so.object_id
|
|
367
|
+
INNER join sys.columns sc On (so.object_id = sc.object_id and sep.minor_id = sc.column_id)
|
|
368
|
+
WHERE
|
|
369
|
+
sep.name = 'MS_Description' and so.type = 'U'
|
|
370
|
+
AND schema_name(so.schema_id) = '${dbSchema.name}'
|
|
371
|
+
) s ON (m.TABLE_SCHEMA = s.schema_name AND m.TABLE_NAME = s.table_name AND m.COLUMN_NAME = s.column_name)
|
|
372
|
+
WHERE
|
|
373
|
+
m.TABLE_SCHEMA = '${dbSchema.name}'
|
|
374
|
+
ORDER BY
|
|
375
|
+
m.ORDINAL_POSITION`,
|
|
376
|
+
});
|
|
377
|
+
const constraint = yield this.requestSql({
|
|
378
|
+
sql: `SELECT T.TABLE_NAME as tname, C.COLUMN_NAME as name,T.CONSTRAINT_TYPE as ctype
|
|
379
|
+
FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS T
|
|
380
|
+
JOIN INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE C ON C.CONSTRAINT_NAME=T.CONSTRAINT_NAME
|
|
381
|
+
WHERE
|
|
382
|
+
T.TABLE_SCHEMA = '${dbSchema.name}' AND T.CONSTRAINT_TYPE IN ('PRIMARY KEY','UNIQUE')`,
|
|
383
|
+
});
|
|
384
|
+
rdh.rows.forEach((r) => {
|
|
385
|
+
var _a, _b, _c;
|
|
386
|
+
const dbTable = dbSchema.getChildByName(r.values.tname);
|
|
387
|
+
if (dbTable) {
|
|
388
|
+
const type_name = enum_values_1.EnumValues.getNameFromValue(types_1.SQLServerColumnType, types_1.SQLServerColumnType.parse(r.values.col_type));
|
|
389
|
+
const ctype = (_c = (_b = (_a = constraint.rows.find((it) => it.values.tname === r.values.tname &&
|
|
390
|
+
it.values.name === r.values.name)) === null || _a === void 0 ? void 0 : _a.values) === null || _b === void 0 ? void 0 : _b.ctype) !== null && _c !== void 0 ? _c : '';
|
|
391
|
+
let key = '';
|
|
392
|
+
if (ctype === 'PRIMARY KEY') {
|
|
393
|
+
key = 'PRI';
|
|
394
|
+
}
|
|
395
|
+
else if (ctype === 'UNIQUE') {
|
|
396
|
+
key = 'UNI';
|
|
397
|
+
}
|
|
398
|
+
const res = new resource_1.DbColumn(r.values.name, (0, resource_1.parseColumnType)(type_name), {
|
|
399
|
+
nullable: r.values.nullable === 1,
|
|
400
|
+
key,
|
|
401
|
+
default: r.values.col_default,
|
|
402
|
+
extra: r.values.is_identity === true ? 'identity' : '',
|
|
403
|
+
}, r.values.comment);
|
|
404
|
+
dbTable.addChild(res);
|
|
405
|
+
}
|
|
406
|
+
});
|
|
407
|
+
});
|
|
408
|
+
}
|
|
409
|
+
setUniqueKeys(dbSchema) {
|
|
410
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
411
|
+
const rdh = yield this.requestSql({
|
|
412
|
+
sql: `SELECT T.TABLE_NAME as table_name, STRING_AGG( CONVERT(VARCHAR(max), C.COLUMN_NAME), ',') AS columns, T.CONSTRAINT_NAME as index_name
|
|
413
|
+
FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS T
|
|
414
|
+
JOIN INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE C ON C.CONSTRAINT_NAME=T.CONSTRAINT_NAME
|
|
415
|
+
WHERE
|
|
416
|
+
LOWER(T.TABLE_SCHEMA)='${dbSchema.name.toLowerCase()}'
|
|
417
|
+
AND T.CONSTRAINT_TYPE = 'UNIQUE'
|
|
418
|
+
GROUP BY T.TABLE_NAME, T.CONSTRAINT_NAME `,
|
|
419
|
+
});
|
|
420
|
+
rdh.rows.forEach((row) => {
|
|
421
|
+
const tableName = row.values['table_name'];
|
|
422
|
+
const indexName = row.values['index_name'];
|
|
423
|
+
const columnNames = row.values['columns'];
|
|
424
|
+
const tableRes = dbSchema.getChildByName(tableName);
|
|
425
|
+
if (tableRes) {
|
|
426
|
+
if (tableRes.uniqueKeys === undefined) {
|
|
427
|
+
tableRes.uniqueKeys = [];
|
|
428
|
+
}
|
|
429
|
+
const constraint = {
|
|
430
|
+
name: indexName,
|
|
431
|
+
columns: columnNames.split(',').sort(),
|
|
432
|
+
};
|
|
433
|
+
tableRes.uniqueKeys.push(constraint);
|
|
434
|
+
if (constraint.columns.length > 1) {
|
|
435
|
+
constraint.columns.forEach((columnName) => {
|
|
436
|
+
const colRes = tableRes.getChildByName(columnName);
|
|
437
|
+
if (colRes) {
|
|
438
|
+
colRes['uniqKey'] = true;
|
|
439
|
+
}
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
});
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
setForinKeys(dbSchema) {
|
|
447
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
448
|
+
const rdh = yield this.requestSql({
|
|
449
|
+
sql: `SELECT
|
|
450
|
+
C.TABLE_NAME as table_name,
|
|
451
|
+
KCU.COLUMN_NAME as column_name,
|
|
452
|
+
C2.TABLE_NAME as referenced_table_name,
|
|
453
|
+
KCU2.COLUMN_NAME as referenced_column_name,
|
|
454
|
+
C.CONSTRAINT_NAME as constraint_name
|
|
455
|
+
FROM
|
|
456
|
+
INFORMATION_SCHEMA.TABLE_CONSTRAINTS C
|
|
457
|
+
INNER JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE KCU ON (C.CONSTRAINT_SCHEMA = KCU.CONSTRAINT_SCHEMA AND C.CONSTRAINT_NAME = KCU.CONSTRAINT_NAME)
|
|
458
|
+
INNER JOIN INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS RC ON (C.CONSTRAINT_SCHEMA = RC.CONSTRAINT_SCHEMA AND C.CONSTRAINT_NAME = RC.CONSTRAINT_NAME)
|
|
459
|
+
INNER JOIN INFORMATION_SCHEMA.TABLE_CONSTRAINTS C2 ON (RC.UNIQUE_CONSTRAINT_SCHEMA = C2.CONSTRAINT_SCHEMA AND RC.UNIQUE_CONSTRAINT_NAME = C2.CONSTRAINT_NAME)
|
|
460
|
+
INNER JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE KCU2 ON (C2.CONSTRAINT_SCHEMA = KCU2.CONSTRAINT_SCHEMA AND C2.CONSTRAINT_NAME = KCU2.CONSTRAINT_NAME AND KCU.ORDINAL_POSITION = KCU2.ORDINAL_POSITION)
|
|
461
|
+
WHERE
|
|
462
|
+
C.CONSTRAINT_TYPE = 'FOREIGN KEY'
|
|
463
|
+
AND LOWER(C.CONSTRAINT_SCHEMA) = '${dbSchema.name.toLowerCase()}'`,
|
|
464
|
+
});
|
|
465
|
+
rdh.rows.forEach((row) => {
|
|
466
|
+
const tableName = row.values['table_name'];
|
|
467
|
+
const columnName = row.values['column_name'];
|
|
468
|
+
const referencedTableName = row.values['referenced_table_name'];
|
|
469
|
+
const referencedColumnName = row.values['referenced_column_name'];
|
|
470
|
+
const constraintName = row.values['constraint_name'];
|
|
471
|
+
const tableRes = dbSchema.getChildByName(tableName);
|
|
472
|
+
if (tableRes) {
|
|
473
|
+
if (tableRes.getChildByName(columnName)) {
|
|
474
|
+
if (tableRes.foreignKeys === undefined) {
|
|
475
|
+
tableRes.foreignKeys = {};
|
|
476
|
+
}
|
|
477
|
+
if (tableRes.foreignKeys.referenceTo === undefined) {
|
|
478
|
+
tableRes.foreignKeys.referenceTo = {};
|
|
479
|
+
}
|
|
480
|
+
tableRes.foreignKeys.referenceTo[columnName] = {
|
|
481
|
+
tableName: referencedTableName,
|
|
482
|
+
columnName: referencedColumnName,
|
|
483
|
+
constraintName,
|
|
484
|
+
};
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
const tableRes2 = dbSchema.getChildByName(referencedTableName);
|
|
488
|
+
if (tableRes2) {
|
|
489
|
+
if (tableRes2.getChildByName(referencedColumnName)) {
|
|
490
|
+
if (tableRes2.foreignKeys === undefined) {
|
|
491
|
+
tableRes2.foreignKeys = {};
|
|
492
|
+
}
|
|
493
|
+
if (tableRes2.foreignKeys.referencedFrom === undefined) {
|
|
494
|
+
tableRes2.foreignKeys.referencedFrom = {};
|
|
495
|
+
}
|
|
496
|
+
tableRes2.foreignKeys.referencedFrom[referencedColumnName] = {
|
|
497
|
+
tableName: tableName,
|
|
498
|
+
columnName: columnName,
|
|
499
|
+
constraintName,
|
|
500
|
+
};
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
});
|
|
504
|
+
});
|
|
505
|
+
}
|
|
506
|
+
isPositionedParameterAvailable() {
|
|
507
|
+
return true;
|
|
508
|
+
}
|
|
509
|
+
getPositionalCharacter() {
|
|
510
|
+
return '@';
|
|
511
|
+
}
|
|
512
|
+
isLimitAsTop() {
|
|
513
|
+
return true;
|
|
514
|
+
}
|
|
515
|
+
closeSub() {
|
|
516
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
517
|
+
try {
|
|
518
|
+
if (this.con) {
|
|
519
|
+
yield this.con.close();
|
|
520
|
+
this.con = undefined;
|
|
521
|
+
}
|
|
522
|
+
return '';
|
|
523
|
+
}
|
|
524
|
+
catch (e) {
|
|
525
|
+
return e.message;
|
|
526
|
+
}
|
|
527
|
+
finally {
|
|
528
|
+
this.tran = undefined;
|
|
529
|
+
this.req = undefined;
|
|
530
|
+
}
|
|
531
|
+
});
|
|
532
|
+
}
|
|
533
|
+
createConnection() {
|
|
534
|
+
var _a, _b;
|
|
535
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
536
|
+
const options = {
|
|
537
|
+
port: this.conRes.port,
|
|
538
|
+
server: this.conRes.host,
|
|
539
|
+
user: this.conRes.user,
|
|
540
|
+
password: this.conRes.password,
|
|
541
|
+
database: this.conRes.database,
|
|
542
|
+
pool: {
|
|
543
|
+
min: 1,
|
|
544
|
+
max: 1,
|
|
545
|
+
},
|
|
546
|
+
options: {
|
|
547
|
+
encrypt: (_b = (_a = this.conRes.sqlServer) === null || _a === void 0 ? void 0 : _a.encrypt) !== null && _b !== void 0 ? _b : false,
|
|
548
|
+
},
|
|
549
|
+
};
|
|
550
|
+
const con = yield (0, mssql_1.connect)(options);
|
|
551
|
+
this.tran = undefined;
|
|
552
|
+
this.req = undefined;
|
|
553
|
+
return con;
|
|
554
|
+
});
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
exports.SQLServerDriver = SQLServerDriver;
|
|
558
|
+
//# sourceMappingURL=SQLServerDriver.js.map
|
|
@@ -0,0 +1 @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;CACF;AA/gBD,0CA+gBC"}
|
|
@@ -3,6 +3,7 @@ export * from './AwsDriver';
|
|
|
3
3
|
export * from './BaseDriver';
|
|
4
4
|
export * from './MySQLDriver';
|
|
5
5
|
export * from './PostgresDriver';
|
|
6
|
+
export * from './SQLServerDriver';
|
|
6
7
|
export * from './RedisDriver';
|
|
7
8
|
export * from './KeycloakDriver';
|
|
8
9
|
export * from './DBDriverResolver';
|
|
@@ -6,6 +6,7 @@ tslib_1.__exportStar(require("./AwsDriver"), exports);
|
|
|
6
6
|
tslib_1.__exportStar(require("./BaseDriver"), exports);
|
|
7
7
|
tslib_1.__exportStar(require("./MySQLDriver"), exports);
|
|
8
8
|
tslib_1.__exportStar(require("./PostgresDriver"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./SQLServerDriver"), exports);
|
|
9
10
|
tslib_1.__exportStar(require("./RedisDriver"), exports);
|
|
10
11
|
tslib_1.__exportStar(require("./KeycloakDriver"), exports);
|
|
11
12
|
tslib_1.__exportStar(require("./DBDriverResolver"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/drivers/index.ts"],"names":[],"mappings":";;;AAAA,wDAA8B;AAC9B,sDAA4B;AAC5B,uDAA6B;AAC7B,wDAA8B;AAC9B,2DAAiC;AACjC,wDAA8B;AAC9B,2DAAiC;AACjC,6DAAmC;AACnC,0DAAgC;AAChC,sDAA4B;AAC5B,oDAA0B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/drivers/index.ts"],"names":[],"mappings":";;;AAAA,wDAA8B;AAC9B,sDAA4B;AAC5B,uDAA6B;AAC7B,wDAA8B;AAC9B,2DAAiC;AACjC,4DAAkC;AAClC,wDAA8B;AAC9B,2DAAiC;AACjC,6DAAmC;AACnC,0DAAgC;AAChC,sDAA4B;AAC5B,oDAA0B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const types_1 = require("../types");
|
|
5
|
+
const drivers_1 = require("../drivers");
|
|
6
|
+
const resource_1 = require("../resource");
|
|
7
|
+
const connectOption = {
|
|
8
|
+
host: '127.0.0.1',
|
|
9
|
+
port: 6433,
|
|
10
|
+
user: 'testuser',
|
|
11
|
+
password: 'Pass123zxcv!',
|
|
12
|
+
database: 'testdb',
|
|
13
|
+
dbType: types_1.DBType.SQLServer,
|
|
14
|
+
name: 'mssql',
|
|
15
|
+
sqlServer: {
|
|
16
|
+
encrypt: false,
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
(() => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
20
|
+
const { ok, message, result } = yield drivers_1.DBDriverResolver.getInstance().workflow(connectOption, (driver) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
21
|
+
yield driver.getInfomationSchemas();
|
|
22
|
+
const rdh0 = yield driver.requestSql({
|
|
23
|
+
sql: 'SELECT TOP 100 * FROM schema1.DEPT',
|
|
24
|
+
});
|
|
25
|
+
console.log('----- rdh0 ----');
|
|
26
|
+
console.log(resource_1.ResultSetDataBuilder.from(rdh0).toMarkdown({
|
|
27
|
+
withType: true,
|
|
28
|
+
}));
|
|
29
|
+
return rdh0;
|
|
30
|
+
}));
|
|
31
|
+
console.log('ok', ok);
|
|
32
|
+
console.log('message', message);
|
|
33
|
+
console.log(result.meta);
|
|
34
|
+
}))();
|
|
35
|
+
//# sourceMappingURL=mssql.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mssql.js","sourceRoot":"","sources":["../../../src/examples/mssql.ts"],"names":[],"mappings":";;;AAUA,oCAAoE;AACpE,wCAA6D;AAC7D,0CAAmD;AAEnD,MAAM,aAAa,GAAsB;IACvC,IAAI,EAAE,WAAW;IACjB,IAAI,EAAE,IAAI;IACV,IAAI,EAAE,UAAU;IAChB,QAAQ,EAAE,cAAc;IACxB,QAAQ,EAAE,QAAQ;IAClB,MAAM,EAAE,cAAM,CAAC,SAAS;IACxB,IAAI,EAAE,OAAO;IACb,SAAS,EAAE;QAET,OAAO,EAAE,KAAK;KAEf;CACF,CAAC;AAQF,CAAC,GAAwB,EAAE;IACzB,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,GAC3B,MAAM,0BAAgB,CAAC,WAAW,EAAE,CAAC,QAAQ,CAC3C,aAAa,EACb,CAAO,MAAM,EAAE,EAAE;QACf,MAAM,MAAM,CAAC,oBAAoB,EAAE,CAAC;QAIpC,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,UAAU,CAAC;YACnC,GAAG,EAAE,oCAAoC;SAC1C,CAAC,CAAC;QACH,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;QAC/B,OAAO,CAAC,GAAG,CACT,+BAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC;YACzC,QAAQ,EAAE,IAAI;SACf,CAAC,CACH,CAAC;QAQF,OAAO,IAAI,CAAC;IAKd,CAAC,CAAA,CACF,CAAC;IAEJ,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IACtB,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAEhC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAC3B,CAAC,CAAA,CAAC,EAAE,CAAC"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const drivers_1 = require("../drivers");
|
|
5
|
+
const resource_1 = require("../resource");
|
|
5
6
|
const types_1 = require("../types");
|
|
6
7
|
const connectOption = {
|
|
7
8
|
host: '127.0.0.1',
|
|
@@ -15,9 +16,16 @@ const connectOption = {
|
|
|
15
16
|
(() => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
16
17
|
const { ok, message, result } = yield drivers_1.DBDriverResolver.getInstance().workflow(connectOption, (driver) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
17
18
|
yield driver.getInfomationSchemas();
|
|
19
|
+
const rdh0 = yield driver.requestSql({
|
|
20
|
+
sql: 'USE oradb',
|
|
21
|
+
});
|
|
22
|
+
console.log('----- rdh0 ----');
|
|
23
|
+
console.log(resource_1.ResultSetDataBuilder.from(rdh0).toString());
|
|
18
24
|
const rdh1 = yield driver.requestSql({
|
|
19
|
-
sql: 'select
|
|
25
|
+
sql: 'select * from EMP limit 1',
|
|
20
26
|
});
|
|
27
|
+
console.log('----- rdh1 ----');
|
|
28
|
+
console.log(resource_1.ResultSetDataBuilder.from(rdh1).toString());
|
|
21
29
|
return rdh1;
|
|
22
30
|
}));
|
|
23
31
|
console.log('ok', ok);
|