dbgate-api 5.1.2 → 5.1.3
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/package.json +4 -4
- package/src/currentVersion.js +2 -2
- package/src/proc/sessionProcess.js +16 -5
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dbgate-api",
|
|
3
3
|
"main": "src/index.js",
|
|
4
|
-
"version": "5.1.
|
|
4
|
+
"version": "5.1.3",
|
|
5
5
|
"homepage": "https://dbgate.org/",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"cors": "^2.8.5",
|
|
27
27
|
"cross-env": "^6.0.3",
|
|
28
28
|
"dbgate-query-splitter": "^4.9.0",
|
|
29
|
-
"dbgate-sqltree": "^5.1.
|
|
30
|
-
"dbgate-tools": "^5.1.
|
|
29
|
+
"dbgate-sqltree": "^5.1.3",
|
|
30
|
+
"dbgate-tools": "^5.1.3",
|
|
31
31
|
"debug": "^4.3.4",
|
|
32
32
|
"diff": "^5.0.0",
|
|
33
33
|
"diff2html": "^3.4.13",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"@types/fs-extra": "^9.0.11",
|
|
67
67
|
"@types/lodash": "^4.14.149",
|
|
68
|
-
"dbgate-types": "^5.1.
|
|
68
|
+
"dbgate-types": "^5.1.3",
|
|
69
69
|
"env-cmd": "^10.1.0",
|
|
70
70
|
"node-loader": "^1.0.2",
|
|
71
71
|
"nodemon": "^2.0.2",
|
package/src/currentVersion.js
CHANGED
|
@@ -101,8 +101,9 @@ class TableWriter {
|
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
class StreamHandler {
|
|
104
|
-
constructor(resultIndexHolder, resolve) {
|
|
104
|
+
constructor(resultIndexHolder, resolve, startLine) {
|
|
105
105
|
this.recordset = this.recordset.bind(this);
|
|
106
|
+
this.startLine = startLine;
|
|
106
107
|
this.row = this.row.bind(this);
|
|
107
108
|
// this.error = this.error.bind(this);
|
|
108
109
|
this.done = this.done.bind(this);
|
|
@@ -155,14 +156,21 @@ class StreamHandler {
|
|
|
155
156
|
this.resolve();
|
|
156
157
|
}
|
|
157
158
|
info(info) {
|
|
159
|
+
if (info && info.line != null) {
|
|
160
|
+
info = {
|
|
161
|
+
...info,
|
|
162
|
+
line: this.startLine + info.line,
|
|
163
|
+
};
|
|
164
|
+
}
|
|
158
165
|
process.send({ msgtype: 'info', info });
|
|
159
166
|
}
|
|
160
167
|
}
|
|
161
168
|
|
|
162
|
-
function handleStream(driver, resultIndexHolder,
|
|
169
|
+
function handleStream(driver, resultIndexHolder, sqlItem) {
|
|
163
170
|
return new Promise((resolve, reject) => {
|
|
164
|
-
const
|
|
165
|
-
|
|
171
|
+
const start = sqlItem.trimStart || sqlItem.start;
|
|
172
|
+
const handler = new StreamHandler(resultIndexHolder, resolve, start && start.line);
|
|
173
|
+
driver.stream(systemConnection, sqlItem.text, handler);
|
|
166
174
|
});
|
|
167
175
|
}
|
|
168
176
|
|
|
@@ -221,7 +229,10 @@ async function handleExecuteQuery({ sql }) {
|
|
|
221
229
|
const resultIndexHolder = {
|
|
222
230
|
value: 0,
|
|
223
231
|
};
|
|
224
|
-
for (const sqlItem of splitQuery(sql,
|
|
232
|
+
for (const sqlItem of splitQuery(sql, {
|
|
233
|
+
...driver.getQuerySplitterOptions('stream'),
|
|
234
|
+
returnRichInfo: true,
|
|
235
|
+
})) {
|
|
225
236
|
await handleStream(driver, resultIndexHolder, sqlItem);
|
|
226
237
|
// const handler = new StreamHandler(resultIndex);
|
|
227
238
|
// const stream = await driver.stream(systemConnection, sqlItem, handler);
|