Comparing version 2.4.0 to 2.4.1
# Change Log | ||
## [2.4.1](https://github.com/mariadb-corporation/mariadb-connector-nodejs/tree/2.4.1) (01 Jul 2020) | ||
[Full Changelog](https://github.com/mariadb-corporation/mariadb-connector-nodejs/compare/2.4.0...2.4.1) | ||
* CONJS-138 - pool.getConnection() might not timeout even with acquireTimeout set | ||
* CONJS-139 - createConnection(string)` does not support URL-encoded credentials | ||
* CONJS-140 - Support passing null values in array when doing queries. thanks to @koendeschacht | ||
* CONJS-141 - set default value of option `restoreNodeTimeout` to 1000 to avoid using blacklisted pool in cluster | ||
## [2.4.0](https://github.com/mariadb-corporation/mariadb-connector-nodejs/tree/2.4.0) (24 May 2020) | ||
@@ -3,0 +12,0 @@ [Full Changelog](https://github.com/mariadb-corporation/mariadb-connector-nodejs/compare/2.3.1...2.4.0) |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -104,9 +104,9 @@ 'use strict'; | ||
successEnd(val) { | ||
this.onPacketReceive = null; | ||
if (this.resolve) { | ||
this.onPacketReceive = null; | ||
this.reject = null; | ||
process.nextTick(this.resolve, val); | ||
this.resolve = null; | ||
this.emit('end'); | ||
} | ||
this.emit('end'); | ||
} | ||
@@ -113,0 +113,0 @@ |
@@ -35,3 +35,5 @@ 'use strict'; | ||
case 'object': | ||
if (Object.prototype.toString.call(value) === '[object Date]') { | ||
if (value === null) { | ||
out.writeStringAscii('NULL'); | ||
} else if (Object.prototype.toString.call(value) === '[object Date]') { | ||
out.writeStringAscii(this.getDateQuote(value, opts)); | ||
@@ -38,0 +40,0 @@ } else if (Buffer.isBuffer(value)) { |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -69,9 +69,4 @@ 'use strict'; | ||
if (value === null) { | ||
out.writeStringAscii('NULL'); | ||
out.writeString(this.queryParts[i]); | ||
continue; | ||
} | ||
if ( | ||
value !== null && | ||
typeof value === 'object' && | ||
@@ -78,0 +73,0 @@ typeof value.pipe === 'function' && |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -171,3 +171,3 @@ 'use strict'; | ||
if (opts.compress) opts.compress = opts.compress == 'true'; | ||
if (opts.connectAttributes) opts.connectAttributes = opts.connectAttributes == 'true'; | ||
if (opts.connectAttributes) opts.connectAttributes = JSON.parse(opts.connectAttributes); | ||
if (opts.connectTimeout) opts.connectTimeout = parseInt(opts.connectTimeout); | ||
@@ -212,7 +212,7 @@ if (opts.socketTimeout) opts.socketTimeout = parseInt(opts.socketTimeout); | ||
const options = { | ||
user: matchResults[2], | ||
password: matchResults[4], | ||
host: matchResults[6], | ||
user: matchResults[2] ? decodeURIComponent(matchResults[2]) : undefined, | ||
password: matchResults[4] ? decodeURIComponent(matchResults[4]) : undefined, | ||
host: matchResults[6] ? decodeURIComponent(matchResults[6]) : matchResults[6], | ||
port: matchResults[8] ? parseInt(matchResults[8]) : undefined, | ||
database: matchResults[9] | ||
database: matchResults[9] ? decodeURIComponent(matchResults[9]) : matchResults[9] | ||
}; | ||
@@ -226,3 +226,5 @@ | ||
if (equalIdx !== 1) { | ||
options[keyVal.substring(0, equalIdx)] = keyVal.substring(equalIdx + 1); | ||
let val = keyVal.substring(equalIdx + 1); | ||
val = val ? decodeURIComponent(val) : undefined; | ||
options[keyVal.substring(0, equalIdx)] = val; | ||
} | ||
@@ -229,0 +231,0 @@ }); |
@@ -8,3 +8,3 @@ 'use strict'; | ||
this.removeNodeErrorCount = opts.removeNodeErrorCount || 5; | ||
this.restoreNodeTimeout = opts.restoreNodeTimeout || 0; | ||
this.restoreNodeTimeout = opts.restoreNodeTimeout || 1000; | ||
this.defaultSelector = opts.defaultSelector || 'RR'; | ||
@@ -14,3 +14,3 @@ } else { | ||
this.removeNodeErrorCount = 5; | ||
this.restoreNodeTimeout = 0; | ||
this.restoreNodeTimeout = 1000; | ||
this.defaultSelector = 'RR'; | ||
@@ -17,0 +17,0 @@ } |
@@ -22,2 +22,3 @@ 'use strict'; | ||
if (opts.resetAfterUse) opts.resetAfterUse = opts.resetAfterUse == 'true'; | ||
if (opts.pingTimeout) opts.pingTimeout = parseInt(opts.pingTimeout); | ||
} | ||
@@ -38,3 +39,3 @@ | ||
this.resetAfterUse = opts.resetAfterUse === undefined ? true : opts.resetAfterUse; | ||
this.pingTimeout = opts.pingTimeout || 250; | ||
this.connOptions = new ConnOptions(opts); | ||
@@ -41,0 +42,0 @@ |
@@ -44,6 +44,14 @@ 'use strict'; | ||
const _pingCallback = (callback) => { | ||
pingPromise() | ||
.then(callback || emptySuccess) | ||
.catch(callback || emptyError); | ||
const _pingCallback = (timeout, callback) => { | ||
let _timeout, _cb; | ||
if (typeof timeout === 'function') { | ||
_cb = timeout; | ||
_timeout = undefined; | ||
} else { | ||
_timeout = timeout; | ||
_cb = callback; | ||
} | ||
pingPromise(_timeout) | ||
.then(_cb || emptySuccess) | ||
.catch(_cb || emptyError); | ||
}; | ||
@@ -50,0 +58,0 @@ |
@@ -252,7 +252,45 @@ 'use strict'; | ||
* Send an empty MySQL packet to ensure connection is active, and reset @@wait_timeout | ||
* | ||
* @param timeout (optional) timeout value in ms. If reached, throw error and close connection | ||
* @returns {Promise} promise | ||
*/ | ||
this.ping = () => { | ||
this.ping = (timeout) => { | ||
return new Promise(function (resolve, reject) { | ||
if (timeout) { | ||
if (timeout < 0) { | ||
reject( | ||
Errors.createError( | ||
'Ping cannot have negative timeout value', | ||
false, | ||
info, | ||
'0A000', | ||
Errors.ER_BAD_PARAMETER_VALUE | ||
) | ||
); | ||
return; | ||
} | ||
const tOut = setTimeout(() => { | ||
reject(Errors.createError('Ping timeout', true, info, '0A000', Errors.ER_PING_TIMEOUT)); | ||
// close connection | ||
_addCommand = _addCommandDisabled; | ||
clearTimeout(_timeout); | ||
if (_status !== Status.CLOSING && _status !== Status.CLOSED) { | ||
_sendQueue.clear(); | ||
_status = Status.CLOSED; | ||
_socket.destroy(); | ||
} | ||
_clear(); | ||
}, timeout); | ||
return _addCommand( | ||
new Ping( | ||
() => { | ||
clearTimeout(tOut); | ||
resolve(); | ||
}, | ||
(err) => { | ||
clearTimeout(tOut); | ||
reject(err); | ||
} | ||
) | ||
); | ||
} | ||
return _addCommand(new Ping(resolve, reject)); | ||
@@ -259,0 +297,0 @@ }); |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -102,2 +102,4 @@ 'use strict'; | ||
module.exports.ER_CLIENT_OPTION_INCOMPATIBILITY = 45041; | ||
module.exports.ER_PING_TIMEOUT = 45042; | ||
module.exports.ER_BAD_PARAMETER_VALUE = 45043; | ||
@@ -104,0 +106,0 @@ const keys = Object.keys(module.exports); |
@@ -0,0 +0,0 @@ const Errors = require('../misc/errors'); |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -29,3 +29,3 @@ 'use strict'; | ||
return new Promise((resolve, reject) => { | ||
conn.ping((err) => { | ||
conn.ping(options.pingTimeout, (err) => { | ||
if (err) { | ||
@@ -32,0 +32,0 @@ reject(err); |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -101,3 +101,3 @@ 'use strict'; | ||
PoolBase.call(this, options, processTaskPromise, createConnectionPoolPromise, (conn) => | ||
conn.ping() | ||
conn.ping(options.pingTimeout) | ||
); | ||
@@ -104,0 +104,0 @@ } |
{ | ||
"name": "mariadb", | ||
"version": "2.4.0", | ||
"version": "2.4.1", | ||
"description": "fast mariadb/mysql connector.", | ||
@@ -5,0 +5,0 @@ "main": "promise.js", |
@@ -0,0 +0,0 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13465
512734