mirror of
https://github.com/darksaid98/oxmysql.git
synced 2026-12-04 14:38:50 +00:00
chore: update dependencies & patches
Something will probably break.
This commit is contained in:
1 parent
f5a9d588cb
commit
e67557992e
5 files changed
+340
-230
No files matched your search
@@ -0,0 +1,379 @@
|
||||
# generated by patch-package 6.4.14
|
||||
#
|
||||
# declared package:
|
||||
# mysql2: ^3.0.1
|
||||
#
|
||||
diff --git a/node_modules/mysql2/index.d.ts b/node_modules/mysql2/index.d.ts
|
||||
index 31195a1..bc1adaa 100644
|
||||
--- a/node_modules/mysql2/index.d.ts
|
||||
+++ b/node_modules/mysql2/index.d.ts
|
||||
@@ -172,7 +172,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..d9218d3 100644
|
||||
--- a/node_modules/mysql2/lib/commands/query.js
|
||||
+++ b/node_modules/mysql2/lib/commands/query.js
|
||||
@@ -19,7 +19,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 +51,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 +73,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 +81,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 7e8a1a0..cc749e0 100644
|
||||
--- a/node_modules/mysql2/lib/connection.js
|
||||
+++ b/node_modules/mysql2/lib/connection.js
|
||||
@@ -32,8 +32,6 @@ const CharsetToEncoding = require('./constants/charset_encodings.js');
|
||||
|
||||
let _connectionId = 0;
|
||||
|
||||
-let convertNamedPlaceholders = null;
|
||||
-
|
||||
class Connection extends EventEmitter {
|
||||
constructor(opts) {
|
||||
super();
|
||||
@@ -526,7 +524,7 @@ class Connection extends EventEmitter {
|
||||
sql: sql,
|
||||
values: values
|
||||
};
|
||||
- this._resolveNamedPlaceholders(opts);
|
||||
+
|
||||
return SqlString.format(
|
||||
opts.sql,
|
||||
opts.values,
|
||||
@@ -547,23 +545,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) {
|
||||
@@ -571,7 +552,7 @@ 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);
|
||||
@@ -639,26 +620,12 @@ 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 98fa1d3..2189e33 100644
|
||||
--- a/node_modules/mysql2/lib/connection_config.js
|
||||
+++ b/node_modules/mysql2/lib/connection_config.js
|
||||
@@ -204,7 +204,6 @@ class ConnectionConfig {
|
||||
'LONG_PASSWORD',
|
||||
'FOUND_ROWS',
|
||||
'LONG_FLAG',
|
||||
- 'CONNECT_WITH_DB',
|
||||
'ODBC',
|
||||
'LOCAL_FILES',
|
||||
'IGNORE_SPACE',
|
||||
@@ -217,15 +216,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 daf1df9..4ed2744 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 6a7ab48..0ebd1d2 100644
|
||||
--- a/node_modules/mysql2/lib/pool.js
|
||||
+++ b/node_modules/mysql2/lib/pool.js
|
||||
@@ -151,7 +151,7 @@ class Pool extends EventEmitter {
|
||||
});
|
||||
} catch (e) {
|
||||
conn.release();
|
||||
- throw e;
|
||||
+ return cb(e);
|
||||
}
|
||||
});
|
||||
return cmdQuery;
|
||||
diff --git a/node_modules/mysql2/promise.d.ts b/node_modules/mysql2/promise.d.ts
|
||||
index b5441ab..9c1b413 100644
|
||||
--- a/node_modules/mysql2/promise.d.ts
|
||||
+++ b/node_modules/mysql2/promise.d.ts
|
||||
@@ -26,41 +26,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[]]>;
|
||||
|
||||
prepare(options: string | QueryOptions): Promise<PreparedStatementInfo>;
|
||||
@@ -89,41 +63,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 a264e77..20c1b68 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 12204cf..b5899ef 100644
|
||||
--- a/node_modules/mysql2/typings/mysql/lib/Connection.d.ts
|
||||
+++ b/node_modules/mysql2/typings/mysql/lib/Connection.d.ts
|
||||
@@ -254,7 +254,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;
|
||||
|
||||
diff --git a/node_modules/mysql2/typings/mysql/lib/Pool.d.ts b/node_modules/mysql2/typings/mysql/lib/Pool.d.ts
|
||||
index bebe039..d6fed9f 100644
|
||||
--- a/node_modules/mysql2/typings/mysql/lib/Pool.d.ts
|
||||
+++ b/node_modules/mysql2/typings/mysql/lib/Pool.d.ts
|
||||
@@ -52,7 +52,7 @@ declare class Pool extends EventEmitter {
|
||||
getConnection(callback: (err: NodeJS.ErrnoException | null, connection: PoolConnection) => any): 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