@l-v-yonsama/multi-platform-database-drivers 0.1.9 → 0.1.11
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/README.md +6 -0
- package/built/src/db/DBError.js +1 -4
- package/built/src/db/DBError.js.map +1 -1
- package/built/src/db/drivers/AwsS3Driver.js +128 -430
- package/built/src/db/drivers/AwsS3Driver.js.map +1 -1
- package/built/src/db/drivers/BaseDriver.js +72 -81
- package/built/src/db/drivers/BaseDriver.js.map +1 -1
- package/built/src/db/drivers/MySQLDriver.js +198 -198
- package/built/src/db/drivers/MySQLDriver.js.map +1 -1
- package/built/src/db/drivers/PostgresDriver.js +183 -199
- package/built/src/db/drivers/PostgresDriver.js.map +1 -1
- package/built/src/db/drivers/RedisDriver.js +178 -171
- package/built/src/db/drivers/RedisDriver.js.map +1 -1
- package/built/src/db/drivers/index.js +5 -8
- package/built/src/db/drivers/index.js.map +1 -1
- package/built/src/db/index.js +3 -6
- package/built/src/db/index.js.map +1 -1
- package/built/src/db/resource/DbResource.js +43 -77
- package/built/src/db/resource/DbResource.js.map +1 -1
- package/built/src/db/resource/MultipleResultSetDataHolder.js +5 -9
- package/built/src/db/resource/MultipleResultSetDataHolder.js.map +1 -1
- package/built/src/db/resource/ResourceHelper.js +1 -6
- package/built/src/db/resource/ResourceHelper.js.map +1 -1
- package/built/src/db/resource/ResultSetDataHolder.d.ts +0 -11
- package/built/src/db/resource/ResultSetDataHolder.js +33 -84
- package/built/src/db/resource/ResultSetDataHolder.js.map +1 -1
- package/built/src/db/resource/index.js +5 -8
- package/built/src/db/resource/index.js.map +1 -1
- package/built/src/db/resource/types/DBType.js +3 -6
- package/built/src/db/resource/types/DBType.js.map +1 -1
- package/built/src/db/resource/types/GeneralColumnType.js +5 -28
- package/built/src/db/resource/types/GeneralColumnType.js.map +1 -1
- package/built/src/db/resource/types/MySQLColumnType.js +7 -17
- package/built/src/db/resource/types/MySQLColumnType.js.map +1 -1
- package/built/src/db/resource/types/ODBCVendorType.js +2 -5
- package/built/src/db/resource/types/ODBCVendorType.js.map +1 -1
- package/built/src/db/resource/types/PostgresColumnType.js +6 -11
- package/built/src/db/resource/types/PostgresColumnType.js.map +1 -1
- package/built/src/db/resource/types/RedisKeyType.js +5 -8
- package/built/src/db/resource/types/RedisKeyType.js.map +1 -1
- package/built/src/db/resource/types/ResourceType.js +2 -5
- package/built/src/db/resource/types/ResourceType.js.map +1 -1
- package/built/src/db/resource/types/index.js +7 -10
- package/built/src/db/resource/types/index.js.map +1 -1
- package/built/src/index.js +3 -6
- package/built/src/index.js.map +1 -1
- package/built/src/service/DBAccessService.js +269 -256
- package/built/src/service/DBAccessService.js.map +1 -1
- package/built/src/service/DBDriverResolver.js +32 -48
- package/built/src/service/DBDriverResolver.js.map +1 -1
- package/built/src/service/SQLService.js +3 -11
- package/built/src/service/SQLService.js.map +1 -1
- package/built/src/service/index.js +5 -8
- package/built/src/service/index.js.map +1 -1
- package/built/src/service/request/RedisRequest.js +2 -5
- package/built/src/service/request/RedisRequest.js.map +1 -1
- package/built/src/service/request/S3Request.js +2 -5
- package/built/src/service/request/S3Request.js.map +1 -1
- package/built/src/service/request/index.d.ts +0 -2
- package/built/src/service/request/index.js +2 -5
- package/built/src/service/request/index.js.map +1 -1
- package/built/src/service/response/GeneralDBResponse.js +1 -2
- package/built/src/service/response/GeneralResponse.js +1 -5
- package/built/src/service/response/GeneralResponse.js.map +1 -1
- package/built/src/service/response/index.js +2 -5
- package/built/src/service/response/index.js.map +1 -1
- package/built/src/service/response/reply/ConnectionResult.js +1 -2
- package/built/src/service/response/reply/FileExportReply.js +4 -7
- package/built/src/service/response/reply/FileExportReply.js.map +1 -1
- package/built/src/service/response/reply/FileProcessResult.js +3 -6
- package/built/src/service/response/reply/FileProcessResult.js.map +1 -1
- package/built/src/service/response/reply/GeneralReply.js +1 -4
- package/built/src/service/response/reply/GeneralReply.js.map +1 -1
- package/built/src/service/response/reply/OutputReply.js +4 -7
- package/built/src/service/response/reply/OutputReply.js.map +1 -1
- package/built/src/service/response/reply/ProgressReply.js +2 -5
- package/built/src/service/response/reply/ProgressReply.js.map +1 -1
- package/built/src/service/response/reply/types/FileExportType.js +2 -5
- package/built/src/service/response/reply/types/FileExportType.js.map +1 -1
- package/built/src/service/response/reply/types/OutputType.js +2 -5
- package/built/src/service/response/reply/types/OutputType.js.map +1 -1
- package/built/src/service/response/reply/types/ReplyEventType.js +2 -5
- package/built/src/service/response/reply/types/ReplyEventType.js.map +1 -1
- package/built/src/types/DateModifiedType.js +3 -6
- package/built/src/types/DateModifiedType.js.map +1 -1
- package/built/src/types/FileKindType.js +3 -6
- package/built/src/types/FileKindType.js.map +1 -1
- package/built/src/types/index.js +2 -5
- package/built/src/types/index.js.map +1 -1
- package/package.json +11 -8
|
@@ -1,224 +1,206 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const GeneralColumnType_1 = require("../resource/types/GeneralColumnType");
|
|
11
|
-
class PostgresDriver extends BaseDriver_1.default {
|
|
1
|
+
import { __awaiter } from "tslib";
|
|
2
|
+
import BaseDriver from './BaseDriver';
|
|
3
|
+
import ResultSetDataHolder, { RdhKey } from '../resource/ResultSetDataHolder';
|
|
4
|
+
import { DbDatabase, DbSchema, DbTable, DbColumn, } from '../resource/DbResource';
|
|
5
|
+
import { default as pg } from 'pg';
|
|
6
|
+
import { PostgresColumnType } from '../resource/types/PostgresColumnType';
|
|
7
|
+
import { EnumValues } from 'enum-values';
|
|
8
|
+
import { GeneralColumnType } from '../resource/types/GeneralColumnType';
|
|
9
|
+
export default class PostgresDriver extends BaseDriver {
|
|
12
10
|
constructor(conRes) {
|
|
13
11
|
super(conRes);
|
|
14
12
|
}
|
|
15
|
-
// name: 'name',
|
|
16
|
-
// tableID: 12822,
|
|
17
|
-
// columnID: 2,
|
|
18
|
-
// dataTypeID: 1043,
|
|
19
|
-
// dataTypeSize: -1,
|
|
20
|
-
// dataTypeModifier: -1,
|
|
21
|
-
// format: 'text' }
|
|
22
13
|
fieldInfo2Key(fieldInfo, resolver) {
|
|
23
14
|
if (fieldInfo.name.startsWith('c_')) {
|
|
24
15
|
console.log(`★ ${fieldInfo.name.substring(2).toUpperCase()} = ${fieldInfo.dataTypeID}`);
|
|
25
16
|
}
|
|
26
|
-
const name =
|
|
27
|
-
const key = new
|
|
17
|
+
const name = EnumValues.getNameFromValue(PostgresColumnType, PostgresColumnType.parse(fieldInfo.dataTypeID));
|
|
18
|
+
const key = new RdhKey(fieldInfo.name, GeneralColumnType.parse(name), super.resolveColumnComment(fieldInfo.name, resolver));
|
|
28
19
|
return key;
|
|
29
20
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
21
|
+
connectSub() {
|
|
22
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
let errorReason = '';
|
|
24
|
+
const options = Object.assign({
|
|
25
|
+
port: 5432,
|
|
26
|
+
host: '127.0.0.1',
|
|
27
|
+
database: 'postgres',
|
|
28
|
+
}, {
|
|
29
|
+
max: 1,
|
|
30
|
+
idleTimeoutMillis: 3000,
|
|
31
|
+
connectionTimeoutMillis: 1000,
|
|
32
|
+
port: this.conRes.port,
|
|
33
|
+
host: this.conRes.host,
|
|
34
|
+
user: this.conRes.user,
|
|
35
|
+
password: this.conRes.password,
|
|
36
|
+
database: this.conRes.database,
|
|
37
|
+
});
|
|
38
|
+
this.pool = new pg.Pool(options);
|
|
39
|
+
errorReason = yield this.test();
|
|
40
|
+
return errorReason;
|
|
45
41
|
});
|
|
46
|
-
this.pool = new pg_1.default.Pool(options);
|
|
47
|
-
// the pool with emit an error on behalf of any idle clients
|
|
48
|
-
// it contains if a backend error or network partition happens
|
|
49
|
-
// this.pool.on('error', (err, client) => {
|
|
50
|
-
// // log.error('Unexpected error on idle client', err);
|
|
51
|
-
// });
|
|
52
|
-
// this.pool.on('acquire', function (client) {
|
|
53
|
-
// // log.info('acquire', client);
|
|
54
|
-
// });
|
|
55
|
-
// this.pool.on('connect', function (client) {
|
|
56
|
-
// // log.info('connect', client);
|
|
57
|
-
// });
|
|
58
|
-
errorReason = await this.test();
|
|
59
|
-
return errorReason;
|
|
60
42
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
43
|
+
test(with_connect = false) {
|
|
44
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
+
let errorReason = '';
|
|
46
|
+
try {
|
|
47
|
+
if (with_connect) {
|
|
48
|
+
errorReason = yield this.connect();
|
|
49
|
+
}
|
|
50
|
+
const rdh = yield this.requestSql('SELECT NOW()');
|
|
51
|
+
if (rdh && rdh.errorMessage) {
|
|
52
|
+
errorReason = rdh.errorMessage;
|
|
53
|
+
}
|
|
66
54
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
errorReason = rdh.errorMessage;
|
|
55
|
+
catch (e) {
|
|
56
|
+
errorReason = e.message;
|
|
70
57
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
finally {
|
|
76
|
-
if (with_connect) {
|
|
77
|
-
await this.disconnect();
|
|
58
|
+
finally {
|
|
59
|
+
if (with_connect) {
|
|
60
|
+
yield this.disconnect();
|
|
61
|
+
}
|
|
78
62
|
}
|
|
79
|
-
|
|
80
|
-
|
|
63
|
+
return errorReason;
|
|
64
|
+
});
|
|
81
65
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
66
|
+
requestSql(sql, options) {
|
|
67
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
68
|
+
let rdh = new ResultSetDataHolder([]);
|
|
69
|
+
try {
|
|
70
|
+
let binds = [];
|
|
71
|
+
if (options && options.binds) {
|
|
72
|
+
binds = options.binds;
|
|
73
|
+
}
|
|
74
|
+
const results = yield this.pool.query(sql, binds);
|
|
75
|
+
if (results) {
|
|
76
|
+
let resolver;
|
|
77
|
+
if (options && options.needs_column_resolve === true) {
|
|
78
|
+
resolver = this.createColumnResolver(sql);
|
|
79
|
+
}
|
|
80
|
+
const fields = results.fields;
|
|
81
|
+
rdh = new ResultSetDataHolder(fields === undefined
|
|
82
|
+
? []
|
|
83
|
+
: fields.map((f) => this.fieldInfo2Key(f, resolver)));
|
|
84
|
+
if (results.rows) {
|
|
85
|
+
results.rows.forEach((result) => {
|
|
86
|
+
rdh.addRow(result);
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
90
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
91
|
+
catch (err) {
|
|
92
|
+
rdh = ResultSetDataHolder.create(err);
|
|
93
|
+
}
|
|
94
|
+
return rdh;
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
countTables(tables, options) {
|
|
98
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
99
|
+
const list = new Array();
|
|
100
|
+
let counter = 1;
|
|
101
|
+
for (const st of tables.list) {
|
|
102
|
+
let prefix = '';
|
|
103
|
+
if (st.schema) {
|
|
104
|
+
prefix = st.schema + '.';
|
|
105
|
+
}
|
|
106
|
+
if (options && options.progress_callback) {
|
|
107
|
+
if (counter % 5 === 0) {
|
|
108
|
+
options.progress_callback(`Count ${prefix}${st.table}`, 70);
|
|
109
|
+
}
|
|
107
110
|
}
|
|
108
|
-
const
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
111
|
+
const sql = `SELECT COUNT(*) as count FROM ${prefix}${st.table}`;
|
|
112
|
+
try {
|
|
113
|
+
const results = yield this.pool.query(sql, []);
|
|
114
|
+
if (results && results.rows && results.rows.length > 0) {
|
|
115
|
+
const row = results.rows[0];
|
|
116
|
+
const obj = Object.assign({ count: row.count }, st);
|
|
117
|
+
list.push(obj);
|
|
118
|
+
}
|
|
116
119
|
}
|
|
120
|
+
catch (e) { }
|
|
121
|
+
counter++;
|
|
117
122
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
rdh = ResultSetDataHolder_1.default.create(err);
|
|
121
|
-
}
|
|
122
|
-
return rdh;
|
|
123
|
+
return list;
|
|
124
|
+
});
|
|
123
125
|
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
let prefix = '';
|
|
129
|
-
if (st.schema) {
|
|
130
|
-
prefix = st.schema + '.';
|
|
126
|
+
getInfomationSchemas(options) {
|
|
127
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
128
|
+
if (!this.conRes) {
|
|
129
|
+
return [];
|
|
131
130
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
131
|
+
const dbResources = new Array();
|
|
132
|
+
const db_list = yield this.asyncGetDatabases(this.conRes.database);
|
|
133
|
+
db_list.forEach((db) => dbResources.push(db));
|
|
134
|
+
const dbDatabase = db_list.find((d) => d.name === this.conRes.database);
|
|
135
|
+
const dbSchemas = yield this.getSchemas(dbDatabase);
|
|
136
|
+
dbSchemas.forEach((res) => {
|
|
137
|
+
dbDatabase.addChild(res);
|
|
138
|
+
});
|
|
139
|
+
this.resetDefaultSchema(dbDatabase);
|
|
140
|
+
for (const dbSchema of dbSchemas) {
|
|
141
|
+
const dbTables = yield this.getTables(dbSchema);
|
|
142
|
+
dbTables.forEach((res) => dbSchema.addChild(res));
|
|
136
143
|
}
|
|
137
|
-
const
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
const row = results.rows[0];
|
|
142
|
-
const obj = Object.assign({ count: row.count }, st);
|
|
143
|
-
list.push(obj);
|
|
144
|
+
for (const dbSchema of dbSchemas) {
|
|
145
|
+
for (const dbTable of dbSchema.getChildren()) {
|
|
146
|
+
const dbColumns = yield this.getColumns(dbTable);
|
|
147
|
+
dbColumns.forEach((res) => dbTable.addChild(res));
|
|
144
148
|
}
|
|
145
|
-
// eslint-disable-next-line no-empty
|
|
146
149
|
}
|
|
147
|
-
|
|
148
|
-
counter++;
|
|
149
|
-
}
|
|
150
|
-
return list;
|
|
151
|
-
}
|
|
152
|
-
async getInfomationSchemas(options) {
|
|
153
|
-
if (!this.conRes) {
|
|
154
|
-
return [];
|
|
155
|
-
}
|
|
156
|
-
const dbResources = new Array();
|
|
157
|
-
const db_list = await this.asyncGetDatabases(this.conRes.database);
|
|
158
|
-
db_list.forEach((db) => dbResources.push(db));
|
|
159
|
-
const dbDatabase = db_list.find((d) => d.name === this.conRes.database);
|
|
160
|
-
const dbSchemas = await this.getSchemas(dbDatabase);
|
|
161
|
-
dbSchemas.forEach((res) => {
|
|
162
|
-
dbDatabase.addChild(res);
|
|
150
|
+
return dbResources;
|
|
163
151
|
});
|
|
164
|
-
this.resetDefaultSchema(dbDatabase);
|
|
165
|
-
// const parallels = [];
|
|
166
|
-
for (const dbSchema of dbSchemas) {
|
|
167
|
-
const dbTables = await this.getTables(dbSchema);
|
|
168
|
-
dbTables.forEach((res) => dbSchema.addChild(res));
|
|
169
|
-
}
|
|
170
|
-
for (const dbSchema of dbSchemas) {
|
|
171
|
-
for (const dbTable of dbSchema.getChildren()) {
|
|
172
|
-
const dbColumns = await this.getColumns(dbTable);
|
|
173
|
-
dbColumns.forEach((res) => dbTable.addChild(res));
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
return dbResources;
|
|
177
152
|
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
153
|
+
asyncGetDatabases(connection_database) {
|
|
154
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
155
|
+
const rdh = yield this
|
|
156
|
+
.requestSql(`SELECT datname AS name, pg_encoding_to_char(encoding) AS comment
|
|
181
157
|
FROM pg_database ORDER BY datname`);
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
158
|
+
return rdh.rows.map((r) => {
|
|
159
|
+
const res = new DbDatabase(r.values.name);
|
|
160
|
+
res.comment = r.values.comment;
|
|
161
|
+
res.disabled = res.name !== connection_database;
|
|
162
|
+
return res;
|
|
163
|
+
});
|
|
187
164
|
});
|
|
188
165
|
}
|
|
189
|
-
|
|
190
|
-
|
|
166
|
+
getSchemas(dbDatabase) {
|
|
167
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
168
|
+
const rdh = yield this.requestSql(`SELECT SCHEMA_NAME AS name
|
|
191
169
|
FROM INFORMATION_SCHEMA.SCHEMATA
|
|
192
170
|
WHERE LOWER(SCHEMA_NAME) NOT IN ('information_schema', 'sys', 'performance_schema', 'pg_catalog', 'pg_toast', 'pg_temp_1', 'pg_toast_temp_1')
|
|
193
171
|
ORDER BY name`);
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
172
|
+
return rdh.rows.map((r) => {
|
|
173
|
+
const res = new DbSchema(r.values.name);
|
|
174
|
+
return res;
|
|
175
|
+
});
|
|
197
176
|
});
|
|
198
177
|
}
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
178
|
+
getTables(dbSchema) {
|
|
179
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
180
|
+
let rdh = yield this
|
|
181
|
+
.requestSql(`select quote_ident(m.relname) as qname, COALESCE(d.description, '') as comment
|
|
202
182
|
from pg_stat_all_tables as m
|
|
203
183
|
LEFT JOIN pg_description as d ON (m.relid = d.objoid AND d.objsubid=0)
|
|
204
184
|
WHERE m.schemaname='${dbSchema.getName()}'
|
|
205
185
|
ORDER BY m.relname`);
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
186
|
+
const list = rdh.rows.map((r) => {
|
|
187
|
+
const res = new DbTable(r.values.qname, 'TABLE', r.values.comment);
|
|
188
|
+
return res;
|
|
189
|
+
});
|
|
190
|
+
rdh = yield this
|
|
191
|
+
.requestSql(`select quote_ident(viewname) as qname, definition from pg_catalog.pg_views
|
|
212
192
|
where schemaname = '${dbSchema.getName()}'
|
|
213
193
|
order by viewname`);
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
194
|
+
return list.concat(rdh.rows.map((r) => {
|
|
195
|
+
const res = new DbTable(r.values.qname, 'VIEW', '');
|
|
196
|
+
return res;
|
|
197
|
+
}));
|
|
198
|
+
});
|
|
218
199
|
}
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
200
|
+
getColumns(dbTable) {
|
|
201
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
202
|
+
const binds = [dbTable.getParent().getName(), dbTable.getName()];
|
|
203
|
+
const rdh = yield this.requestSql(`select
|
|
222
204
|
col.COLUMN_NAME as name,
|
|
223
205
|
quote_ident(col.COLUMN_NAME) as qname,
|
|
224
206
|
data_type as col_type,
|
|
@@ -271,28 +253,30 @@ class PostgresDriver extends BaseDriver_1.default {
|
|
|
271
253
|
col.table_schema = $1 AND quote_ident(col.table_name) = $2
|
|
272
254
|
order by
|
|
273
255
|
col.ordinal_position`, { binds });
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
256
|
+
return rdh.rows.map((r) => {
|
|
257
|
+
const type_name = EnumValues.getNameFromValue(PostgresColumnType, PostgresColumnType.parse(r.values.col_type));
|
|
258
|
+
const res = new DbColumn(r.values.qname, GeneralColumnType.parse(type_name), {
|
|
259
|
+
nullable: r.values.nullable === 1,
|
|
260
|
+
key: r.values.col_key,
|
|
261
|
+
default: r.values.col_default,
|
|
262
|
+
extra: r.values.col_extra,
|
|
263
|
+
}, r.values.comment);
|
|
264
|
+
return res;
|
|
265
|
+
});
|
|
283
266
|
});
|
|
284
267
|
}
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
268
|
+
closeSub() {
|
|
269
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
270
|
+
try {
|
|
271
|
+
if (this.pool) {
|
|
272
|
+
yield this.pool.end();
|
|
273
|
+
}
|
|
274
|
+
return '';
|
|
289
275
|
}
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
}
|
|
276
|
+
catch (e) {
|
|
277
|
+
return e.message;
|
|
278
|
+
}
|
|
279
|
+
});
|
|
295
280
|
}
|
|
296
281
|
}
|
|
297
|
-
exports.default = PostgresDriver;
|
|
298
282
|
//# sourceMappingURL=PostgresDriver.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PostgresDriver.js","sourceRoot":"","sources":["../../../../src/db/drivers/PostgresDriver.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PostgresDriver.js","sourceRoot":"","sources":["../../../../src/db/drivers/PostgresDriver.ts"],"names":[],"mappings":";AACA,OAAO,UAAiC,MAAM,cAAc,CAAC;AAC7D,OAAO,mBAAmB,EAAE,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,EAGL,UAAU,EACV,QAAQ,EACR,OAAO,EACP,QAAQ,GAIT,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,OAAO,IAAI,EAAE,EAAE,MAAM,IAAI,CAAC;AACnC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa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