mysql2 3.24.6 → 3.24.7-canary.54cca37

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.54cca37",
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",
@@ -26,7 +26,8 @@
26
26
  "src:test:bun": "npm run src:build && tsx tools/src/prepare-tests.mts && bun poku --config=tools/src/poku.config.mts",
27
27
  "src:test:deno": "npm run src:build && tsx tools/src/prepare-tests.mts && deno run -A npm:poku --config=tools/src/poku.config.mts",
28
28
  "benchmark": "node ./benchmarks/benchmark.js",
29
- "wait-port": "wait-on"
29
+ "wait-port": "wait-on",
30
+ "checkout": "bash scripts/checkout.sh"
30
31
  },
31
32
  "repository": {
32
33
  "type": "git",
@@ -62,30 +63,30 @@
62
63
  "generate-function": "^2.3.1",
63
64
  "iconv-lite": "^0.7.3",
64
65
  "long": "^5.3.2",
65
- "lru.min": "^1.1.4",
66
+ "lru.min": "^1.1.5",
66
67
  "named-placeholders": "^1.1.6",
67
- "sql-escaper": "^1.5.1"
68
+ "sql-escaper": "^1.7.0"
68
69
  },
69
70
  "peerDependencies": {
70
71
  "@types/node": ">= 8"
71
72
  },
72
73
  "devDependencies": {
73
- "@biomejs/biome": "^2.5.7",
74
+ "@biomejs/biome": "^2.6.8",
74
75
  "@ianvs/prettier-plugin-sort-imports": "^4.7.1",
75
76
  "@pokujs/multi-suite": "^1.0.2",
76
77
  "@rollup/plugin-commonjs": "^29.0.3",
77
78
  "@rollup/plugin-json": "^6.1.0",
78
79
  "@rollup/plugin-node-resolve": "^16.0.3",
79
- "@types/node": "^26.2.0",
80
+ "@types/node": "^26.6.6",
80
81
  "assert-diff": "^3.0.4",
81
82
  "benchmark": "^2.1.4",
82
83
  "c8": "^12.0.0",
83
84
  "error-stack-parser": "^2.1.4",
84
85
  "poku": "^4.5.0",
85
86
  "portfinder": "^1.0.38",
86
- "prettier": "^3.9.6",
87
- "rollup": "^4.62.4",
88
- "tsx": "^4.23.11",
87
+ "prettier": "^3.10.1",
88
+ "rollup": "^4.68.4",
89
+ "tsx": "^4.23.15",
89
90
  "typescript": "^7.0.2"
90
91
  }
91
92
  }
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;
@@ -122,9 +122,9 @@ export interface ConnectionOptions {
122
122
  database?: string;
123
123
 
124
124
  /**
125
- * The charset for the connection. This is called 'collation' in the SQL-level of MySQL (like utf8_general_ci).
126
- * If a SQL-level charset is specified (like utf8mb4) then the default collation for that charset is used.
127
- * (Default: 'UTF8_GENERAL_CI')
125
+ * The charset for the connection. This is called 'collation' in the SQL-level of MySQL (like utf8mb4_unicode_ci).
126
+ * A charset name (like utf8mb4) uses a fixed collation (utf8mb4_general_ci), not the server's default.
127
+ * (Default: 'UTF8MB4_UNICODE_CI')
128
128
  */
129
129
  charset?: string;
130
130
 
@@ -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
 
@@ -58,10 +59,9 @@ export interface QueryOptions {
58
59
  namedPlaceholders?: boolean;
59
60
 
60
61
  /**
61
- * Every operation takes an optional inactivity timeout option. This allows you to specify appropriate timeouts for
62
- * operations. It is important to note that these timeouts are not part of the MySQL protocol, and rather timeout
63
- * operations through the client. This means that when a timeout is reached, the connection it occurred on will be
64
- * destroyed and no further operations can be performed.
62
+ * The maximum time, in milliseconds, that the query may take, counted from when it starts running until its whole
63
+ * result has been received. It is not reset when data arrives. With `stream()`, receiving pauses while the consumer
64
+ * falls behind, so that time counts too.
65
65
  */
66
66
  timeout?: number;
67
67