@cubejs-backend/mssql-driver 0.33.11 → 0.33.16
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/CHANGELOG.md +11 -0
- package/driver/MSSqlDriver.js +6 -6
- package/driver/QueryStream.js +20 -19
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [0.33.16](https://github.com/cube-js/cube/compare/v0.33.15...v0.33.16) (2023-05-28)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **mssql-driver:** Pre-aggregations builds hang up if over 10K of rows ([#6661](https://github.com/cube-js/cube/issues/6661)) ([9b20ff4](https://github.com/cube-js/cube/commit/9b20ff4ef78acbb65ebea80adceb227bf96b1727))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [0.33.11](https://github.com/cube-js/cube/compare/v0.33.10...v0.33.11) (2023-05-22)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @cubejs-backend/mssql-driver
|
package/driver/MSSqlDriver.js
CHANGED
|
@@ -58,7 +58,7 @@ class MSSqlDriver extends BaseDriver {
|
|
|
58
58
|
user: getEnv('dbUser', { dataSource }),
|
|
59
59
|
password: getEnv('dbPass', { dataSource }),
|
|
60
60
|
domain: getEnv('dbDomain', { dataSource }),
|
|
61
|
-
requestTimeout:
|
|
61
|
+
requestTimeout: getEnv('dbQueryTimeout') * 1000,
|
|
62
62
|
options: {
|
|
63
63
|
encrypt: getEnv('dbSsl', { dataSource }),
|
|
64
64
|
useUTC: false
|
|
@@ -168,7 +168,7 @@ class MSSqlDriver extends BaseDriver {
|
|
|
168
168
|
case sql.Money:
|
|
169
169
|
case sql.SmallMoney:
|
|
170
170
|
case sql.Numeric:
|
|
171
|
-
type = '
|
|
171
|
+
type = 'decimal';
|
|
172
172
|
break;
|
|
173
173
|
// double
|
|
174
174
|
case sql.Float:
|
|
@@ -186,16 +186,16 @@ class MSSqlDriver extends BaseDriver {
|
|
|
186
186
|
break;
|
|
187
187
|
// date and time
|
|
188
188
|
case sql.Time:
|
|
189
|
-
type = '
|
|
189
|
+
type = 'time';
|
|
190
190
|
break;
|
|
191
191
|
case sql.Date:
|
|
192
|
-
type = '
|
|
192
|
+
type = 'timestamp';
|
|
193
193
|
break;
|
|
194
194
|
case sql.DateTime:
|
|
195
195
|
case sql.DateTime2:
|
|
196
196
|
case sql.SmallDateTime:
|
|
197
197
|
case sql.DateTimeOffset:
|
|
198
|
-
type = '
|
|
198
|
+
type = 'timestamp';
|
|
199
199
|
break;
|
|
200
200
|
// others
|
|
201
201
|
case sql.UniqueIdentifier:
|
|
@@ -213,7 +213,7 @@ class MSSqlDriver extends BaseDriver {
|
|
|
213
213
|
type = 'string';
|
|
214
214
|
break;
|
|
215
215
|
}
|
|
216
|
-
return { name: fields[field].name, type };
|
|
216
|
+
return { name: fields[field].name, type: this.toGenericType(type) };
|
|
217
217
|
});
|
|
218
218
|
}
|
|
219
219
|
|
package/driver/QueryStream.js
CHANGED
|
@@ -6,8 +6,7 @@ const { getEnv } = require('@cubejs-backend/shared');
|
|
|
6
6
|
*/
|
|
7
7
|
class QueryStream extends Readable {
|
|
8
8
|
request = null;
|
|
9
|
-
|
|
10
|
-
done = false;
|
|
9
|
+
toRead = 0;
|
|
11
10
|
|
|
12
11
|
/**
|
|
13
12
|
* @constructor
|
|
@@ -19,32 +18,34 @@ class QueryStream extends Readable {
|
|
|
19
18
|
highWaterMark || getEnv('dbQueryStreamHighWaterMark'),
|
|
20
19
|
});
|
|
21
20
|
this.request = request;
|
|
22
|
-
this.request.on('row',
|
|
23
|
-
this.
|
|
24
|
-
|
|
21
|
+
this.request.on('row', row => {
|
|
22
|
+
this.transformRow(row);
|
|
23
|
+
const canAdd = this.push(row);
|
|
24
|
+
if (this.toRead-- <= 0 || !canAdd) {
|
|
25
25
|
this.request.pause();
|
|
26
26
|
}
|
|
27
|
-
})
|
|
27
|
+
})
|
|
28
|
+
this.request.on('done', () => {
|
|
29
|
+
this.push(null);
|
|
30
|
+
})
|
|
28
31
|
this.request.on('error', (err) => {
|
|
29
32
|
this.destroy(err);
|
|
30
33
|
});
|
|
31
|
-
this.request.on('done', () => {
|
|
32
|
-
this.done = true;
|
|
33
|
-
});
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
37
|
* @override
|
|
38
38
|
*/
|
|
39
|
-
_read(
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
39
|
+
_read(toRead) {
|
|
40
|
+
this.toRead += toRead;
|
|
41
|
+
this.request.resume();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
transformRow(row) {
|
|
45
|
+
for (const key in row) {
|
|
46
|
+
if (row.hasOwnProperty(key) && row[key] && row[key] instanceof Date) {
|
|
47
|
+
row[key] = row[key].toJSON();
|
|
48
|
+
}
|
|
48
49
|
}
|
|
49
50
|
}
|
|
50
51
|
|
|
@@ -52,8 +53,8 @@ class QueryStream extends Readable {
|
|
|
52
53
|
* @override
|
|
53
54
|
*/
|
|
54
55
|
_destroy(error, callback) {
|
|
56
|
+
this.request.cancel();
|
|
55
57
|
this.request = null;
|
|
56
|
-
this.recordset = null;
|
|
57
58
|
callback(error);
|
|
58
59
|
}
|
|
59
60
|
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@cubejs-backend/mssql-driver",
|
|
3
3
|
"description": "Cube.js MS SQL database driver",
|
|
4
4
|
"author": "Cube Dev, Inc.",
|
|
5
|
-
"version": "0.33.
|
|
5
|
+
"version": "0.33.16",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "https://github.com/cube-js/cube.git",
|
|
@@ -20,5 +20,5 @@
|
|
|
20
20
|
"publishConfig": {
|
|
21
21
|
"access": "public"
|
|
22
22
|
},
|
|
23
|
-
"gitHead": "
|
|
23
|
+
"gitHead": "a30fe6b716e211104addbf1ce840a275c8fef50d"
|
|
24
24
|
}
|