mysql2 3.24.6 → 3.24.7-canary.b6806a9

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/index.js CHANGED
@@ -42,6 +42,7 @@ exports.escape = SqlString.escape;
42
42
  exports.escapeId = SqlString.escapeId;
43
43
  exports.format = SqlString.format;
44
44
  exports.raw = SqlString.raw;
45
+ exports.expand = SqlString.expand;
45
46
 
46
47
  exports.__defineGetter__(
47
48
  'createConnectionPromise',
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const Timers = require('timers');
4
+ const SqlString = require('sql-escaper');
4
5
 
5
6
  const Command = require('./command.js');
6
7
  const Query = require('./query.js');
@@ -10,9 +11,24 @@ const ConnectionConfig = require('../connection_config.js');
10
11
  const getBinaryParser = require('../parsers/binary_parser.js');
11
12
  const getStaticBinaryParser = require('../parsers/static_binary_parser.js');
12
13
 
14
+ const isExpandMark = (value) =>
15
+ typeof value === 'object' &&
16
+ value !== null &&
17
+ Object.prototype.hasOwnProperty.call(value, SqlString.EXPAND_SYMBOL);
18
+
13
19
  class Execute extends Command {
14
20
  constructor(options, callback) {
15
21
  super();
22
+ if (options.values) {
23
+ for (let index = 0; index < options.values.length; index++) {
24
+ if (isExpandMark(options.values[index])) {
25
+ throw new TypeError(
26
+ 'Bind parameters must not contain expand() marks. Use query() instead'
27
+ );
28
+ }
29
+ }
30
+ }
31
+
16
32
  this.statement = options.statement;
17
33
  this.sql = options.sql;
18
34
  this.values = options.values;
@@ -136,7 +136,7 @@ class PoolNamespace {
136
136
  });
137
137
  } catch (e) {
138
138
  conn.release();
139
- throw e;
139
+ return cb(e);
140
140
  }
141
141
  });
142
142
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mysql2",
3
- "version": "3.24.6",
3
+ "version": "3.24.7-canary.b6806a9",
4
4
  "description": "fast mysql driver. Implements core protocol, prepared statements, ssl and compression in native JS",
5
5
  "main": "index.js",
6
6
  "typings": "typings/mysql/index",
@@ -64,7 +64,7 @@
64
64
  "long": "^5.3.2",
65
65
  "lru.min": "^1.1.4",
66
66
  "named-placeholders": "^1.1.6",
67
- "sql-escaper": "^1.5.1"
67
+ "sql-escaper": "^1.7.0"
68
68
  },
69
69
  "peerDependencies": {
70
70
  "@types/node": ">= 8"
package/promise.js CHANGED
@@ -184,6 +184,7 @@ exports.escape = SqlString.escape;
184
184
  exports.escapeId = SqlString.escapeId;
185
185
  exports.format = SqlString.format;
186
186
  exports.raw = SqlString.raw;
187
+ exports.expand = SqlString.expand;
187
188
  exports.Connection = PromiseConnection;
188
189
  exports.PoolConnection = PromisePoolConnection;
189
190
  exports.PromisePool = PromisePool;
@@ -26,8 +26,9 @@ import {
26
26
  escapeId as SqlStringEscapeId,
27
27
  format as SqlStringFormat,
28
28
  raw as SqlStringRaw,
29
+ expand as SqlStringExpand,
29
30
  } from 'sql-escaper';
30
- export type { Raw, SqlValue, Timezone } from 'sql-escaper';
31
+ export type { Expand, Raw, SqlValue, Timezone } from 'sql-escaper';
31
32
 
32
33
  export {
33
34
  ConnectionOptions,
@@ -68,6 +69,7 @@ export const escape: typeof SqlStringEscape;
68
69
  export const escapeId: typeof SqlStringEscapeId;
69
70
  export const format: typeof SqlStringFormat;
70
71
  export const raw: typeof SqlStringRaw;
72
+ export const expand: typeof SqlStringExpand;
71
73
 
72
74
  export interface ConnectionConfig extends ConnectionOptions {
73
75
  mergeFlags(defaultFlags: string[], userFlags: string[] | string): number;
@@ -1,7 +1,7 @@
1
1
  import { Sequence } from './Sequence.js';
2
2
  import { OkPacket, RowDataPacket, FieldPacket } from '../packets/index.js';
3
3
  import { Readable } from 'stream';
4
- import { Raw, Timezone } from 'sql-escaper';
4
+ import { Expand, Raw, Timezone } from 'sql-escaper';
5
5
  import { TypeCast } from '../../parsers/typeCast.js';
6
6
  import { TypedParameterValue } from '../../TypedParameter.js';
7
7
 
@@ -31,6 +31,7 @@ export type QueryValues =
31
31
  | Buffer
32
32
  | Uint8Array
33
33
  | Raw
34
+ | Expand
34
35
  | ({} | null | undefined)[]
35
36
  | { [key: string]: QueryValues };
36
37