# generated by patch-package 6.4.14 # # declared package: # mysql2: ^3.5.1 # diff --git a/node_modules/mysql2/lib/connection.js b/node_modules/mysql2/lib/connection.js index d6ad7a4..ceac670 100644 --- a/node_modules/mysql2/lib/connection.js +++ b/node_modules/mysql2/lib/connection.js @@ -32,7 +32,7 @@ const CharsetToEncoding = require('./constants/charset_encodings.js'); let _connectionId = 0; -let convertNamedPlaceholders = null; +// let convertNamedPlaceholders = null; class Connection extends EventEmitter { constructor(opts) { @@ -521,7 +521,7 @@ class Connection extends EventEmitter { sql: sql, values: values }; - this._resolveNamedPlaceholders(opts); + // this._resolveNamedPlaceholders(opts); return SqlString.format( opts.sql, opts.values, @@ -543,20 +543,20 @@ class Connection extends EventEmitter { } _resolveNamedPlaceholders(options) { - let unnamed; - if (this.config.namedPlaceholders || options.namedPlaceholders) { - if (Array.isArray(options.values)) { - // if an array is provided as the values, assume the conversion is not necessary. - // this allows the usage of unnamed placeholders even if the namedPlaceholders flag is enabled. - return - } - if (convertNamedPlaceholders === null) { - convertNamedPlaceholders = require('named-placeholders')(); - } - unnamed = convertNamedPlaceholders(options.sql, options.values); - options.sql = unnamed[0]; - options.values = unnamed[1]; - } + // let unnamed; + // if (this.config.namedPlaceholders || options.namedPlaceholders) { + // if (Array.isArray(options.values)) { + // // if an array is provided as the values, assume the conversion is not necessary. + // // this allows the usage of unnamed placeholders even if the namedPlaceholders flag is enabled. + // return + // } + // if (convertNamedPlaceholders === null) { + // convertNamedPlaceholders = require('named-placeholders')(); + // } + // unnamed = convertNamedPlaceholders(options.sql, options.values); + // options.sql = unnamed[0]; + // options.values = unnamed[1]; + // } } query(sql, values, cb) { @@ -566,7 +566,7 @@ class Connection extends EventEmitter { } else { cmdQuery = Connection.createQuery(sql, values, cb, this.config); } - this._resolveNamedPlaceholders(cmdQuery); + // this._resolveNamedPlaceholders(cmdQuery); const rawSql = this.format(cmdQuery.sql, cmdQuery.values !== undefined ? cmdQuery.values : []); cmdQuery.sql = rawSql; return this.addCommand(cmdQuery); @@ -634,26 +634,27 @@ class Connection extends EventEmitter { options.sql = sql; options.values = values; } - this._resolveNamedPlaceholders(options); + // this._resolveNamedPlaceholders(options); // check for values containing undefined if (options.values) { //If namedPlaceholder is not enabled and object is passed as bind parameters - if (!Array.isArray(options.values)) { - throw new TypeError( - 'Bind parameters must be array if namedPlaceholders parameter is not enabled' - ); - } + // if (!Array.isArray(options.values)) { + // throw new TypeError( + // 'Bind parameters must be array if namedPlaceholders parameter is not enabled' + // ); + // } options.values.forEach(val => { //If namedPlaceholder is not enabled and object is passed as bind parameters - if (!Array.isArray(options.values)) { - throw new TypeError( - 'Bind parameters must be array if namedPlaceholders parameter is not enabled' - ); - } + // if (!Array.isArray(options.values)) { + // throw new TypeError( + // 'Bind parameters must be array if namedPlaceholders parameter is not enabled' + // ); + // } if (val === undefined) { - throw new TypeError( - 'Bind parameters must not contain undefined. To pass SQL NULL specify JS null' - ); + // throw new TypeError( + // 'Bind parameters must not contain undefined. To pass SQL NULL specify JS null' + // ); + val = null } if (typeof val === 'function') { throw new TypeError( diff --git a/node_modules/mysql2/lib/packets/execute.js b/node_modules/mysql2/lib/packets/execute.js index daf1df9..0862ce1 100644 --- a/node_modules/mysql2/lib/packets/execute.js +++ b/node_modules/mysql2/lib/packets/execute.js @@ -28,7 +28,10 @@ function toParameter(value, encoding, timezone) { if (value !== null) { switch (typeof value) { case 'undefined': - throw new TypeError('Bind parameters must not contain undefined'); + // throw new TypeError('Bind parameters must not contain undefined'); + value = ''; + type = Types.NULL; + break; case 'number': type = Types.DOUBLE; diff --git a/node_modules/mysql2/lib/parsers/binary_parser.js b/node_modules/mysql2/lib/parsers/binary_parser.js index bbd2959..80ab00d 100644 --- a/node_modules/mysql2/lib/parsers/binary_parser.js +++ b/node_modules/mysql2/lib/parsers/binary_parser.js @@ -72,7 +72,7 @@ function readCodeFor(field, config, options, fieldNum) { default: if (field.characterSet === Charsets.BINARY) { - return 'packet.readLengthCodedBuffer();'; + return '[...packet.readLengthCodedBuffer()];'; } return `packet.readLengthCodedString(fields[${fieldNum}].encoding)`; } diff --git a/node_modules/mysql2/lib/parsers/text_parser.js b/node_modules/mysql2/lib/parsers/text_parser.js index 49a128c..7eafb2c 100644 --- a/node_modules/mysql2/lib/parsers/text_parser.js +++ b/node_modules/mysql2/lib/parsers/text_parser.js @@ -85,6 +85,7 @@ function compile(fields, options, config) { db: field.schema, table: field.table, name: field.name, + charset: field.characterSet, string: function(encoding = field.encoding) { if (field.columnType === Types.JSON && encoding === field.encoding) { // Since for JSON columns mysql always returns charset 63 (BINARY), diff --git a/node_modules/mysql2/lib/pool.js b/node_modules/mysql2/lib/pool.js index db54a7a..f104061 100644 --- a/node_modules/mysql2/lib/pool.js +++ b/node_modules/mysql2/lib/pool.js @@ -155,7 +155,8 @@ class Pool extends EventEmitter { }); } catch (e) { conn.release(); - throw e; + // throw e; + return cb(e); } }); return cmdQuery;