mysql2 3.9.0 → 3.9.2
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/lib/commands/query.js
CHANGED
|
@@ -30,7 +30,7 @@ class Query extends Command {
|
|
|
30
30
|
this._receivedFieldsCount = 0;
|
|
31
31
|
this._resultIndex = 0;
|
|
32
32
|
this._localStream = null;
|
|
33
|
-
this._unpipeStream = function() {};
|
|
33
|
+
this._unpipeStream = function () { };
|
|
34
34
|
this._streamFactory = options.infileStreamFactory;
|
|
35
35
|
this._connection = null;
|
|
36
36
|
}
|
|
@@ -155,7 +155,7 @@ class Query extends Command {
|
|
|
155
155
|
const onPause = () => {
|
|
156
156
|
this._localStream.pause();
|
|
157
157
|
};
|
|
158
|
-
const onData = function(data) {
|
|
158
|
+
const onData = function (data) {
|
|
159
159
|
const dataWithHeader = Buffer.allocUnsafe(data.length + 4);
|
|
160
160
|
data.copy(dataWithHeader, 4);
|
|
161
161
|
connection.writePacket(
|
|
@@ -227,7 +227,7 @@ class Query extends Command {
|
|
|
227
227
|
}
|
|
228
228
|
|
|
229
229
|
/* eslint no-unused-vars: ["error", { "argsIgnorePattern": "^_" }] */
|
|
230
|
-
row(packet, _connection) {
|
|
230
|
+
row(packet, _connection) {
|
|
231
231
|
if (packet.isEOF()) {
|
|
232
232
|
const status = packet.eofStatusFlags();
|
|
233
233
|
const moreResults = status & ServerStatus.SERVER_MORE_RESULTS_EXISTS;
|
|
@@ -279,11 +279,13 @@ class Query extends Command {
|
|
|
279
279
|
});
|
|
280
280
|
this.on('end', () => {
|
|
281
281
|
stream.push(null); // pushing null, indicating EOF
|
|
282
|
-
setImmediate(() => stream.emit('close')); // notify readers that query has completed
|
|
283
282
|
});
|
|
284
283
|
this.on('fields', fields => {
|
|
285
284
|
stream.emit('fields', fields); // replicate old emitter
|
|
286
285
|
});
|
|
286
|
+
stream.on('end', () => {
|
|
287
|
+
stream.emit('close');
|
|
288
|
+
});
|
|
287
289
|
return stream;
|
|
288
290
|
}
|
|
289
291
|
|
|
@@ -302,7 +304,7 @@ class Query extends Command {
|
|
|
302
304
|
Timers.clearTimeout(this.queryTimeout);
|
|
303
305
|
this.queryTimeout = null;
|
|
304
306
|
}
|
|
305
|
-
|
|
307
|
+
|
|
306
308
|
const err = new Error('Query inactivity timeout');
|
|
307
309
|
err.errorno = 'PROTOCOL_SEQUENCE_TIMEOUT';
|
|
308
310
|
err.code = 'PROTOCOL_SEQUENCE_TIMEOUT';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mysql2",
|
|
3
|
-
"version": "3.9.
|
|
3
|
+
"version": "3.9.2",
|
|
4
4
|
"description": "fast mysql driver. Implements core protocol, prepared statements, ssl and compression in native JS",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"typings": "typings/mysql/index",
|
|
@@ -82,7 +82,6 @@
|
|
|
82
82
|
"prettier": "^3.0.0",
|
|
83
83
|
"progress": "^2.0.3",
|
|
84
84
|
"typescript": "^5.0.2",
|
|
85
|
-
"urun": "0.0.8",
|
|
86
85
|
"utest": "0.0.8"
|
|
87
86
|
}
|
|
88
87
|
}
|
|
@@ -1,3 +1,18 @@
|
|
|
1
1
|
import { setMaxParserCache, clearParserCache } from './ParserCache.js';
|
|
2
|
+
import {
|
|
3
|
+
TypeCast,
|
|
4
|
+
Field as TypeCastField,
|
|
5
|
+
Geometry as TypeCastGeometry,
|
|
6
|
+
Next as TypeCastNext,
|
|
7
|
+
Type as TypeCastType,
|
|
8
|
+
} from './typeCast.js';
|
|
2
9
|
|
|
3
|
-
export {
|
|
10
|
+
export {
|
|
11
|
+
setMaxParserCache,
|
|
12
|
+
clearParserCache,
|
|
13
|
+
TypeCast,
|
|
14
|
+
TypeCastField,
|
|
15
|
+
TypeCastGeometry,
|
|
16
|
+
TypeCastNext,
|
|
17
|
+
TypeCastType,
|
|
18
|
+
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
type Geometry = {
|
|
1
|
+
export type Geometry = {
|
|
2
2
|
x: number;
|
|
3
3
|
y: number;
|
|
4
4
|
};
|
|
5
5
|
|
|
6
|
-
type Type = {
|
|
6
|
+
export type Type = {
|
|
7
7
|
type:
|
|
8
8
|
| 'DECIMAL'
|
|
9
9
|
| 'TINY'
|
|
@@ -38,16 +38,16 @@ type Type = {
|
|
|
38
38
|
| 'GEOMETRY';
|
|
39
39
|
};
|
|
40
40
|
|
|
41
|
-
type Field = Type & {
|
|
41
|
+
export type Field = Type & {
|
|
42
42
|
length: number;
|
|
43
43
|
db: string;
|
|
44
44
|
table: string;
|
|
45
45
|
name: string;
|
|
46
|
-
string: () => string | null;
|
|
46
|
+
string: (encoding?: BufferEncoding | string | undefined) => string | null;
|
|
47
47
|
buffer: () => Buffer | null;
|
|
48
48
|
geometry: () => Geometry | Geometry[] | null;
|
|
49
49
|
};
|
|
50
50
|
|
|
51
|
-
type Next = () => void;
|
|
51
|
+
export type Next = () => void;
|
|
52
52
|
|
|
53
53
|
export type TypeCast = ((field: Field, next: Next) => any) | boolean;
|
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
length: number;
|
|
10
|
-
string: () => any;
|
|
11
|
-
buffer: () => any;
|
|
12
|
-
geometry: () => any;
|
|
13
|
-
}
|
|
1
|
+
// TODO (major version): remove workaround for `Field` compatibility.
|
|
2
|
+
import { TypeCastField } from '../../../lib/parsers/index.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated
|
|
6
|
+
* `Field` is deprecated and might be removed in the future major release. Please use `TypeCastField` type instead.
|
|
7
|
+
*/
|
|
8
|
+
declare interface Field extends TypeCastField {}
|
|
14
9
|
|
|
15
10
|
export { Field };
|