Skip to content

Commit 38c49b1

Browse files
committed
Merge branch 'release/2.4.1'
2 parents cda6634 + f4e8ed5 commit 38c49b1

28 files changed

+535
-179
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ matrix:
4141
allow_failures:
4242
- node_js: "12"
4343
env: DB=build SKIP_LEAK=1
44+
- node_js: "12"
45+
env: SKYSQL=true SKIP_LEAK=1
4446
include:
4547
- node_js: "12"
4648
env: DB=build SKIP_LEAK=1

.travis/build/Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ RUN dpkg -R --unpack /root/
7979
RUN apt-get install -f -y
8080

8181
RUN rm -rf /var/lib/apt/lists/* \
82-
&& sed -ri 's/^user\s/#&/' /etc/mysql/my.cnf /etc/mysql/conf.d/* \
8382
&& rm -rf /var/lib/mysql && mkdir -p /var/lib/mysql /var/run/mysqld \
8483
&& chown -R mysql:mysql /var/lib/mysql /var/run/mysqld \
8584
&& chmod 777 /var/run/mysqld \

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
11
# Change Log
2+
## [2.4.1](https://github.com/mariadb-corporation/mariadb-connector-nodejs/tree/2.4.1) (01 Jul 2020)
3+
[Full Changelog](https://github.com/mariadb-corporation/mariadb-connector-nodejs/compare/2.4.0...2.4.1)
4+
5+
* CONJS-138 - pool.getConnection() might not timeout even with acquireTimeout set
6+
* CONJS-139 - createConnection(string)` does not support URL-encoded credentials
7+
* CONJS-140 - Support passing null values in array when doing queries. thanks to @koendeschacht
8+
* CONJS-141 - set default value of option `restoreNodeTimeout` to 1000 to avoid using blacklisted pool in cluster
9+
10+
211
## [2.4.0](https://github.com/mariadb-corporation/mariadb-connector-nodejs/tree/2.4.0) (24 May 2020)
312
[Full Changelog](https://github.com/mariadb-corporation/mariadb-connector-nodejs/compare/2.3.1...2.4.0)
413

appveyor.yml

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,52 +12,47 @@ environment:
1212
TEST_LOG_PACKETS: true
1313
matrix:
1414

15-
- DB: '10.4.12'
15+
- DB: '10.4.13'
1616
MEM: "21"
1717
nodejs_version: "10"
1818

19-
- DB: '10.4.12'
19+
- DB: '10.4.13'
2020
MEM: "21"
2121
nodejs_version: "12"
2222
SKIP_LEAK: "1"
2323

24-
- DB: '10.4.12'
24+
- DB: '10.4.13'
2525
nodejs_version: "12"
2626
MEM: "21"
2727
TEST_ZIP: 1
2828
SKIP_LEAK: "1"
2929

30-
- DB: '10.4.12'
30+
- DB: '10.4.13'
3131
nodejs_version: "12"
3232
MEM: "21"
3333
BENCH: "1"
3434
SKIP_LEAK: "1"
3535

36-
- DB: '10.5.1'
36+
- DB: '10.5.4'
3737
MEM: "21"
3838
nodejs_version: "12"
3939
SKIP_LEAK: "1"
4040

41-
- DB: '10.3.22'
41+
- DB: '10.3.23'
4242
MEM: "21"
4343
nodejs_version: "12"
4444
SKIP_LEAK: "1"
4545

46-
- DB: '10.2.31'
46+
- DB: '10.2.32'
4747
MEM: "21"
4848
nodejs_version: "12"
4949
SKIP_LEAK: "1"
5050

51-
- DB: '10.1.44'
51+
- DB: '10.1.45'
5252
MEM: "21"
5353
nodejs_version: "12"
5454
SKIP_LEAK: "1"
5555

56-
- DB: '5.5.67'
57-
MEM: "5"
58-
nodejs_version: "12"
59-
SKIP_LEAK: "1"
60-
6156
cache:
6257
- node_modules
6358

documentation/callback-api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ Specific options for pool cluster are :
327327
|---:|---|:---:|:---:|
328328
| **`canRetry`** | When getting a connection from pool fails, can cluster retry with other pools |*boolean* | true |
329329
| **`removeNodeErrorCount`** | Maximum number of consecutive connection fail from a pool before pool is removed from cluster configuration. null means node won't be removed|*integer* | 5 |
330-
| **`restoreNodeTimeout`** | delay before a pool can be reused after a connection fails. 0 = can be reused immediately (in ms) |*integer*| 0|
330+
| **`restoreNodeTimeout`** | delay before a pool can be reused after a connection fails. 0 = can be reused immediately (in ms) |*integer*| 1000|
331331
| **`defaultSelector`** | default pools selector. Can be 'RR' (round-robin), 'RANDOM' or 'ORDER' (use in sequence = always use first pools unless fails) |*string*| 'RR'|
332332
333333

documentation/promise-api.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ Specific options for pool cluster are :
327327
|---:|---|:---:|:---:|
328328
| **`canRetry`** | When getting a connection from pool fails, can cluster retry with other pools |*boolean* | true |
329329
| **`removeNodeErrorCount`** | Maximum number of consecutive connection fail from a pool before pool is removed from cluster configuration. null means node won't be removed|*integer* | 5 |
330-
| **`restoreNodeTimeout`** | delay before a pool can be reused after a connection fails. 0 = can be reused immediately (in ms) |*integer*| 0|
330+
| **`restoreNodeTimeout`** | delay before a pool can be reused after a connection fails. 0 = can be reused immediately (in ms) |*integer*| 1000|
331331
| **`defaultSelector`** | default pools selector. Can be 'RR' (round-robin), 'RANDOM' or 'ORDER' (use in sequence = always use first pools unless fails) |*string*| 'RR'|
332332

333333
## `version → String`
@@ -1278,7 +1278,7 @@ const mariadb = require('mariadb');
12781278
const cluster = mariadb.createPoolCluster({ removeNodeErrorCount: 20, restoreNodeTimeout: 5000 });
12791279
cluster.add("master", { host: 'mydb1.com', user: 'myUser', connectionLimit: 5 });
12801280
cluster.add("slave1", { host: 'mydb2.com', user: 'myUser', connectionLimit: 5 });
1281-
cluster.add("slave2", { host: 'mydb3.com', user: 'myUser', connectionLimit: 5 });*
1281+
cluster.add("slave2", { host: 'mydb3.com', user: 'myUser', connectionLimit: 5 });
12821282
cluster.on('remove', node => {
12831283
console.log(`node ${node} was removed`);
12841284
})

lib/cmd/command.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,13 @@ class Command extends EventEmitter {
101101
* @param val return value.
102102
*/
103103
successEnd(val) {
104+
this.onPacketReceive = null;
104105
if (this.resolve) {
105-
this.onPacketReceive = null;
106106
this.reject = null;
107107
process.nextTick(this.resolve, val);
108108
this.resolve = null;
109-
this.emit('end');
110109
}
110+
this.emit('end');
111111
}
112112

