mysql2 3.22.5 → 3.22.6
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/base/connection.js +2 -2
- package/lib/commands/client_handshake.js +1 -1
- package/lib/commands/execute.js +1 -1
- package/lib/commands/ping.js +1 -1
- package/lib/packets/binary_row.js +2 -2
- package/lib/packets/binlog_query_statusvars.js +1 -1
- package/lib/packets/packet.js +2 -2
- package/lib/packets/resultset_header.js +1 -1
- package/lib/packets/text_row.js +1 -1
- package/package.json +3 -3
package/lib/base/connection.js
CHANGED
|
@@ -186,7 +186,7 @@ class BaseConnection extends EventEmitter {
|
|
|
186
186
|
});
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
|
-
// in case there was no initial handshake but we need to read
|
|
189
|
+
// in case there was no initial handshake but we need to read string, assume it utf-8
|
|
190
190
|
// most common example: "Too many connections" error ( packet is sent immediately on connection attempt, we don't know server encoding yet)
|
|
191
191
|
// will be overwritten with actual encoding value as soon as server handshake packet is received
|
|
192
192
|
this.serverEncoding = 'utf8';
|
|
@@ -285,7 +285,7 @@ class BaseConnection extends EventEmitter {
|
|
|
285
285
|
bubbleErrorToConnection = true;
|
|
286
286
|
}
|
|
287
287
|
}
|
|
288
|
-
// notify connection if some
|
|
288
|
+
// notify connection if some commands in the queue did not have callbacks
|
|
289
289
|
// or if this is pool connection ( so it can be removed from pool )
|
|
290
290
|
if (bubbleErrorToConnection || this._pool) {
|
|
291
291
|
this.emit('error', err);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// This file was modified by Oracle on June 17, 2021.
|
|
2
|
-
// Handshake errors are now
|
|
2
|
+
// Handshake errors are now marked as fatal and the corresponding events are
|
|
3
3
|
// emitted in the command instance itself.
|
|
4
4
|
// Modifications copyright (c) 2021, Oracle and/or its affiliates.
|
|
5
5
|
|
package/lib/commands/execute.js
CHANGED
|
@@ -72,7 +72,7 @@ class Execute extends Command {
|
|
|
72
72
|
// disabling for now, but would be great to find reliable way to parse fields only once
|
|
73
73
|
// fields reported by prepare can be empty at all or just incorrect - see #169
|
|
74
74
|
//
|
|
75
|
-
//
|
|
75
|
+
// performance optimisation: if we already have this field parsed in statement header, use one from header
|
|
76
76
|
// const field = this.statement.columns.length == this._fieldCount ?
|
|
77
77
|
// this.statement.columns[this._receivedFieldsCount] : new Packets.ColumnDefinition(packet);
|
|
78
78
|
const field = new Packets.ColumnDefinition(
|
package/lib/commands/ping.js
CHANGED
|
@@ -5,7 +5,7 @@ const CommandCode = require('../constants/commands');
|
|
|
5
5
|
const Packet = require('../packets/packet');
|
|
6
6
|
|
|
7
7
|
// TODO: time statistics?
|
|
8
|
-
//
|
|
8
|
+
// useful for queue size and network latency monitoring
|
|
9
9
|
// store created,sent,reply timestamps
|
|
10
10
|
class Ping extends Command {
|
|
11
11
|
constructor(callback) {
|
|
@@ -12,7 +12,7 @@ class BinaryRow {
|
|
|
12
12
|
|
|
13
13
|
static toPacket(columns, encoding) {
|
|
14
14
|
// throw new Error('Not implemented');
|
|
15
|
-
const sequenceId = 0; // TODO remove, this is calculated now in
|
|
15
|
+
const sequenceId = 0; // TODO remove, this is calculated now in connection
|
|
16
16
|
let length = 0;
|
|
17
17
|
columns.forEach((val) => {
|
|
18
18
|
if (val === null || typeof val === 'undefined') {
|
|
@@ -82,7 +82,7 @@ binaryReader[2] = Packet.prototype.readInt16; // short
|
|
|
82
82
|
binaryReader[3] = Packet.prototype.readInt32; // long
|
|
83
83
|
binaryReader[4] = Packet.prototype.readFloat; // float
|
|
84
84
|
binaryReader[5] = Packet.prototype.readDouble; // double
|
|
85
|
-
binaryReader[6] = Packet.prototype.assertInvalid; // null, should be skipped
|
|
85
|
+
binaryReader[6] = Packet.prototype.assertInvalid; // null, should be skipped via null bitmap
|
|
86
86
|
binaryReader[7] = Packet.prototype.readTimestamp; // timestamp, http://dev.mysql.com/doc/internals/en/prepared-statements.html#packet-ProtocolBinary::MYSQL_TYPE_TIMESTAMP
|
|
87
87
|
binaryReader[8] = Packet.prototype.readInt64; // long long
|
|
88
88
|
binaryReader[9] = Packet.prototype.readInt32; // int24
|
|
@@ -31,7 +31,7 @@ module.exports = function parseStatusVars(buffer) {
|
|
|
31
31
|
offset += 4;
|
|
32
32
|
break;
|
|
33
33
|
case keys.SQL_MODE:
|
|
34
|
-
// value is 8 bytes, but all
|
|
34
|
+
// value is 8 bytes, but all documented flags are in first 4 bytes
|
|
35
35
|
result.sqlMode = buffer.readUInt32LE(offset);
|
|
36
36
|
offset += 8;
|
|
37
37
|
break;
|
package/lib/packets/packet.js
CHANGED
|
@@ -32,8 +32,8 @@ function leftPad(num, value) {
|
|
|
32
32
|
// In my benchmarks the difference is ~25M 8-digit numbers per second vs
|
|
33
33
|
// 4.5 M using Number(packet.readLengthCodedString())
|
|
34
34
|
// not used when size is close to max precision as series of *10 accumulate error
|
|
35
|
-
// and approximate result
|
|
36
|
-
// In the
|
|
35
|
+
// and approximate result might be different from (approximate as well) Number(bigNumStringValue))
|
|
36
|
+
// In the future node version if speed difference is smaller parse* functions might be removed
|
|
37
37
|
// don't consider them as Packet public API
|
|
38
38
|
|
|
39
39
|
const minus = '-'.charCodeAt(0);
|
|
@@ -65,7 +65,7 @@ class ResultSetHeader {
|
|
|
65
65
|
if (key === 'character_set_client') {
|
|
66
66
|
const charsetNumber = EncodingToCharset[val];
|
|
67
67
|
// TODO - better api for driver users to handle unknown encodings?
|
|
68
|
-
// maybe custom
|
|
68
|
+
// maybe custom converter in the config?
|
|
69
69
|
// For now just ignore character_set_client command if there is
|
|
70
70
|
// no known mapping from reported encoding to a charset code
|
|
71
71
|
if (typeof charsetNumber !== 'undefined') {
|
package/lib/packets/text_row.js
CHANGED
|
@@ -17,7 +17,7 @@ class TextRow {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
static toPacket(columns, encoding) {
|
|
20
|
-
const sequenceId = 0; // TODO remove, this is calculated now in
|
|
20
|
+
const sequenceId = 0; // TODO remove, this is calculated now in connection
|
|
21
21
|
let length = 0;
|
|
22
22
|
columns.forEach((val) => {
|
|
23
23
|
if (val === null || typeof val === 'undefined') {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mysql2",
|
|
3
|
-
"version": "3.22.
|
|
3
|
+
"version": "3.22.6",
|
|
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",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"long": "^5.3.2",
|
|
61
61
|
"lru.min": "^1.1.4",
|
|
62
62
|
"named-placeholders": "^1.1.6",
|
|
63
|
-
"sql-escaper": "^1.
|
|
63
|
+
"sql-escaper": "^1.4.0"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
66
|
"@types/node": ">= 8"
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"@rollup/plugin-commonjs": "^29.0.2",
|
|
75
75
|
"@rollup/plugin-json": "^6.1.0",
|
|
76
76
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
77
|
-
"@types/node": "^
|
|
77
|
+
"@types/node": "^26.0.0",
|
|
78
78
|
"@typescript-eslint/eslint-plugin": "^8.56.0",
|
|
79
79
|
"@typescript-eslint/parser": "^8.56.0",
|
|
80
80
|
"assert-diff": "^3.0.4",
|