mirror of
https://github.com/darksaid98/oxmysql.git
synced 2026-12-02 22:22:50 +00:00
376 lines
16 KiB
Diff
376 lines
16 KiB
Diff
# generated by patch-package 6.4.14
|
|
#
|
|
# declared package:
|
|
# mysql2: ^3.2.0
|
|
#
|
|
diff --git a/node_modules/mysql2/index.d.ts b/node_modules/mysql2/index.d.ts
|
|
index ec138d2..968c32f 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 790226a..732be9d 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();
|
|
@@ -528,7 +526,7 @@ class Connection extends EventEmitter {
|
|
sql: sql,
|
|
values: values
|
|
};
|
|
- this._resolveNamedPlaceholders(opts);
|
|
+
|
|
return SqlString.format(
|
|
opts.sql,
|
|
opts.values,
|
|
@@ -549,23 +547,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) {
|
|
@@ -573,7 +554,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);
|
|
@@ -641,26 +622,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 edb7fcf..de5b51f 100644
|
|
--- a/node_modules/mysql2/lib/connection_config.js
|
|
+++ b/node_modules/mysql2/lib/connection_config.js
|
|
@@ -213,7 +213,6 @@ class ConnectionConfig {
|
|
'LONG_PASSWORD',
|
|
'FOUND_ROWS',
|
|
'LONG_FLAG',
|
|
- 'CONNECT_WITH_DB',
|
|
'ODBC',
|
|
'LOCAL_FILES',
|
|
'IGNORE_SPACE',
|
|
@@ -227,9 +226,12 @@ class ConnectionConfig {
|
|
'SESSION_TRACK',
|
|
'CONNECT_ATTRS'
|
|
];
|
|
- 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');
|
|
}
|
|
+
|
|
defaultFlags.push('PLUGIN_AUTH');
|
|
defaultFlags.push('PLUGIN_AUTH_LENENC_CLIENT_DATA');
|
|
|
|
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 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;
|
|
diff --git a/node_modules/mysql2/promise.d.ts b/node_modules/mysql2/promise.d.ts
|
|
index b5441ab..c4ddfbe 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 08a51b4..49ff4af 100644
|
|
--- a/node_modules/mysql2/typings/mysql/lib/Connection.d.ts
|
|
+++ b/node_modules/mysql2/typings/mysql/lib/Connection.d.ts
|
|
@@ -259,7 +259,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 4d7ac68..ffeb667 100644
|
|
--- a/node_modules/mysql2/typings/mysql/lib/Pool.d.ts
|
|
+++ b/node_modules/mysql2/typings/mysql/lib/Pool.d.ts
|
|
@@ -62,7 +62,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;
|
|
|