Socket
Socket
Sign inDemoInstall

mysql2

Package Overview
Dependencies
Maintainers
3
Versions
184
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mysql2 - npm Package Compare versions

Comparing version 2.3.2 to 2.3.3-rc.0

2

lib/commands/query.js

@@ -215,3 +215,3 @@ 'use strict';

this.emit('fields', fields);
this._rowParser = new (getTextParser(fields, this.options, connection.config))();
this._rowParser = new (getTextParser(fields, this.options, connection.config))(fields);
return Query.prototype.fieldsEOF;

@@ -218,0 +218,0 @@ }

@@ -106,5 +106,3 @@ 'use strict';

get db() {
const start = this._schemaStart;
const end = start._shemaLength;
return this._buf.utf8Slice(start, end);
return this.schema;
}

@@ -111,0 +109,0 @@ }

@@ -81,2 +81,21 @@ 'use strict';

function wrap(field, _this) {
return {
type: typeNames[field.columnType],
length: field.columnLength,
db: field.schema,
table: field.table,
name: field.name,
string: function() {
return _this.packet.readLengthCodedString(field.encoding);
},
buffer: function() {
return _this.packet.readLengthCodedBuffer();
},
geometry: function() {
return _this.packet.parseGeometryValue();
}
};
}
const parserFn = genFunc();

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

// constructor method
parserFn('constructor() {');
parserFn('constructor(fields) {');
// node-mysql typeCast compatibility wrapper

@@ -98,33 +117,5 @@ // see https://github.com/mysqljs/mysql/blob/96fdd0566b654436624e2375c7b6604b1f50f825/lib/protocol/packets/Field.js

parserFn('const _this = this;');
for(let i=0; i<fields.length; ++i) {
const field = fields[i];
const encodingExpr = helpers.srcEscape(field.encoding);
const readCode = readCodeFor(
fields[i].columnType,
fields[i].characterSet,
encodingExpr,
config,
options
);
parserFn(`this.wrap${i} = {
type: ${helpers.srcEscape(typeNames[field.columnType])},
length: ${helpers.srcEscape(field.columnLength)},
db: ${helpers.srcEscape(field.schema)},
table: ${helpers.srcEscape(field.table)},
name: ${helpers.srcEscape(field.name)},
string: function() {
return _this.packet.readLengthCodedString(${encodingExpr});
},
buffer: function() {
return _this.packet.readLengthCodedBuffer();
},
geometry: function() {
return _this.packet.parseGeometryValue();
},
readNext: function() {
const packet = _this.packet;
return ${readCode};
}
};`);
}
parserFn('for(let i=0; i<fields.length; ++i) {');
parserFn('this[`wrap${i}`] = wrap(fields[i], _this);');
parserFn('}');
}

@@ -171,5 +162,3 @@ parserFn('}');

}
if (typeof options.typeCast === 'function') {
parserFn(`${lvalue} = options.typeCast(this.wrap${i}, this.wrap${i}.readNext);`);
} else if (options.typeCast === false) {
if (options.typeCast === false) {
parserFn(`${lvalue} = packet.readLengthCodedBuffer();`);

@@ -185,4 +174,8 @@ } else {

);
parserFn(`${lvalue} = ${readCode};`);
}
if (typeof options.typeCast === 'function') {
parserFn(`${lvalue} = options.typeCast(this.wrap${i}, function() { return ${readCode} });`);
} else {
parserFn(`${lvalue} = ${readCode};`);
}
}
}

@@ -204,2 +197,5 @@

}
if (typeof options.typeCast === 'function') {
return parserFn.toFunction({wrap});
}
return parserFn.toFunction();

@@ -206,0 +202,0 @@ }

{
"name": "mysql2",
"version": "2.3.2",
"version": "2.3.3-rc.0",
"description": "fast mysql driver. Implements core protocol, prepared statements, ssl and compression in native JS",

@@ -14,2 +14,3 @@ "main": "index.js",

"test": "node ./test/run.js",
"coverage-test": "c8 -r cobertura -r lcov -r text node ./test/run.js",
"benchmark": "node ./benchmarks/benchmark.js",

@@ -70,2 +71,3 @@ "prettier": "prettier --single-quote --trailing-comma none --write \"{lib,examples,test}/**/*.js\"",

"benchmark": "^2.1.4",
"c8": "^7.10.0",
"error-stack-parser": "^2.0.3",

@@ -72,0 +74,0 @@ "eslint": "^7.32.0",

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc