Socket
Socket
Sign inDemoInstall

mysql

Package Overview
Dependencies
10
Maintainers
4
Versions
65
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.13.0 to 2.14.0

12

Changes.md

@@ -7,2 +7,14 @@ # Changes

## v2.14.0 (2017-07-25)
* Add new Amazon RDS ap-south-1 certificate CA to Amazon RDS SSL profile #1780
* Add new Amazon RDS eu-west-2 certificate CA to Amazon RDS SSL profile #1770
* Add `sql` property to query `Error` objects #1462 #1628 #1629
* Add `sqlMessage` property to `Error` objects #1714
* Fix the MySQL 5.7.17 error codes
* Support Node.js 8.x
* Update `bignumber.js` to 4.0.2
* Update `readable-stream` to 2.3.3
* Use `safe-buffer` for improved Buffer API
## v2.13.0 (2017-01-24)

@@ -9,0 +21,0 @@

11

lib/PoolConnection.js

@@ -42,7 +42,8 @@ var inherits = require('util').inherits;

PoolConnection.prototype.end = function () {
console.warn( 'Calling conn.end() to release a pooled connection is '
+ 'deprecated. In next version calling conn.end() will be '
+ 'restored to default conn.end() behavior. Use '
+ 'conn.release() instead.'
);
console.warn(
'Calling conn.end() to release a pooled connection is ' +
'deprecated. In next version calling conn.end() will be ' +
'restored to default conn.end() behavior. Use ' +
'conn.release() instead.'
);
this.release();

@@ -49,0 +50,0 @@ };

@@ -1,2 +0,2 @@

var Buffer = require('buffer').Buffer;
var Buffer = require('safe-buffer').Buffer;
var Crypto = require('crypto');

@@ -13,5 +13,5 @@ var Auth = exports;