113113
static parseOkPacket(packet, out, opts, info) {

lib/cmd/common-text-cmd.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ class CommonText extends ResultSet {
3232
out.writeStringAscii('' + value);
3333
break;
3434
case 'object':
35-
if (Object.prototype.toString.call(value) === '[object Date]') {
35+
if (value === null) {
36+
out.writeStringAscii('NULL');
37+
} else if (Object.prototype.toString.call(value) === '[object Date]') {
3638
out.writeStringAscii(this.getDateQuote(value, opts));
3739
} else if (Buffer.isBuffer(value)) {
3840
out.writeStringAscii("_BINARY '");

lib/cmd/query.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,8 @@ class Query extends CommonText {
6666
for (let i = 1; i < len; i++) {
6767
const value = this.values[i - 1];
6868

69-
if (value === null) {
70-
out.writeStringAscii('NULL');
71-
out.writeString(this.queryParts[i]);
72-
continue;
73-
}
74-
7569
if (
70+
value !== null &&
7671
typeof value === 'object' &&
7772
typeof value.pipe === 'function' &&
7873
typeof value.read === 'function'

lib/config/connection-options.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ class ConnectionOptions {
168168
opts.charsetNumber = Number.parseInt(opts.charsetNumber);
169169
}
170170
if (opts.compress) opts.compress = opts.compress == 'true';
171-
if (opts.connectAttributes) opts.connectAttributes = opts.connectAttributes == 'true';
171+
if (opts.connectAttributes) opts.connectAttributes = JSON.parse(opts.connectAttributes);
172172
if (opts.connectTimeout) opts.connectTimeout = parseInt(opts.connectTimeout);
173173
if (opts.socketTimeout) opts.socketTimeout = parseInt(opts.socketTimeout);
174174
if (opts.dateStrings) opts.dateStrings = opts.dateStrings == 'true';
@@ -208,11 +208,11 @@ class ConnectionOptions {
208208
);
209209
}
210210
const options = {
211-
user: matchResults[2],
212-
password: matchResults[4],
213-
host: matchResults[6],
211+
user: matchResults[2] ? decodeURIComponent(matchResults[2]) : undefined,
212+
password: matchResults[4] ? decodeURIComponent(matchResults[4]) : undefined,
213+
host: matchResults[6] ? decodeURIComponent(matchResults[6]) : matchResults[6],
214214
port: matchResults[8] ? parseInt(matchResults[8]) : undefined,
215-
database: matchResults[9]
215+
database: matchResults[9] ? decodeURIComponent(matchResults[9]) : matchResults[9]
216216
};
217217

218218
const variousOptsString = matchResults[11];
@@ -221,7 +221,9 @@ class ConnectionOptions {
221221
keyVals.forEach(function (keyVal) {
222222
const equalIdx = keyVal.indexOf('=');
223223
if (equalIdx !== 1) {
224-
options[keyVal.substring(0, equalIdx)] = keyVal.substring(equalIdx + 1);
224+
let val = keyVal.substring(equalIdx + 1);
225+
val = val ? decodeURIComponent(val) : undefined;
226+
options[keyVal.substring(0, equalIdx)] = val;
225227
}
226228
});
227229
}

0 commit comments

Comments
 (0)