mysql
Advanced tools
Comparing version 2.15.0 to 2.16.0
@@ -7,2 +7,15 @@ # Changes | ||
## v2.16.0 (2018-07-17) | ||
* Add Amazon RDS GovCloud SSL certificates #1876 | ||
* Add new error codes up to MySQL 5.7.21 | ||
* Include connection ID in debug output | ||
* Support Node.js 9.x | ||
* Support Node.js 10.x #2003 #2024 #2026 #2034 | ||
* Update Amazon RDS SSL certificates | ||
* Update `bignumber.js` to 4.1.0 | ||
* Update `readable-stream` to 2.3.6 | ||
* Update `sqlstring` to 2.3.1 | ||
- Fix incorrectly replacing non-placeholders in SQL | ||
## v2.15.0 (2017-10-05) | ||
@@ -302,2 +315,3 @@ | ||
* Add query to pool to execute queries directly using the pool | ||
* Add `sqlState` property to `Error` objects #556 | ||
* Pool option to set queue limit | ||
@@ -304,0 +318,0 @@ * Pool sends 'connection' event when it opens a new connection |
@@ -25,14 +25,2 @@ var Crypto = require('crypto'); | ||
function bindToCurrentDomain(callback) { | ||
if (!callback) { | ||
return undefined; | ||
} | ||
var domain = process.domain; | ||
return domain | ||
? domain.bind(callback) | ||
: callback; | ||
} | ||
Connection.createQuery = function createQuery(sql, values, callback) { | ||
@@ -43,7 +31,7 @@ if (sql instanceof Query) { | ||
var cb = bindToCurrentDomain(callback); | ||
var cb = wrapCallbackInDomain(null, callback); | ||
var options = {}; | ||
if (typeof sql === 'function') { | ||
cb = bindToCurrentDomain(sql); | ||
cb = wrapCallbackInDomain(null, sql); | ||
return new Query(options, cb); | ||
@@ -58,3 +46,3 @@ } | ||
if (typeof values === 'function') { | ||
cb = bindToCurrentDomain(values); | ||
cb = wrapCallbackInDomain(null, values); | ||
} else if (values !== undefined) { | ||
@@ -71,3 +59,3 @@ options.values = values; | ||
if (typeof values === 'function') { | ||
cb = bindToCurrentDomain(values); | ||
cb = wrapCallbackInDomain(null, values); | ||
options.values = undefined; | ||
@@ -106,11 +94,11 @@ } | ||
}); | ||
this._socket.on('data', function(data) { | ||
this._socket.on('data', wrapToDomain(connection, function (data) { | ||
connection._protocol.write(data); | ||
}); | ||
})); | ||
this._protocol.on('end', function() { | ||
connection._socket.end(); | ||
}); | ||
this._socket.on('end', function() { | ||
this._socket.on('end', wrapToDomain(connection, function () { | ||
connection._protocol.end(); | ||
}); | ||
})); | ||
@@ -135,3 +123,3 @@ this._socket.on('error', this._handleNetworkError.bind(this)); | ||
this._protocol.handshake(options, bindToCurrentDomain(callback)); | ||
this._protocol.handshake(options, wrapCallbackInDomain(this, callback)); | ||
}; | ||
@@ -158,3 +146,3 @@ | ||
currentConfig : this.config | ||
}, bindToCurrentDomain(callback)); | ||
}, wrapCallbackInDomain(this, callback)); | ||
}; | ||
@@ -213,2 +201,6 @@ | ||
if (query._callback) { | ||
query._callback = wrapCallbackInDomain(this, query._callback); | ||
} | ||
this._implyConnect(); | ||
@@ -226,3 +218,3 @@ | ||
this._implyConnect(); | ||
this._protocol.ping(options, bindToCurrentDomain(callback)); | ||
this._protocol.ping(options, wrapCallbackInDomain(this, callback)); | ||
}; | ||
@@ -237,3 +229,3 @@ | ||
this._implyConnect(); | ||
this._protocol.stats(options, bindToCurrentDomain(callback)); | ||
this._protocol.stats(options, wrapCallbackInDomain(this, callback)); | ||
}; | ||
@@ -259,3 +251,3 @@ | ||
this._implyConnect(); | ||
this._protocol.quit(opts, bindToCurrentDomain(cb)); | ||
this._protocol.quit(opts, wrapCallbackInDomain(this, cb)); | ||
}; | ||
@@ -475,1 +467,51 @@ | ||
}; | ||
function unwrapFromDomain(fn) { | ||
return function () { | ||
var domains = []; | ||
var ret; | ||
while (process.domain) { | ||
domains.shift(process.domain); | ||
process.domain.exit(); | ||
} | ||
try { | ||
ret = fn.apply(this, arguments); | ||
} finally { | ||
for (var i = 0; i < domains.length; i++) { | ||
domains[i].enter(); | ||
} | ||
} | ||
return ret; | ||
}; | ||
} | ||
function wrapCallbackInDomain(ee, fn) { | ||
if (typeof fn !== 'function' || fn.domain) { | ||
return fn; | ||
} | ||
var domain = process.domain; | ||
if (domain) { | ||
return domain.bind(fn); | ||
} else if (ee) { | ||
return unwrapFromDomain(wrapToDomain(ee, fn)); | ||
} else { | ||
return fn; | ||
} | ||
} | ||
function wrapToDomain(ee, fn) { | ||
return function () { | ||
if (Events.usingDomains && ee.domain) { | ||
ee.domain.enter(); | ||
fn.apply(this, arguments); | ||
ee.domain.exit(); | ||
} else { | ||
fn.apply(this, arguments); | ||
} | ||
}; | ||
} |
@@ -38,6 +38,6 @@ var Buffer = require('safe-buffer').Buffer; | ||
Auth.hashPassword = function(password) { | ||
var nr = [0x5030, 0x5735], | ||
add = 7, | ||
nr2 = [0x1234, 0x5671], | ||
result = Buffer.alloc(8); | ||
var nr = [0x5030, 0x5735]; | ||
var add = 7; | ||
var nr2 = [0x1234, 0x5671]; | ||
var result = Buffer.alloc(8); | ||
@@ -90,8 +90,8 @@ if (typeof password === 'string'){ | ||
Auth.scramble323 = function(message, password) { | ||
var to = Buffer.allocUnsafe(8), | ||
hashPass = this.hashPassword(password), | ||
hashMessage = this.hashPassword(message.slice(0, 8)), | ||
seed1 = this.int32Read(hashPass, 0) ^ this.int32Read(hashMessage, 0), | ||
seed2 = this.int32Read(hashPass, 4) ^ this.int32Read(hashMessage, 4), | ||
r = this.randomInit(seed1, seed2); | ||
var to = Buffer.allocUnsafe(8); | ||
var hashPass = this.hashPassword(password); | ||
var hashMessage = this.hashPassword(message.slice(0, 8)); | ||
var seed1 = this.int32Read(hashPass, 0) ^ this.int32Read(hashMessage, 0); | ||
var seed2 = this.int32Read(hashPass, 4) ^ this.int32Read(hashMessage, 4); | ||
var r = this.randomInit(seed1, seed2); | ||
@@ -115,4 +115,4 @@ for (var i = 0; i < 8; i++){ | ||
Auth.add32 = function(a, b){ | ||
var w1 = a[1] + b[1], | ||
w2 = a[0] + b[0] + ((w1 & 0xFFFF0000) >> 16); | ||
var w1 = a[1] + b[1]; | ||
var w2 = a[0] + b[0] + ((w1 & 0xFFFF0000) >> 16); | ||
@@ -125,4 +125,4 @@ return [w2 & 0xFFFF, w1 & 0xFFFF]; | ||
// http://www.dsprelated.com/showmessage/89790/1.php | ||
var w1 = a[1] * b[1], | ||
w2 = (((a[1] * b[1]) >> 16) & 0xFFFF) + ((a[0] * b[1]) & 0xFFFF) + (a[1] * b[0] & 0xFFFF); | ||
var w1 = a[1] * b[1]; | ||
var w2 = (((a[1] * b[1]) >> 16) & 0xFFFF) + ((a[0] * b[1]) & 0xFFFF) + (a[1] * b[0] & 0xFFFF); | ||
@@ -138,4 +138,4 @@ return [w2 & 0xFFFF, w1 & 0xFFFF]; | ||
// assume b is 16 or less | ||
var w1 = a[1] << b, | ||
w2 = (a[0] << b) | ((w1 & 0xFFFF0000) >> 16); | ||
var w1 = a[1] << b; | ||
var w2 = (a[0] << b) | ((w1 & 0xFFFF0000) >> 16); | ||
@@ -142,0 +142,0 @@ return [w2 & 0xFFFF, w1 & 0xFFFF]; |
@@ -482,2 +482,39 @@ // Certificates for Amazon RDS | ||
/** | ||
* Amazon RDS us-east-2 certificate CA 2016 to 2020 | ||
* | ||
* CN = Amazon RDS us-east-2 CA | ||
* OU = Amazon RDS | ||
* O = Amazon Web Services, Inc. | ||
* L = Seattle | ||
* ST = Washington | ||
* C = US | ||
* P = 2016-08-11T19:58:45Z/2020-03-05T19:58:45Z | ||
* F = 9B:78:E3:64:7F:74:BC:B2:52:18:CF:13:C3:62:B8:35:9D:3D:5F:B6 | ||
*/ | ||
'-----BEGIN CERTIFICATE-----\n' | ||
+ 'MIID/DCCAuSgAwIBAgIBTjANBgkqhkiG9w0BAQsFADCBijELMAkGA1UEBhMCVVMx\n' | ||
+ 'EzARBgNVBAgMCldhc2hpbmd0b24xEDAOBgNVBAcMB1NlYXR0bGUxIjAgBgNVBAoM\n' | ||
+ 'GUFtYXpvbiBXZWIgU2VydmljZXMsIEluYy4xEzARBgNVBAsMCkFtYXpvbiBSRFMx\n' | ||
+ 'GzAZBgNVBAMMEkFtYXpvbiBSRFMgUm9vdCBDQTAeFw0xNjA4MTExOTU4NDVaFw0y\n' | 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17JdXZoXr4PYHDKP7j0ONfAyFNER2+uecblHfRSpVq5UeF3L6ZJb8\n' | ||
+ 'fSw/GtAV6an+/0r+Qm+PiI2H5XuZ4GmRJYnGMhqWhBYrY7p3jtVnKcsh39wgfUnW\n' | ||
+ 'AvZEZG/yhFyAZW0Essa39LiL5VSq14Y1DOj0wgnhSY/9WHxaAo1HB1T9OeZknYbD\n' | ||
+ 'fl/EGSZ0TEvZkENrXcPlVA==\n' | ||
+ '-----END CERTIFICATE-----\n', | ||
/** | ||
* Amazon RDS ca-central-1 certificate CA 2016 to 2020 | ||
@@ -554,4 +591,152 @@ * | ||
+ 'mqfEEuC7uUoPofXdBp2ObQ==\n' | ||
+ '-----END CERTIFICATE-----\n', | ||
/** | ||
* Amazon RDS us-gov-west-1 CA 2017 to 2022 | ||
* | ||
* CN = Amazon RDS us-gov-west-1 CA | ||
* OU = Amazon RDS | ||
* O = Amazon Web Services, Inc. | ||
* L = Seattle | ||
* ST = Washington | ||
* C = US | ||
* P = 2017-05-19T22:31:19Z/2022-05-18T12:00:00Z | ||
* F = 77:55:8C:C4:5E:71:1F:1B:57:E3:DA:6E:5B:74:27:12:4E:E8:69:E8 | ||
*/ | ||
'-----BEGIN CERTIFICATE-----\n' | ||
+ 'MIIECjCCAvKgAwIBAgICEAAwDQYJKoZIhvcNAQELBQAwgZMxCzAJBgNVBAYTAlVT\n' | ||
+ 'MRAwDgYDVQQHDAdTZWF0dGxlMRMwEQYDVQQIDApXYXNoaW5ndG9uMSIwIAYDVQQK\n' | ||
+ 'DBlBbWF6b24gV2ViIFNlcnZpY2VzLCBJbmMuMRMwEQYDVQQLDApBbWF6b24gUkRT\n' | ||
+ 'MSQwIgYDVQQDDBtBbWF6b24gUkRTIEdvdkNsb3VkIFJvb3QgQ0EwHhcNMTcwNTE5\n' | ||
+ 'MjIzMTE5WhcNMjIwNTE4MTIwMDAwWjCBkzELMAkGA1UEBhMCVVMxEzARBgNVBAgM\n' | ||
+ 'Cldhc2hpbmd0b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1cKry3j12wdPG5cUsug0vt34u6rdhP+FsM0tHI15Kjch\n' | ||
+ 'RuUCvyQecy2ZFNAa3jmd5ycNdL63RWe8oayRBpQBxPPCbHfILxGZEdJbCH9aJ2D/\n' | ||
+ 'l8oHIDnvOLdv7/cBjyYuvmprgPtu3QEkbre5Hln/\n' | ||
+ '-----END CERTIFICATE-----\n', | ||
/** | ||
* Amazon RDS eu-west-3 certificate CA 2017 to 2020 | ||
* | ||
* CN = Amazon RDS eu-west-3 CA | ||
* OU = Amazon RDS | ||
* O = Amazon Web Services, Inc. | ||
* L = Seattle | ||
* ST = Washington | ||
* C = US | ||
* P = 2017-08-25T21:39:26Z/2020-03-05T21:39:26Z | ||
* F = FD:35:A7:84:60:68:98:00:12:54:ED:34:26:8C:66:0F:72:DD:B2:F4 | ||
*/ | ||
'-----BEGIN CERTIFICATE-----\n' | ||
+ 'MIID/DCCAuSgAwIBAgIBUTANBgkqhkiG9w0BAQsFADCBijELMAkGA1UEBhMCVVMx\n' | ||
+ 'EzARBgNVBAgMCldhc2hpbmd0b24xEDAOBgNVBAcMB1NlYXR0bGUxIjAgBgNVBAoM\n' | ||
+ 'GUFtYXpvbiBXZWIgU2VydmljZXMsIEluYy4xEzARBgNVBAsMCkFtYXpvbiBSRFMx\n' | ||
+ 'GzAZBgNVBAMMEkFtYXpvbiBSRFMgUm9vdCBDQTAeFw0xNzA4MjUyMTM5MjZaFw0y\n' | ||
+ 'MDAzMDUyMTM5MjZaMIGPMQswCQYDVQQGEwJVUzETMBEGA1UECAwKV2FzaGluZ3Rv\n' | ||
+ 'bjEQMA4GA1UEBwwHU2VhdHRsZTEiMCAGA1UECgwZQW1hem9uIFdlYiBTZXJ2aWNl\n' | ||
+ 'cywgSW5jLjETMBEGA1UECwwKQW1hem9uIFJEUzEgMB4GA1UEAwwXQW1hem9uIFJE\n' | ||
+ 'UyBldS13ZXN0LTMgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC+\n' | 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3 certificate CA 2017 to 2020 | ||
* | ||
* CN = Amazon RDS ap-northeast-3 CA | ||
* OU = Amazon RDS | ||
* O = Amazon Web Services, Inc. | ||
* L = Seattle | ||
* ST = Washington | ||
* C = US | ||
* P = 2017-12-01T00:55:42Z/2020-03-05T00:55:42Z | ||
* F = C0:C7:D4:B3:91:40:A0:77:43:28:BF:AF:77:57:DF:FD:98:FB:10:3F | ||
*/ | ||
'-----BEGIN CERTIFICATE-----\n' | ||
+ 'MIIEATCCAumgAwIBAgIBTjANBgkqhkiG9w0BAQUFADCBijELMAkGA1UEBhMCVVMx\n' | ||
+ 'EzARBgNVBAgMCldhc2hpbmd0b24xEDAOBgNVBAcMB1NlYXR0bGUxIjAgBgNVBAoM\n' | ||
+ 'GUFtYXpvbiBXZWIgU2VydmljZXMsIEluYy4xEzARBgNVBAsMCkFtYXpvbiBSRFMx\n' | ||
+ 'GzAZBgNVBAMMEkFtYXpvbiBSRFMgUm9vdCBDQTAeFw0xNzEyMDEwMDU1NDJaFw0y\n' | ||
+ 'MDAzMDUwMDU1NDJaMIGUMQswCQYDVQQGEwJVUzETMBEGA1UECAwKV2FzaGluZ3Rv\n' | ||
+ 'bjEQMA4GA1UEBwwHU2VhdHRsZTEiMCAGA1UECgwZQW1hem9uIFdlYiBTZXJ2aWNl\n' | ||
+ 'cywgSW5jLjETMBEGA1UECwwKQW1hem9uIFJEUzElMCMGA1UEAwwcQW1hem9uIFJE\n' | ||
+ 'UyBhcC1ub3J0aGVhc3QtMyBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC\n' | ||
+ 'ggEBAMZtQNnm/XT19mTa10ftHLzg5UhajoI65JHv4TQNdGXdsv+CQdGYU49BJ9Eu\n' | ||
+ '3bYgiEtTzR2lQe9zGMvtuJobLhOWuavzp7IixoIQcHkFHN6wJ1CvqrxgvJfBq6Hy\n' | ||
+ 'EuCDCiU+PPDLUNA6XM6Qx3IpHd1wrJkjRB80dhmMSpxmRmx849uFafhN+P1QybsM\n' | ||
+ 'TI0o48VON2+vj+mNuQTyLMMP8D4odSQHjaoG+zyJfJGZeAyqQyoOUOFEyQaHC3TT\n' | ||
+ '3IDSNCQlpxb9LerbCoKu79WFBBq3CS5cYpg8/fsnV2CniRBFFUumBt5z4dhw9RJU\n' | ||
+ 'qlUXXO1ZyzpGd+c5v6FtrfXtnIUCAwEAAaNmMGQwDgYDVR0PAQH/BAQDAgEGMBIG\n' | ||
+ 'A1UdEwEB/wQIMAYBAf8CAQAwHQYDVR0OBBYEFETv7ELNplYy/xTeIOInl6nzeiHg\n' | ||
+ 'MB8GA1UdIwQYMBaAFE4C7qw+9hXITO0s9QXBj5yECEmDMA0GCSqGSIb3DQEBBQUA\n' | ||
+ 'A4IBAQCpKxOQcd0tEKb3OtsOY8q/MPwTyustGk2Rt7t9G68idADp8IytB7M0SDRo\n' | ||
+ 'wWZqynEq7orQVKdVOanhEWksNDzGp0+FPAf/KpVvdYCd7ru3+iI+V4ZEp2JFdjuZ\n' | ||
+ 'Zz0PIjS6AgsZqE5Ri1J+NmfmjGZCPhsHnGZiBaenX6K5VRwwwmLN6xtoqrrfR5zL\n' | ||
+ 'QfBeeZNJG6KiM3R/DxJ5rAa6Fz+acrhJ60L7HprhB7SFtj1RCijau3+ZwiGmUOMr\n' | ||
+ 'yKlMv+VgmzSw7o4Hbxy1WVrA6zQsTHHSGf+vkQn2PHvnFMUEu/ZLbTDYFNmTLK91\n' | ||
+ 'K6o4nMsEvhBKgo4z7H1EqqxXhvN2\n' | ||
+ '-----END CERTIFICATE-----\n', | ||
/** | ||
* Amazon RDS GovCloud Root CA 2017 to 2022 | ||
* | ||
* CN = Amazon RDS GovCloud Root CA | ||
* OU = Amazon RDS | ||
* O = Amazon Web Services, Inc. | ||
* L = Seattle | ||
* ST = Washington | ||
* C = US | ||
* P = 2017-05-19T22:29:11Z/2022-05-18T22:29:11Z | ||
* F = A3:61:F9:C9:A2:5B:91:FE:73:A6:52:E3:59:14:8E:CE:35:12:0F:FD |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MBAAGjYzBhMA4G\n' | ||
+ 'A1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRJEM+kuDUu\n' | ||
+ 'ZTmCnA4wUrgnFaXc4zAfBgNVHSMEGDAWgBRJEM+kuDUuZTmCnA4wUrgnFaXc4zAN\n' | ||
+ 'BgkqhkiG9w0BAQsFAAOCAQEAcfA7uirXsNZyI2j4AJFVtOTKOZlQwqbyNducnmlg\n' | ||
+ '/5nug9fAkwM4AgvF5bBOD1Hw6khdsccMwIj+1S7wpL+EYb/nSc8G0qe1p/9lZ/mZ\n' | ||
+ 'ff5g4JOa26lLuCrZDqAk4TzYnt6sQKfa5ZXVUUn0BK3okhiXS0i+NloMyaBCL7vk\n' | ||
+ 'kDwkHwEqflRKfZ9/oFTcCfoiHPA7AdBtaPVr0/Kj9L7k+ouz122huqG5KqX0Zpo8\n' | ||
+ 'S0IGvcd2FZjNSNPttNAK7YuBVsZ0m2nIH1SLp//00v7yAHIgytQwwB17PBcp4NXD\n' | ||
+ 'pCfTa27ng9mMMC2YLqWQpW4TkqjDin2ZC+5X/mbrjzTvVg==\n' | ||
+ '-----END CERTIFICATE-----\n' | ||
] | ||
}; |
@@ -170,4 +170,4 @@ var MAX_PACKET_LENGTH = Math.pow(2, 24) - 1; | ||
Parser.prototype.peak = function() { | ||
return this._buffer[this._offset]; | ||
Parser.prototype.peak = function peak(offset) { | ||
return this._buffer[this._offset + (offset >>> 0)]; | ||
}; | ||
@@ -174,0 +174,0 @@ |
var Parser = require('./Parser'); | ||
var Sequences = require('./sequences'); | ||
var Packets = require('./packets'); | ||
var Timers = require('timers'); | ||
var Stream = require('stream').Stream; | ||
@@ -157,3 +156,3 @@ var Util = require('util'); | ||
.on('packet', function(packet) { | ||
Timers.active(sequence); | ||
sequence._timer.active(); | ||
self._emitPacket(packet); | ||
@@ -174,3 +173,3 @@ }) | ||
.on('start-tls', function() { | ||
Timers.active(sequence); | ||
sequence._timer.active(); | ||
self._connection._startTLS(function(err) { | ||
@@ -185,3 +184,3 @@ if (err) { | ||
Timers.active(sequence); | ||
sequence._timer.active(); | ||
sequence._tlsUpgradeCompleteHandler(); | ||
@@ -271,3 +270,3 @@ }); | ||
Timers.active(sequence); | ||
sequence._timer.active(); | ||
@@ -329,3 +328,3 @@ if (!sequence[packetName]) { | ||
Protocol.prototype._dequeue = function(sequence) { | ||
Timers.unenroll(sequence); | ||
sequence._timer.stop(); | ||
@@ -352,4 +351,3 @@ // No point in advancing the queue, we are dead | ||
if (sequence._timeout > 0 && isFinite(sequence._timeout)) { | ||
Timers.enroll(sequence, sequence._timeout); | ||
Timers.active(sequence); | ||
sequence._timer.start(sequence._timeout); | ||
} | ||
@@ -446,8 +444,13 @@ | ||
Protocol.prototype._debugPacket = function(incoming, packet) { | ||
var headline = (incoming) | ||
var connection = this._connection; | ||
var headline = incoming | ||
? '<-- ' | ||
: '--> '; | ||
headline = headline + packet.constructor.name; | ||
if (connection && connection.threadId !== null) { | ||
headline += '(' + connection.threadId + ') '; | ||
} | ||
headline += packet.constructor.name; | ||
// check for debug packet restriction | ||
@@ -454,0 +457,0 @@ if (Array.isArray(this._config.debug) && this._config.debug.indexOf(packet.constructor.name) === -1) { |
@@ -37,8 +37,2 @@ var Sequence = require('./Sequence'); | ||
Handshake.prototype['AuthSwitchRequestPacket'] = function (packet) { | ||
switch (packet.authMethodName) { | ||
case 'mysql_native_password': | ||
case 'mysql_old_password': | ||
default: | ||
} | ||
if (packet.authMethodName === 'mysql_native_password') { | ||
@@ -45,0 +39,0 @@ var challenge = packet.authMethodData.slice(0, 20); |
@@ -183,9 +183,9 @@ var Sequence = require('./Sequence'); | ||
Query.prototype.stream = function(options) { | ||
var self = this, | ||
stream; | ||
var self = this; | ||
options = options || {}; | ||
options.objectMode = true; | ||
stream = new Readable(options); | ||
var stream = new Readable(options); | ||
stream._read = function() { | ||
@@ -192,0 +192,0 @@ self._connection && self._connection.resume(); |
@@ -5,2 +5,3 @@ var Util = require('util'); | ||
var ErrorConstants = require('../constants/errors'); | ||
var Timer = require('../Timer'); | ||
@@ -29,9 +30,3 @@ // istanbul ignore next: Node.js < 0.10 not covered | ||
this._timeout = options.timeout; | ||
// For Timers | ||
this._idleNext = null; | ||
this._idlePrev = null; | ||
this._idleStart = null; | ||
this._idleTimeout = -1; | ||
this._repeat = null; | ||
this._timer = new Timer(this); | ||
} | ||
@@ -38,0 +33,0 @@ |
{ | ||
"name": "mysql", | ||
"description": "A node.js driver for mysql. It is written in JavaScript, does not require compiling, and is 100% MIT licensed.", | ||
"version": "2.15.0", | ||
"version": "2.16.0", | ||
"license": "MIT", | ||
@@ -16,13 +16,13 @@ "author": "Felix Geisendörfer <felix@debuggable.com> (http://debuggable.com/)", | ||
"dependencies": { | ||
"bignumber.js": "4.0.4", | ||
"readable-stream": "2.3.3", | ||
"safe-buffer": "5.1.1", | ||
"sqlstring": "2.3.0" | ||
"bignumber.js": "4.1.0", | ||
"readable-stream": "2.3.6", | ||
"safe-buffer": "5.1.2", | ||
"sqlstring": "2.3.1" | ||
}, | ||
"devDependencies": { | ||
"after": "0.8.2", | ||
"eslint": "4.8.0", | ||
"eslint": "4.19.1", | ||
"nyc": "10.3.2", | ||
"seedrandom": "2.4.3", | ||
"timezone-mock": "0.0.5", | ||
"timezone-mock": "0.0.7", | ||
"urun": "0.0.8", | ||
@@ -29,0 +29,0 @@ "utest": "0.0.8" |
123
Readme.md
@@ -52,2 +52,3 @@ # mysql | ||
- [Debugging and reporting problems](#debugging-and-reporting-problems) | ||
- [Security issues](#security-issues) | ||
- [Contributing](#contributing) | ||
@@ -59,2 +60,11 @@ - [Running tests](#running-tests) | ||
This is a [Node.js](https://nodejs.org/en/) module available through the | ||
[npm registry](https://www.npmjs.com/). | ||
Before installing, [download and install Node.js](https://nodejs.org/en/download/). | ||
Node.js 0.6 or higher is required. | ||
Installation is done using the | ||
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): | ||
```sh | ||
@@ -252,3 +262,3 @@ $ npm install mysql | ||
When connecting to other servers, you will need to provide an object of options, in the | ||
same format as [crypto.createCredentials](http://nodejs.org/api/crypto.html#crypto_crypto_createcredentials_details). | ||
same format as [tls.createSecureContext](https://nodejs.org/api/tls.html#tls_tls_createsecurecontext_options). | ||
Please note the arguments expect a string of the certificate, not a file name to the | ||
@@ -313,3 +323,4 @@ certificate. Here is a simple example: | ||
Use pool directly. | ||
Create a pool and use it directly: | ||
```js | ||
@@ -331,30 +342,18 @@ var mysql = require('mysql'); | ||
Connections can be pooled to ease sharing a single connection, or managing | ||
multiple connections. | ||
This is a shortcut for the `pool.getConnection()` -> `connection.query()` -> | ||
`connection.release()` code flow. Using `pool.getConnection()` is useful to | ||
share connection state for subsequent queries. This is because two calls to | ||
`pool.query()` may use two different connections and run in parallel. This is | ||
the basic structure: | ||
```js | ||
var mysql = require('mysql'); | ||
var pool = mysql.createPool({ | ||
host : 'example.org', | ||
user : 'bob', | ||
password : 'secret', | ||
database : 'my_db' | ||
}); | ||
var pool = mysql.createPool(...); | ||
pool.getConnection(function(err, connection) { | ||
// connected! (unless `err` is set) | ||
}); | ||
``` | ||
if (err) throw err; // not connected! | ||
When you are done with a connection, just call `connection.release()` and the | ||
connection will return to the pool, ready to be used again by someone else. | ||
```js | ||
var mysql = require('mysql'); | ||
var pool = mysql.createPool(...); | ||
pool.getConnection(function(err, connection) { | ||
// Use the connection | ||
connection.query('SELECT something FROM sometable', function (error, results, fields) { | ||
// And done with the connection. | ||
// When done with the connection, release it. | ||
connection.release(); | ||
@@ -464,25 +463,16 @@ | ||
The `end` method takes an _optional_ callback that you can use to know once | ||
all the connections have ended. | ||
The `end` method takes an _optional_ callback that you can use to know when | ||
all the connections are ended. | ||
**Once `pool.end()` has been called, `pool.getConnection` and other operations | ||
can no longer be performed** | ||
**Once `pool.end` is called, `pool.getConnection` and other operations | ||
can no longer be performed.** Wait until all connections in the pool are | ||
released before calling `pool.end`. If you use the shortcut method | ||
`pool.query`, in place of `pool.getConnection` → `connection.query` → | ||
`connection.release`, wait until it completes. | ||
This works by calling `connection.end()` on every active connection in the | ||
pool, which queues a `QUIT` packet on the connection. And sets a flag to | ||
prevent `pool.getConnection` from continuing to create any new connections. | ||
`pool.end` calls `connection.end` on every active connection in the pool. | ||
This queues a `QUIT` packet on the connection and sets a flag to prevent | ||
`pool.getConnection` from creating new connections. All commands / queries | ||
already in progress will complete, but new commands won't execute. | ||
Since this queues a `QUIT` packet on each connection, all commands / queries | ||
already in progress will complete, just like calling `connection.end()`. If | ||
`pool.end` is called and there are connections that have not yet been released, | ||
those connections will fail to execute any new commands after the `pool.end` | ||
since they have a pending `QUIT` packet in their queue; wait until releasing | ||
all connections back to the pool before calling `pool.end()`. | ||
Since the `pool.query` method is a short-hand for the `pool.getConnection` -> | ||
`connection.query` -> `connection.release()` flow, calling `pool.end()` before | ||
all the queries added via `pool.query` have completed, since the underlying | ||
`pool.getConnection` will fail due to all connections ending and not allowing | ||
new connections to be created. | ||
## PoolCluster | ||
@@ -660,2 +650,18 @@ | ||
If the query only has a single replacement character (`?`), and the value is | ||
not `null`, `undefined`, or an array, it can be passed directly as the second | ||
argument to `.query`: | ||
```js | ||
connection.query( | ||
'SELECT * FROM `books` WHERE `author` = ?', | ||
'David', | ||
function (error, results, fields) { | ||
// error will be an Error if one occurred during the query | ||
// results will contain the results of the query | ||
// fields will contain information about the returned results fields (if any) | ||
} | ||
); | ||
``` | ||
## Escaping query values | ||
@@ -1168,2 +1174,3 @@ | ||
the queries. | ||
* `err.sqlState`: String, contains the five-character SQLSTATE value. Only populated from [MySQL server error][]. | ||
* `err.sqlMessage`: String, contains the message string that provides a | ||
@@ -1388,9 +1395,9 @@ textual description of the error. Only populated from [MySQL server error][]. | ||
- COMPRESS | ||
- INTERACTIVE | ||
- NO_SCHEMA | ||
- PLUGIN_AUTH | ||
- REMEMBER_OPTIONS | ||
- SSL | ||
- SSL_VERIFY_SERVER_CERT | ||
- `COMPRESS` | ||
- `INTERACTIVE` | ||
- `NO_SCHEMA` | ||
- `PLUGIN_AUTH` | ||
- `REMEMBER_OPTIONS` | ||
- `SSL` | ||
- `SSL_VERIFY_SERVER_CERT` | ||
@@ -1422,2 +1429,18 @@ ## Debugging and reporting problems | ||
## Security issues | ||
Security issues should not be first reported through GitHub or another public | ||
forum, but kept private in order for the collaborators to assess the report | ||
and either (a) devise a fix and plan a release date or (b) assert that it is | ||
not a security issue (in which case it can be posted in a public forum, like | ||
a GitHub issue). | ||
The primary private forum is email, either by emailing the module's author or | ||
opening a GitHub issue simply asking to whom a security issues should be | ||
addressed to without disclosing the issue or type of issue. | ||
An ideal report would include a clear indication of what the security issue is | ||
and how it would be exploited, ideally with an accompaning proof of concept | ||
("PoC") for collaborators to work again and validate potentional fixes against. | ||
## Contributing | ||
@@ -1435,3 +1458,3 @@ | ||
2. The tests should pass as best as you can. See the [Running tests](#running-tests) | ||
section on hwo to run the different tests. GitHub will automatically run | ||
section on how to run the different tests. GitHub will automatically run | ||
the tests as well, to act as a safety net. | ||
@@ -1438,0 +1461,0 @@ 3. The pull request should include tests for the change. A new feature should |
Sorry, the diff of this file is too big to display
428222
60
7148
1505
+ Addedbignumber.js@4.1.0(transitive)
+ Addedprocess-nextick-args@2.0.1(transitive)
+ Addedreadable-stream@2.3.6(transitive)
+ Addedsafe-buffer@5.1.2(transitive)
+ Addedsqlstring@2.3.1(transitive)
+ Addedstring_decoder@1.1.1(transitive)
- Removedbignumber.js@4.0.4(transitive)
- Removedprocess-nextick-args@1.0.7(transitive)
- Removedreadable-stream@2.3.3(transitive)
- Removedsafe-buffer@5.1.1(transitive)
- Removedsqlstring@2.3.0(transitive)
- Removedstring_decoder@1.0.3(transitive)
Updatedbignumber.js@4.1.0
Updatedreadable-stream@2.3.6
Updatedsafe-buffer@5.1.2
Updatedsqlstring@2.3.1