function xor(a, b) {
a = new Buffer(a, 'binary');
b = new Buffer(b, 'binary');
var result = new Buffer(a.length);
a = Buffer.from(a, 'binary');
b = Buffer.from(b, 'binary');
var result = Buffer.allocUnsafe(a.length);
for (var i = 0; i < a.length; i++) {

@@ -26,7 +26,7 @@ result[i] = (a[i] ^ b[i]);

if (!password) {
return new Buffer(0);
return Buffer.alloc(0);
}
// password must be in binary format, not utf8
var stage1 = sha1((new Buffer(password, 'utf8')).toString('binary'));
var stage1 = sha1((Buffer.from(password, 'utf8')).toString('binary'));
var stage2 = sha1(stage1);

@@ -43,6 +43,6 @@ var stage3 = sha1(scramble.toString('binary') + stage2);

nr2 = [0x1234, 0x5671],
result = new Buffer(8);
result = Buffer.alloc(8);
if (typeof password === 'string'){
password = new Buffer(password);
password = Buffer.from(password);
}

@@ -92,3 +92,3 @@

Auth.scramble323 = function(message, password) {
var to = new Buffer(8),
var to = Buffer.allocUnsafe(8),
hashPass = this.hashPassword(password),

@@ -95,0 +95,0 @@ hashMessage = this.hashPassword(message.slice(0, 8)),

@@ -442,4 +442,78 @@ // Certificates for Amazon RDS

+ '8YDWk3IIc1sd0bkZqoau2Q==\n'
+ '-----END CERTIFICATE-----\n',
/**
* Amazon RDS ap-south-1 certificate CA 2016 to 2020
*
* CN = Amazon RDS ap-south-1 CA
* OU = Amazon RDS
* O = Amazon Web Services, Inc.
* L = Seattle
* ST = Washington
* C = US
* P = 2016-05-03T21:29:22Z/2020-03-05T21:29:22Z
* F = F3:A3:C2:52:D9:82:20:AC:8C:62:31:2A:8C:AD:5D:7B:1C:31:F1:DD
*/
'-----BEGIN CERTIFICATE-----\n'
+ 'MIID/TCCAuWgAwIBAgIBTTANBgkqhkiG9w0BAQsFADCBijELMAkGA1UEBhMCVVMx\n'
+ 'EzARBgNVBAgMCldhc2hpbmd0b24xEDAOBgNVBAcMB1NlYXR0bGUxIjAgBgNVBAoM\n'
+ 'GUFtYXpvbiBXZWIgU2VydmljZXMsIEluYy4xEzARBgNVBAsMCkFtYXpvbiBSRFMx\n'
+ 'GzAZBgNVBAMMEkFtYXpvbiBSRFMgUm9vdCBDQTAeFw0xNjA1MDMyMTI5MjJaFw0y\n'
+ 'MDAzMDUyMTI5MjJaMIGQMQswCQYDVQQGEwJVUzETMBEGA1UECAwKV2FzaGluZ3Rv\n'
+ 'bjEQMA4GA1UEBwwHU2VhdHRsZTEiMCAGA1UECgwZQW1hem9uIFdlYiBTZXJ2aWNl\n'
+ 'cywgSW5jLjETMBEGA1UECwwKQW1hem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=\n'
+ '-----END CERTIFICATE-----\n',
/**
* Amazon RDS eu-west-2 certificate CA 2016 to 2020
*
* CN = Amazon RDS eu-west-2 CA
* OU = Amazon RDS
* O = Amazon Web Services, Inc.
* L = Seattle
* ST = Washington
* C = US
* P = 2016-10-10T17:44:42Z/2020-03-05T17:44:42Z
* F = 47:79:51:9F:FF:07:D3:F4:27:D3:AB:64:56:7F:00:45:BB:84:C1:71
*/
'-----BEGIN CERTIFICATE-----\n'
+ 'MIID/DCCAuSgAwIBAgIBUDANBgkqhkiG9w0BAQsFADCBijELMAkGA1UEBhMCVVMx\n'
+ 'EzARBgNVBAgMCldhc2hpbmd0b24xEDAOBgNVBAcMB1NlYXR0bGUxIjAgBgNVBAoM\n'
+ 'GUFtYXpvbiBXZWIgU2VydmljZXMsIEluYy4xEzARBgNVBAsMCkFtYXpvbiBSRFMx\n'
+ 'GzAZBgNVBAMMEkFtYXpvbiBSRFMgUm9vdCBDQTAeFw0xNjEwMTAxNzQ0NDJaFw0y\n'
+ 'MDAzMDUxNzQ0NDJaMIGPMQswCQYDVQQGEwJVUzETMBEGA1UECAwKV2FzaGluZ3Rv\n'
+ 'bjEQMA4GA1UEBwwHU2VhdHRsZTEiMCAGA1UECgwZQW1hem9uIFdlYiBTZXJ2aWNl\n'
+ 'cywgSW5jLjETMBEGA1UECwwKQW1hem9uIFJEUzEgMB4GA1UEAwwXQW1hem9uIFJE\n'
+ 'UyBldS13ZXN0LTIgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDO\n'
+ 'cttLJfubB4XMMIGWNfJISkIdCMGJyOzLiMJaiWB5GYoXKhEl7YGotpy0qklwW3BQ\n'
+ 'a0fmVdcCLX+dIuVQ9iFK+ZcK7zwm7HtdDTCHOCKeOh2IcnU4c/VIokFi6Gn8udM6\n'
+ 'N/Zi5M5OGpVwLVALQU7Yctsn3c95el6MdVx6mJiIPVu7tCVZn88Z2koBQ2gq9P4O\n'
+ 'Sb249SHFqOb03lYDsaqy1NDsznEOhaRBw7DPJFpvmw1lA3/Y6qrExRI06H2VYR2i\n'
+ '7qxwDV50N58fs10n7Ye1IOxTVJsgEA7X6EkRRXqYaM39Z76R894548WHfwXWjUsi\n'
+ 'MEX0RS0/t1GmnUQjvevDAgMBAAGjZjBkMA4GA1UdDwEB/wQEAwIBBjASBgNVHRMB\n'
+ 'Af8ECDAGAQH/AgEAMB0GA1UdDgQWBBQBxmcuRSxERYCtNnSr5xNfySokHjAfBgNV\n'
+ 'HSMEGDAWgBROAu6sPvYVyEztLPUFwY+chAhJgzANBgkqhkiG9w0BAQsFAAOCAQEA\n'
+ 'UyCUQjsF3nUAABjfEZmpksTuUo07aT3KGYt+EMMFdejnBQ0+2lJJFGtT+CDAk1SD\n'
+ 'RSgfEBon5vvKEtlnTf9a3pv8WXOAkhfxnryr9FH6NiB8obISHNQNPHn0ljT2/T+I\n'
+ 'Y6ytfRvKHa0cu3V0NXbJm2B4KEOt4QCDiFxUIX9z6eB4Kditwu05OgQh6KcogOiP\n'
+ 'JesWxBMXXGoDC1rIYTFO7szwDyOHlCcVXJDNsTJhc32oDWYdeIbW7o/5I+aQsrXZ\n'
+ 'C96HykZcgWzz6sElrQxUaT3IoMw/5nmw4uWKKnZnxgI9bY4fpQwMeBZ96iHfFxvH\n'
+ 'mqfEEuC7uUoPofXdBp2ObQ==\n'
+ '-----END CERTIFICATE-----\n'
]
};

@@ -0,1 +1,3 @@

var Buffer = require('safe-buffer').Buffer;
module.exports = ClientAuthenticationPacket;

@@ -49,5 +51,5 @@ function ClientAuthenticationPacket(options) {

writer.writeFiller(1);
writer.writeBuffer(new Buffer(this.database));
writer.writeBuffer(Buffer.from(this.database));
}
}
};

