mysql2 3.11.1 → 3.11.3-canary.81be01b1
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 +4 -4
- package/lib/parsers/parser_cache.js +3 -3
- package/lib/parsers/string.js +2 -2
- package/package.json +2 -2
- package/typings/mysql/index.d.ts +12 -11
package/lib/connection.js
CHANGED
|
@@ -22,7 +22,7 @@ const EventEmitter = require('events').EventEmitter;
|
|
|
22
22
|
const Readable = require('stream').Readable;
|
|
23
23
|
const Queue = require('denque');
|
|
24
24
|
const SqlString = require('sqlstring');
|
|
25
|
-
const
|
|
25
|
+
const { createLRU } = require('lru.min');
|
|
26
26
|
|
|
27
27
|
const PacketParser = require('./packet_parser.js');
|
|
28
28
|
const Packets = require('./packets/index.js');
|
|
@@ -75,9 +75,9 @@ class Connection extends EventEmitter {
|
|
|
75
75
|
this._command = null;
|
|
76
76
|
this._paused = false;
|
|
77
77
|
this._paused_packets = new Queue();
|
|
78
|
-
this._statements =
|
|
78
|
+
this._statements = createLRU({
|
|
79
79
|
max: this.config.maxPreparedStatements,
|
|
80
|
-
|
|
80
|
+
onEviction: function(_, statement) {
|
|
81
81
|
statement.close();
|
|
82
82
|
}
|
|
83
83
|
});
|
|
@@ -411,7 +411,7 @@ class Connection extends EventEmitter {
|
|
|
411
411
|
err.code = code || 'PROTOCOL_ERROR';
|
|
412
412
|
this.emit('error', err);
|
|
413
413
|
}
|
|
414
|
-
|
|
414
|
+
|
|
415
415
|
get fatalError() {
|
|
416
416
|
return this._fatalError;
|
|
417
417
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const { createLRU } = require('lru.min');
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
const parserCache = createLRU({
|
|
6
6
|
max: 15000,
|
|
7
7
|
});
|
|
8
8
|
|
|
@@ -51,7 +51,7 @@ function getParser(type, fields, options, config, compiler) {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
function setMaxCache(max) {
|
|
54
|
-
parserCache
|
|
54
|
+
parserCache.resize(max);
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
function clearCache() {
|
package/lib/parsers/string.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mysql2",
|
|
3
|
-
"version": "3.11.
|
|
3
|
+
"version": "3.11.3-canary.81be01b1",
|
|
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",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"generate-function": "^2.3.1",
|
|
64
64
|
"iconv-lite": "^0.6.3",
|
|
65
65
|
"long": "^5.2.1",
|
|
66
|
-
"lru
|
|
66
|
+
"lru.min": "^1.0.0",
|
|
67
67
|
"named-placeholders": "^1.1.3",
|
|
68
68
|
"seq-queue": "^0.0.5",
|
|
69
69
|
"sqlstring": "^2.3.2"
|
package/typings/mysql/index.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* sqlstring types are based on https://www.npmjs.com/package/@types/sqlstring, version 2.3.2
|
|
3
|
+
*/
|
|
1
4
|
import { Pool as BasePool, PoolOptions } from './lib/Pool.js';
|
|
2
5
|
import {
|
|
3
6
|
Connection as BaseConnection,
|
|
@@ -53,23 +56,21 @@ export function createPool(config: PoolOptions): BasePool;
|
|
|
53
56
|
|
|
54
57
|
export function createPoolCluster(config?: PoolClusterOptions): PoolCluster;
|
|
55
58
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
export function format(sql: string): string;
|
|
61
|
-
export function format(
|
|
62
|
-
sql: string,
|
|
63
|
-
values: any[],
|
|
59
|
+
type TimeZone = 'local' | 'Z' | (string & NonNullable<unknown>);
|
|
60
|
+
export function escape(
|
|
61
|
+
value: any,
|
|
64
62
|
stringifyObjects?: boolean,
|
|
65
|
-
timeZone?:
|
|
63
|
+
timeZone?: TimeZone,
|
|
66
64
|
): string;
|
|
67
65
|
|
|
66
|
+
export function escapeId(value: any, forbidQualified?: boolean): string;
|
|
67
|
+
|
|
68
|
+
export function format(sql: string): string;
|
|
68
69
|
export function format(
|
|
69
70
|
sql: string,
|
|
70
|
-
values: any,
|
|
71
|
+
values: any | any[],
|
|
71
72
|
stringifyObjects?: boolean,
|
|
72
|
-
timeZone?:
|
|
73
|
+
timeZone?: TimeZone,
|
|
73
74
|
): string;
|
|
74
75
|
|
|
75
76
|
export function raw(sql: string): {
|