mysql2 3.5.2 → 3.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/connection.js CHANGED
@@ -615,10 +615,15 @@ class Connection extends EventEmitter {
615
615
  }
616
616
 
617
617
  execute(sql, values, cb) {
618
- let options = {};
618
+ let options = {
619
+ infileStreamFactory: this.config.infileStreamFactory
620
+ };
619
621
  if (typeof sql === 'object') {
620
622
  // execute(options, cb)
621
- options = sql;
623
+ options = {
624
+ ...options,
625
+ ...sql
626
+ };
622
627
  if (typeof values === 'function') {
623
628
  cb = values;
624
629
  } else {
@@ -899,11 +904,15 @@ class Connection extends EventEmitter {
899
904
 
900
905
  static createQuery(sql, values, cb, config) {
901
906
  let options = {
902
- rowsAsArray: config.rowsAsArray
907
+ rowsAsArray: config.rowsAsArray,
908
+ infileStreamFactory: config.infileStreamFactory
903
909
  };
904
910
  if (typeof sql === 'object') {
905
911
  // query(options, cb)
906
- options = sql;
912
+ options = {
913
+ ...options,
914
+ ...sql
915
+ };
907
916
  if (typeof values === 'function') {
908
917
  cb = values;
909
918
  } else if (values !== undefined) {
@@ -30,6 +30,7 @@ const validOptions = {
30
30
  flags: 1,
31
31
  host: 1,
32
32
  insecureAuth: 1,
33
+ infileStreamFactory: 1,
33
34
  isServer: 1,
34
35
  keepAliveInitialDelay: 1,
35
36
  localAddress: 1,
@@ -108,6 +109,7 @@ class ConnectionConfig {
108
109
  ? 10 * 1000
109
110
  : options.connectTimeout;
110
111
  this.insecureAuth = options.insecureAuth || false;
112
+ this.infileStreamFactory = options.infileStreamFactory || undefined;
111
113
  this.supportBigNumbers = options.supportBigNumbers || false;
112
114
  this.bigNumberStrings = options.bigNumberStrings || false;
113
115
  this.decimalNumbers = options.decimalNumbers || false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mysql2",
3
- "version": "3.5.2",
3
+ "version": "3.6.1",
4
4
  "description": "fast mysql driver. Implements core protocol, prepared statements, ssl and compression in native JS",
5
5
  "main": "index.js",
6
6
  "directories": {
@@ -75,7 +75,7 @@
75
75
  "c8": "^8.0.0",
76
76
  "error-stack-parser": "^2.0.3",
77
77
  "eslint": "^8.27.0",
78
- "eslint-config-prettier": "^8.5.0",
78
+ "eslint-config-prettier": "^9.0.0",
79
79
  "eslint-plugin-async-await": "0.0.0",
80
80
  "eslint-plugin-markdown": "^3.0.0",
81
81
  "husky": "^8.0.2",
package/promise.d.ts CHANGED
@@ -115,7 +115,7 @@ export interface PoolCluster extends EventEmitter {
115
115
 
116
116
  of(pattern: string, selector?: string): PoolNamespace;
117
117
 
118
- on(event: string, listener: (args: any[]) => void): this;
118
+ on(event: string, listener: (...args: any[]) => void): this;
119
119
  on(event: 'remove', listener: (nodeId: number) => void): this;
120
120
  on(event: 'warn', listener: (err: Error) => void): this;
121
121
  }
@@ -4,6 +4,7 @@
4
4
  // Modifications copyright (c) 2021, Oracle and/or its affiliates.
5
5
 
6
6
  import { EventEmitter } from 'events';
7
+ import { Readable } from 'stream';
7
8
  import { Query, QueryError } from './protocol/sequences/Query.js';
8
9
  import { Prepare, PrepareStatementInfo } from './protocol/sequences/Prepare.js';
9
10
  import {
@@ -165,6 +166,11 @@ export interface ConnectionOptions {
165
166
  */
166
167
  insecureAuth?: boolean;
167
168
 
169
+ /**
170
+ * By specifying a function that returns a readable stream, an arbitrary stream can be sent when sending a local fs file.
171
+ */
172
+ infileStreamFactory?: (path: string) => Readable;
173
+
168
174
  /**
169
175
  * Determines if column values should be converted to native JavaScript types. It is not recommended (and may go away / change in the future)
170
176
  * to disable type casting, but you can currently do so on either the connection or query level. (Default: true)
@@ -351,7 +357,7 @@ declare class Connection extends QueryableBase(ExecutableBase(EventEmitter)) {
351
357
 
352
358
  format(sql: string, values?: any | any[] | { [param: string]: any }): string;
353
359
 
354
- on(event: string, listener: (args: any[]) => void): this;
360
+ on(event: string, listener: (...args: any[]) => void): this;
355
361
 
356
362
  rollback(callback: (err: QueryError | null) => void): void;
357
363
 
@@ -63,7 +63,7 @@ declare class Pool extends QueryableBase(ExecutableBase(EventEmitter)) {
63
63
  callback?: (err: NodeJS.ErrnoException | null, ...args: any[]) => any
64
64
  ): void;
65
65
 
66
- on(event: string, listener: (args: any[]) => void): this;
66
+ on(event: string, listener: (...args: any[]) => void): this;
67
67
  on(event: 'connection', listener: (connection: PoolConnection) => any): this;
68
68
  on(event: 'acquire', listener: (connection: PoolConnection) => any): this;
69
69
  on(event: 'release', listener: (connection: PoolConnection) => any): this;
@@ -78,7 +78,7 @@ declare class PoolCluster extends EventEmitter {
78
78
 
79
79
  of(pattern: string, selector?: string): PoolNamespace;
80
80
 
81
- on(event: string, listener: (args: any[]) => void): this;
81
+ on(event: string, listener: (...args: any[]) => void): this;
82
82
  on(event: 'remove', listener: (nodeId: number) => void): this;
83
83
  on(event: 'warn', listener: (err: Error) => void): this;
84
84
  }
@@ -133,7 +133,7 @@ declare class Query extends Sequence {
133
133
  */
134
134
  stream(options?: StreamOptions): Readable;
135
135
 
136
- on(event: string, listener: (args: any[]) => void): this;
136
+ on(event: string, listener: (...args: any[]) => void): this;
137
137
  on(event: 'error', listener: (err: QueryError) => any): this;
138
138
  on(
139
139
  event: 'fields',