@@ -0,1 +1,2 @@

var Buffer = require('safe-buffer').Buffer;
var Client = require('../constants/client');

@@ -91,7 +92,9 @@

HandshakeInitializationPacket.prototype.scrambleBuff = function() {
var buffer = new Buffer(this.scrambleBuff1.length +
(typeof this.scrambleBuff2 !== 'undefined' ? this.scrambleBuff2.length : 0));
var buffer = null;
this.scrambleBuff1.copy(buffer);
if (typeof this.scrambleBuff2 !== 'undefined') {
if (typeof this.scrambleBuff2 === 'undefined') {
buffer = Buffer.from(this.scrambleBuff1);
} else {
buffer = Buffer.allocUnsafe(this.scrambleBuff1.length + this.scrambleBuff2.length);
this.scrambleBuff1.copy(buffer, 0);
this.scrambleBuff2.copy(buffer, this.scrambleBuff1.length);

@@ -98,0 +101,0 @@ }

@@ -8,2 +8,3 @@ var BIT_16 = Math.pow(2, 16);

var MAX_PACKET_LENGTH = Math.pow(2, 24) - 1;
var Buffer = require('safe-buffer').Buffer;

@@ -18,3 +19,3 @@ module.exports = PacketWriter;

if (!this._buffer) {
this._buffer = new Buffer(0);
this._buffer = Buffer.alloc(0);
this._offset = 0;

@@ -27,3 +28,3 @@ }

this._buffer = new Buffer(length + packets * 4);
this._buffer = Buffer.allocUnsafe(length + packets * 4);
this._offset = 0;

@@ -198,3 +199,3 @@

if (!this._buffer) {
this._buffer = new Buffer(Math.max(BUFFER_ALLOC_SIZE, bytes));
this._buffer = Buffer.alloc(Math.max(BUFFER_ALLOC_SIZE, bytes));
this._offset = 0;

@@ -212,4 +213,4 @@ return;

this._buffer = new Buffer(newSize);
this._buffer = Buffer.alloc(newSize);
oldBuffer.copy(this._buffer);
};

@@ -5,2 +5,3 @@ var MAX_PACKET_LENGTH = Math.pow(2, 24) - 1;

var BigNumber = require('bignumber.js');
var Buffer = require('safe-buffer').Buffer;
var BufferList = require('./BufferList');

@@ -13,3 +14,3 @@

this._supportBigNumbers = options.config && options.config.supportBigNumbers;
this._buffer = new Buffer(0);
this._buffer = Buffer.alloc(0);
this._nextBuffers = new BufferList();

@@ -124,3 +125,3 @@ this._longPacketBuffers = new BufferList();

// Create a new Buffer
buffer = new Buffer(sliceLength + length);
buffer = Buffer.allocUnsafe(sliceLength + length);
offset = 0;

@@ -137,3 +138,3 @@

// Create a new Buffer
buffer = new Buffer(length);
buffer = Buffer.allocUnsafe(length);
offset = 0;

@@ -321,3 +322,3 @@

Parser.prototype.parseBuffer = function(length) {
var response = new Buffer(length);
var response = Buffer.alloc(length);
this._buffer.copy(response, 0, this._offset, this._offset + length);

@@ -350,3 +351,3 @@

var wkbType = byteOrder ? buffer.readUInt32LE(offset) : buffer.readUInt32BE(offset); offset += 4;
switch(wkbType) {
switch (wkbType) {
case 1: // WKBPoint

@@ -360,3 +361,3 @@ var x = byteOrder ? buffer.readDoubleLE(offset) : buffer.readDoubleBE(offset); offset += 8;

result = [];
for(var i = numPoints; i > 0; i--) {
for (var i = numPoints; i > 0; i--) {
var x = byteOrder ? buffer.readDoubleLE(offset) : buffer.readDoubleBE(offset); offset += 8;

@@ -370,6 +371,6 @@ var y = byteOrder ? buffer.readDoubleLE(offset) : buffer.readDoubleBE(offset); offset += 8;

result = [];
for(var i = numRings; i > 0; i--) {
for (var i = numRings; i > 0; i--) {
var numPoints = byteOrder ? buffer.readUInt32LE(offset) : buffer.readUInt32BE(offset); offset += 4;
var line = [];
for(var j = numPoints; j > 0; j--) {
for (var j = numPoints; j > 0; j--) {
var x = byteOrder ? buffer.readDoubleLE(offset) : buffer.readDoubleBE(offset); offset += 8;

@@ -388,3 +389,3 @@ var y = byteOrder ? buffer.readDoubleLE(offset) : buffer.readDoubleBE(offset); offset += 8;

var result = [];
for(var i = num; i > 0; i--) {
for (var i = num; i > 0; i--) {
result.push(parseGeometry());

@@ -457,3 +458,3 @@ }

var buf = null;
var buffer = new Buffer(remainingBytes + this._longPacketBuffers.size);
var buffer = Buffer.allocUnsafe(remainingBytes + this._longPacketBuffers.size);
var offset = 0;

@@ -460,0 +461,0 @@

@@ -98,3 +98,3 @@ var Parser = require('./Parser');

Protocol.prototype.end = function() {
if(this._ended) {
if (this._ended) {
return;

@@ -435,3 +435,3 @@ }

if (this._connection.state !== 'disconnected') {
if(!this._ended) {
if (!this._ended) {
this.end();

@@ -438,0 +438,0 @@ }

@@ -78,4 +78,4 @@ var Sequence = require('./Sequence');

scrambleBuff : (packet.protocol41)
? Auth.token(this._config.password, packet.scrambleBuff())
: Auth.scramble323(packet.scrambleBuff(), this._config.password)
? Auth.token(this._config.password, packet.scrambleBuff())
: Auth.scramble323(packet.scrambleBuff(), this._config.password)
}));

@@ -82,0 +82,0 @@ };

@@ -88,2 +88,4 @@ var Sequence = require('./Sequence');

err.index = this._index;
err.sql = this.sql;
this.end(err, results, fields);

@@ -90,0 +92,0 @@ };

@@ -55,4 +55,6 @@ var Util = require('util');

err.errno = packet.errno;
err.sqlState = packet.sqlState;
err.sqlMessage = packet.message;
err.sqlState = packet.sqlState;
return err;

@@ -59,0 +61,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.13.0",
"version": "2.14.0",
"license": "MIT",

@@ -15,4 +15,5 @@ "author": "Felix Geisendörfer <felix@debuggable.com> (http://debuggable.com/)",

"dependencies": {
"bignumber.js": "3.1.2",
"readable-stream": "1.1.14",
"bignumber.js": "4.0.2",
"readable-stream": "2.3.3",
"safe-buffer": "5.1.1",
"sqlstring": "2.2.0"

@@ -22,9 +23,6 @@ },

"after": "0.8.2",
"eslint": "3.13.1",
"istanbul": "0.4.5",
"require-all": "2.1.0",
"rimraf": "2.2.8",
"seedrandom": "2.4.2",
"timezone-mock": "0.0.0",
"mkdirp": "0.5.1",
"eslint": "4.2.0",
"nyc": "10.3.2",
"seedrandom": "2.4.3",
"timezone-mock": "0.0.5",
"urun": "0.0.8",

@@ -46,5 +44,5 @@ "utest": "0.0.8"

"test": "node test/run.js",
"test-ci": "node test/run-cov.js lcovonly",
"test-cov": "node test/run-cov.js"
"test-ci": "nyc --reporter=text npm test",
"test-cov": "nyc --reporter=html --reporter=text npm test"
}
}

@@ -40,3 +40,3 @@ # mysql

- [Streaming query rows](#streaming-query-rows)
- [Piping results with Streams2](#piping-results-with-streams2)
- [Piping results with Streams](#piping-results-with-streams)
- [Multiple statement queries](#multiple-statement-queries)

@@ -46,2 +46,3 @@ - [Stored procedures](#stored-procedures)

- [Transactions](#transactions)
- [Ping](#ping)
- [Timeouts](#timeouts)

@@ -197,3 +198,3 @@ - [Error handling](#error-handling)

then the default collation for that charset is used. (Default: `'UTF8_GENERAL_CI'`)
* `timezone`: The timezone used to store local dates. (Default: `'local'`)
* `timezone`: The timezone configured on the MySQL server. This is used to type cast server date/time values to JavaScript `Date` object and vice versa. This can be `'local'`, `'Z'`, or an offset in the form `+HH:MM` or `-HH:MM`. (Default: `'local'`)
* `connectTimeout`: The milliseconds before a timeout occurs during the initial connection

@@ -325,3 +326,3 @@ to the MySQL server. (Default: `10000`)

if (error) throw error;
console.log('The solution is: ', rows[0].solution);
console.log('The solution is: ', results[0].solution);
});

@@ -813,3 +814,3 @@ ```

if (error) throw error;
console.log(result.insertId);
console.log(results.insertId);
});

@@ -832,3 +833,3 @@ ```

if (error) throw error;
console.log('deleted ' + result.affectedRows + ' rows');
console.log('deleted ' + results.affectedRows + ' rows');
})

@@ -847,3 +848,3 @@ ```

if (error) throw error;
console.log('changed ' + result.changedRows + ' rows');
console.log('changed ' + results.changedRows + ' rows');
})

@@ -918,10 +919,9 @@ ```

### Piping results with Streams2
### Piping results with Streams
The query object provides a convenience method `.stream([options])` that wraps
query events into a [Readable](http://nodejs.org/api/stream.html#stream_class_stream_readable)
[Streams2](http://blog.nodejs.org/2012/12/20/streams2/) object. This
stream can easily be piped downstream and provides automatic pause/resume,
based on downstream congestion and the optional `highWaterMark`. The
`objectMode` parameter of the stream is set to `true` and cannot be changed
query events into a [Readable Stream](http://nodejs.org/api/stream.html#stream_class_stream_readable)
object. This stream can easily be piped downstream and provides automatic
pause/resume, based on downstream congestion and the optional `highWaterMark`.
The `objectMode` parameter of the stream is set to `true` and cannot be changed
(if you need a byte stream, you will need to use a transform stream, like

@@ -1050,3 +1050,3 @@ [objstream](https://www.npmjs.com/package/objstream) for example).

var log = 'Post ' + result.insertId + ' added';
var log = 'Post ' + results.insertId + ' added';

@@ -1108,3 +1108,3 @@ connection.query('INSERT INTO log SET data=?', log, function (error, results, fields) {

console.log(rows[0].count + ' rows');
console.log(results[0].count + ' rows');
});

@@ -1127,2 +1127,7 @@ ```

will not be defined.
* `err.sql`: String, contains the full SQL of the failed query. This can be
useful when using a higher level interface like an ORM that is generating
the queries.
* `err.sqlMessage`: String, contains the message string that provides a
textual description of the error. Only populated from [MySQL server error][].

@@ -1129,0 +1134,0 @@ [Error]: https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc