mirror of
https://github.com/darksaid98/oxmysql.git
synced 2026-12-03 22:20:56 +00:00
chore: update dependencies and patch
This commit is contained in:
1 parent
706c3cf53d
commit
8fe63bc88a
5 files changed
+470
-470
No files matched your search
@@ -0,0 +1,369 @@
|
||||
# generated by patch-package 6.4.14
|
||||
#
|
||||
# declared package:
|
||||
# mysql2: ^2.3.3
|
||||
#
|
||||
diff --git a/node_modules/mysql2/index.d.ts b/node_modules/mysql2/index.d.ts
|
||||
index a465b43..183dc97 100644
|
||||
--- a/node_modules/mysql2/index.d.ts
|
||||
+++ b/node_modules/mysql2/index.d.ts
|
||||
@@ -166,7 +166,6 @@ export interface ConnectionOptions extends mysql.ConnectionOptions {
|
||||
decimalNumbers?: boolean;
|
||||
isServer?: boolean;
|
||||
maxPreparedStatements?: number;
|
||||
- namedPlaceholders?: boolean;
|
||||
nestTables?: boolean | string;
|
||||
passwordSha1?: string;
|
||||
pool?: any;
|
||||
diff --git a/node_modules/mysql2/lib/commands/query.js b/node_modules/mysql2/lib/commands/query.js
|
||||
index e51da3c..a60811a 100644
|
||||
--- a/node_modules/mysql2/lib/commands/query.js
|
||||
+++ b/node_modules/mysql2/lib/commands/query.js
|
||||
@@ -1,6 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
-const process = require('process');
|
||||
const Timers = require('timers');
|
||||
|
||||
const Readable = require('stream').Readable;
|
||||
@@ -19,7 +18,6 @@ class Query extends Command {
|
||||
this.sql = options.sql;
|
||||
this.values = options.values;
|
||||
this._queryOptions = options;
|
||||
- this.namedPlaceholders = options.namedPlaceholders || false;
|
||||
this.onResult = callback;
|
||||
this.timeout = options.timeout;
|
||||
this.queryTimeout = null;
|
||||
@@ -52,6 +50,7 @@ class Query extends Command {
|
||||
this._connection = connection;
|
||||
this.options = Object.assign({}, connection.config, this._queryOptions);
|
||||
this._setTimeout();
|
||||
+ this._time = process.hrtime()
|
||||
|
||||
const cmdPacket = new Packets.Query(
|
||||
this.sql,
|
||||
@@ -73,7 +72,7 @@ class Query extends Command {
|
||||
this.queryTimeout = null;
|
||||
}
|
||||
if (this.onResult) {
|
||||
- let rows, fields;
|
||||
+ let rows, fields, time;
|
||||
if (this._resultIndex === 0) {
|
||||
rows = this._rows[0];
|
||||
fields = this._fields[0];
|
||||
@@ -81,13 +80,14 @@ class Query extends Command {
|
||||
rows = this._rows;
|
||||
fields = this._fields;
|
||||
}
|
||||
+ if (this._time) time = process.hrtime(this._time)[1] / 1000000
|
||||
if (fields) {
|
||||
process.nextTick(() => {
|
||||
- this.onResult(null, rows, fields);
|
||||
+ this.onResult(null, rows, fields, time);
|
||||
});
|
||||
} else {
|
||||
process.nextTick(() => {
|
||||
- this.onResult(null, rows);
|
||||
+ this.onResult(null, rows, undefined, time);
|
||||
});
|
||||
}
|
||||
}
|
||||
diff --git a/node_modules/mysql2/lib/connection.js b/node_modules/mysql2/lib/connection.js
|
||||
index 47970e9..a0fec80 100644
|
||||
--- a/node_modules/mysql2/lib/connection.js
|
||||
+++ b/node_modules/mysql2/lib/connection.js
|
||||
@@ -27,8 +27,6 @@ const CharsetToEncoding = require('./constants/charset_encodings.js');
|
||||
|
||||
let _connectionId = 0;
|
||||
|
||||
-let convertNamedPlaceholders = null;
|
||||
-
|
||||
class Connection extends EventEmitter {
|
||||
constructor(opts) {
|
||||
super();
|
||||
@@ -495,7 +493,6 @@ class Connection extends EventEmitter {
|
||||
sql: sql,
|
||||
values: values
|
||||
};
|
||||
- this._resolveNamedPlaceholders(opts);
|
||||
return SqlString.format(
|
||||
opts.sql,
|
||||
opts.values,
|
||||
@@ -516,23 +513,6 @@ class Connection extends EventEmitter {
|
||||
return SqlString.raw(sql);
|
||||
}
|
||||
|
||||
- _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];
|
||||
- }
|
||||
- }
|
||||
-
|
||||
query(sql, values, cb) {
|
||||
let cmdQuery;
|
||||
if (sql.constructor === Commands.Query) {
|
||||
@@ -540,7 +520,6 @@ class Connection extends EventEmitter {
|
||||
} else {
|
||||
cmdQuery = Connection.createQuery(sql, values, cb, this.config);
|
||||
}
|
||||
- this._resolveNamedPlaceholders(cmdQuery);
|
||||
const rawSql = this.format(cmdQuery.sql, cmdQuery.values !== undefined ? cmdQuery.values : []);
|
||||
cmdQuery.sql = rawSql;
|
||||
return this.addCommand(cmdQuery);
|
||||
@@ -608,26 +587,11 @@ class Connection extends EventEmitter {
|
||||
options.sql = sql;
|
||||
options.values = values;
|
||||
}
|
||||
- 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'
|
||||
- );
|
||||
- }
|
||||
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 (val === undefined) {
|
||||
- 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/connection_config.js b/node_modules/mysql2/lib/connection_config.js
|
||||
index 11ad01b..6fab74e 100644
|
||||
--- a/node_modules/mysql2/lib/connection_config.js
|
||||
+++ b/node_modules/mysql2/lib/connection_config.js
|
||||
@@ -187,7 +187,6 @@ class ConnectionConfig {
|
||||
'LONG_PASSWORD',
|
||||
'FOUND_ROWS',
|
||||
'LONG_FLAG',
|
||||
- 'CONNECT_WITH_DB',
|
||||
'ODBC',
|
||||
'LOCAL_FILES',
|
||||
'IGNORE_SPACE',
|
||||
@@ -200,15 +199,14 @@ class ConnectionConfig {
|
||||
'TRANSACTIONS',
|
||||
'SESSION_TRACK'
|
||||
];
|
||||
- if (options && options.multipleStatements) {
|
||||
- defaultFlags.push('MULTI_STATEMENTS');
|
||||
+ if (options) {
|
||||
+ if (options.multipleStatements) defaultFlags.push('MULTI_STATEMENTS');
|
||||
+ if (options.database) defaultFlags.push('CONNECT_WITH_DB');
|
||||
+ if (options.connectAttributes) defaultFlags.push('CONNECT_ATTRS')
|
||||
}
|
||||
defaultFlags.push('PLUGIN_AUTH');
|
||||
defaultFlags.push('PLUGIN_AUTH_LENENC_CLIENT_DATA');
|
||||
|
||||
- if (options && options.connectAttributes) {
|
||||
- defaultFlags.push('CONNECT_ATTRS');
|
||||
- }
|
||||
return defaultFlags;
|
||||
}
|
||||
|
||||
diff --git a/node_modules/mysql2/lib/packets/execute.js b/node_modules/mysql2/lib/packets/execute.js
|
||||
index c612f66..02dbe22 100644
|
||||
--- a/node_modules/mysql2/lib/packets/execute.js
|
||||
+++ b/node_modules/mysql2/lib/packets/execute.js
|
||||
@@ -28,7 +28,9 @@ function toParameter(value, encoding, timezone) {
|
||||
if (value !== null) {
|
||||
switch (typeof value) {
|
||||
case '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 0af4a7a..bce66bc 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() {
|
||||
return _this.packet.readLengthCodedString(field.encoding);
|
||||
},
|
||||
diff --git a/node_modules/mysql2/lib/pool.js b/node_modules/mysql2/lib/pool.js
|
||||
index 2ad4998..6a7ab48 100644
|
||||
--- a/node_modules/mysql2/lib/pool.js
|
||||
+++ b/node_modules/mysql2/lib/pool.js
|
||||
@@ -174,7 +174,7 @@ class Pool extends EventEmitter {
|
||||
});
|
||||
} catch (e) {
|
||||
conn.release();
|
||||
- throw e;
|
||||
+ return cb(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
diff --git a/node_modules/mysql2/promise.d.ts b/node_modules/mysql2/promise.d.ts
|
||||
index 6ab3d6f..4d411ec 100644
|
||||
--- a/node_modules/mysql2/promise.d.ts
|
||||
+++ b/node_modules/mysql2/promise.d.ts
|
||||
@@ -25,41 +25,15 @@ export interface Connection extends EventEmitter {
|
||||
changeUser(options: ConnectionOptions): Promise<void>;
|
||||
|
||||
query<T extends RowDataPacket[][] | RowDataPacket[] | OkPacket | OkPacket[] | ResultSetHeader>(
|
||||
- sql: string
|
||||
- ): Promise<[T, FieldPacket[]]>;
|
||||
- query<T extends RowDataPacket[][] | RowDataPacket[] | OkPacket | OkPacket[] | ResultSetHeader>(
|
||||
- sql: string,
|
||||
- values: any | any[] | { [param: string]: any }
|
||||
- ): Promise<[T, FieldPacket[]]>;
|
||||
- query<T extends RowDataPacket[][] | RowDataPacket[] | OkPacket | OkPacket[] | ResultSetHeader>(
|
||||
- options: QueryOptions
|
||||
- ): Promise<[T, FieldPacket[]]>;
|
||||
- query<T extends RowDataPacket[][] | RowDataPacket[] | OkPacket | OkPacket[] | ResultSetHeader>(
|
||||
- options: QueryOptions,
|
||||
- values: any | any[] | { [param: string]: any }
|
||||
- ): Promise<[T, FieldPacket[]]>;
|
||||
+ sql_or_options: string | QueryOptions,
|
||||
+ values?: any | any[] | { [param: string]: any },
|
||||
+ ): Promise<[T, FieldPacket[], number]>;
|
||||
|
||||
execute<
|
||||
T extends RowDataPacket[][] | RowDataPacket[] | OkPacket | OkPacket[] | ResultSetHeader
|
||||
>(
|
||||
- sql: string
|
||||
- ): Promise<[T, FieldPacket[]]>;
|
||||
- execute<
|
||||
- T extends RowDataPacket[][] | RowDataPacket[] | OkPacket | OkPacket[] | ResultSetHeader
|
||||
- >(
|
||||
- sql: string,
|
||||
- values: any | any[] | { [param: string]: any }
|
||||
- ): Promise<[T, FieldPacket[]]>;
|
||||
- execute<
|
||||
- T extends RowDataPacket[][] | RowDataPacket[] | OkPacket | OkPacket[] | ResultSetHeader
|
||||
- >(
|
||||
- options: QueryOptions
|
||||
- ): Promise<[T, FieldPacket[]]>;
|
||||
- execute<
|
||||
- T extends RowDataPacket[][] | RowDataPacket[] | OkPacket | OkPacket[] | ResultSetHeader
|
||||
- >(
|
||||
- options: QueryOptions,
|
||||
- values: any | any[] | { [param: string]: any }
|
||||
+ sql_or_options: string | QueryOptions,
|
||||
+ values?: any | any[] | { [param: string]: any },
|
||||
): Promise<[T, FieldPacket[]]>;
|
||||
|
||||
unprepare(sql: string): void;
|
||||
@@ -86,41 +60,15 @@ export interface PoolConnection extends Connection {
|
||||
|
||||
export interface Pool extends EventEmitter {
|
||||
query<T extends RowDataPacket[][] | RowDataPacket[] | OkPacket | OkPacket[] | ResultSetHeader>(
|
||||
- sql: string
|
||||
- ): Promise<[T, FieldPacket[]]>;
|
||||
- query<T extends RowDataPacket[][] | RowDataPacket[] | OkPacket | OkPacket[] | ResultSetHeader>(
|
||||
- sql: string,
|
||||
- values: any | any[] | { [param: string]: any }
|
||||
- ): Promise<[T, FieldPacket[]]>;
|
||||
- query<T extends RowDataPacket[][] | RowDataPacket[] | OkPacket | OkPacket[] | ResultSetHeader>(
|
||||
- options: QueryOptions
|
||||
- ): Promise<[T, FieldPacket[]]>;
|
||||
- query<T extends RowDataPacket[][] | RowDataPacket[] | OkPacket | OkPacket[] | ResultSetHeader>(
|
||||
- options: QueryOptions,
|
||||
- values: any | any[] | { [param: string]: any }
|
||||
- ): Promise<[T, FieldPacket[]]>;
|
||||
+ sql_or_options: string | QueryOptions,
|
||||
+ values?: any | any[] | { [param: string]: any },
|
||||
+ ): Promise<[T, FieldPacket[], number]>;
|
||||
|
||||
execute<
|
||||
T extends RowDataPacket[][] | RowDataPacket[] | OkPacket | OkPacket[] | ResultSetHeader
|
||||
>(
|
||||
- sql: string
|
||||
- ): Promise<[T, FieldPacket[]]>;
|
||||
- execute<
|
||||
- T extends RowDataPacket[][] | RowDataPacket[] | OkPacket | OkPacket[] | ResultSetHeader
|
||||
- >(
|
||||
- sql: string,
|
||||
- values: any | any[] | { [param: string]: any }
|
||||
- ): Promise<[T, FieldPacket[]]>;
|
||||
- execute<
|
||||
- T extends RowDataPacket[][] | RowDataPacket[] | OkPacket | OkPacket[] | ResultSetHeader
|
||||
- >(
|
||||
- options: QueryOptions
|
||||
- ): Promise<[T, FieldPacket[]]>;
|
||||
- execute<
|
||||
- T extends RowDataPacket[][] | RowDataPacket[] | OkPacket | OkPacket[] | ResultSetHeader
|
||||
- >(
|
||||
- options: QueryOptions,
|
||||
- values: any | any[] | { [param: string]: any }
|
||||
+ sql_or_options: string | QueryOptions,
|
||||
+ values?: any | any[] | { [param: string]: any },
|
||||
): Promise<[T, FieldPacket[]]>;
|
||||
|
||||
getConnection(): Promise<PoolConnection>;
|
||||
diff --git a/node_modules/mysql2/promise.js b/node_modules/mysql2/promise.js
|
||||
index fc74cc0..fea1ccf 100644
|
||||
--- a/node_modules/mysql2/promise.js
|
||||
+++ b/node_modules/mysql2/promise.js
|
||||
@@ -4,7 +4,7 @@ const core = require('./index.js');
|
||||
const EventEmitter = require('events').EventEmitter;
|
||||
|
||||
function makeDoneCb(resolve, reject, localErr) {
|
||||
- return function (err, rows, fields) {
|
||||
+ return function (err, rows, fields, time) {
|
||||
if (err) {
|
||||
localErr.message = err.message;
|
||||
localErr.code = err.code;
|
||||
@@ -14,7 +14,7 @@ function makeDoneCb(resolve, reject, localErr) {
|
||||
localErr.sqlMessage = err.sqlMessage;
|
||||
reject(localErr);
|
||||
} else {
|
||||
- resolve([rows, fields]);
|
||||
+ resolve([rows, fields, time]);
|
||||
}
|
||||
};
|
||||
}
|
||||
diff --git a/node_modules/mysql2/typings/mysql/lib/Connection.d.ts b/node_modules/mysql2/typings/mysql/lib/Connection.d.ts
|
||||
index 4fb126e..2eaf562 100644
|
||||
--- a/node_modules/mysql2/typings/mysql/lib/Connection.d.ts
|
||||
+++ b/node_modules/mysql2/typings/mysql/lib/Connection.d.ts
|
||||
@@ -218,7 +218,7 @@ declare class Connection extends EventEmitter {
|
||||
changeUser(options: Connection.ConnectionOptions, callback?: (err: Query.QueryError | null) => void): void;
|
||||
|
||||
query<T extends RowDataPacket[][] | RowDataPacket[] | OkPacket | OkPacket[] | ResultSetHeader>(sql: string, callback?: (err: Query.QueryError | null, result: T, fields: FieldPacket[]) => any): Query;
|
||||
- query<T extends RowDataPacket[][] | RowDataPacket[] | OkPacket | OkPacket[] | ResultSetHeader>(sql: string, values: any | any[] | { [param: string]: any }, callback?: (err: Query.QueryError | null, result: T, fields: FieldPacket[]) => any): Query;
|
||||
+ query<T extends RowDataPacket[][] | RowDataPacket[] | OkPacket | OkPacket[] | ResultSetHeader>(sql: string, values: any | any[] | { [param: string]: any }, callback?: (err: Query.QueryError | null, result: T, fields: FieldPacket[], executionTime: number) => any): Query;
|
||||
query<T extends RowDataPacket[][] | RowDataPacket[] | OkPacket | OkPacket[] | ResultSetHeader>(options: Query.QueryOptions, callback?: (err: Query.QueryError | null, result: T, fields?: FieldPacket[]) => any): Query;
|
||||
query<T extends RowDataPacket[][] | RowDataPacket[] | OkPacket | OkPacket[] | ResultSetHeader>(options: Query.QueryOptions, values: any | any[] | { [param: string]: any }, callback?: (err: Query.QueryError | null, result: T, fields: FieldPacket[]) => any): Query;
|
||||
|
||||
Reference in new issue
Block a user