mysql2 3.17.5 → 3.18.0
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/base/connection.js +6 -0
- package/lib/base/pool.js +6 -0
- package/lib/base/pool_connection.js +4 -0
- package/lib/pool_cluster.js +6 -0
- package/lib/promise/connection.js +6 -0
- package/lib/promise/pool.js +6 -0
- package/lib/promise/pool_connection.js +4 -0
- package/package.json +1 -1
- package/promise.d.ts +5 -0
- package/promise.js +6 -0
- package/typings/mysql/lib/Connection.d.ts +2 -0
- package/typings/mysql/lib/Pool.d.ts +2 -0
- package/typings/mysql/lib/PoolCluster.d.ts +2 -0
- package/typings/mysql/lib/PoolConnection.d.ts +1 -0
package/lib/base/connection.js
CHANGED
|
@@ -926,6 +926,12 @@ class BaseConnection extends EventEmitter {
|
|
|
926
926
|
return this.addCommand(new Commands.ServerHandshake(args));
|
|
927
927
|
}
|
|
928
928
|
|
|
929
|
+
[Symbol.dispose]() {
|
|
930
|
+
if (!this._closing) {
|
|
931
|
+
this.end();
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
|
|
929
935
|
// ===============================================================
|
|
930
936
|
end(callback) {
|
|
931
937
|
if (this.config.isServer) {
|
package/lib/base/pool.js
CHANGED
package/lib/pool_cluster.js
CHANGED
|
@@ -66,6 +66,12 @@ class PromiseConnection extends EventEmitter {
|
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
+
async [Symbol.asyncDispose]() {
|
|
70
|
+
if (!this.connection._closing) {
|
|
71
|
+
await this.end();
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
69
75
|
beginTransaction() {
|
|
70
76
|
const c = this.connection;
|
|
71
77
|
const localErr = new Error();
|
package/lib/promise/pool.js
CHANGED
package/package.json
CHANGED
package/promise.d.ts
CHANGED
|
@@ -65,6 +65,8 @@ export interface Connection extends QueryableAndExecutableBase {
|
|
|
65
65
|
|
|
66
66
|
end(options?: any): Promise<void>;
|
|
67
67
|
|
|
68
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
69
|
+
|
|
68
70
|
destroy(): void;
|
|
69
71
|
|
|
70
72
|
pause(): void;
|
|
@@ -82,6 +84,7 @@ export interface Connection extends QueryableAndExecutableBase {
|
|
|
82
84
|
export interface PoolConnection extends Connection {
|
|
83
85
|
release(): void;
|
|
84
86
|
connection: Connection;
|
|
87
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
85
88
|
}
|
|
86
89
|
|
|
87
90
|
export interface Pool extends Connection {
|
|
@@ -112,6 +115,8 @@ export interface PoolCluster extends EventEmitter {
|
|
|
112
115
|
|
|
113
116
|
end(): Promise<void>;
|
|
114
117
|
|
|
118
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
119
|
+
|
|
115
120
|
getConnection(): Promise<PoolConnection>;
|
|
116
121
|
getConnection(group: string): Promise<PoolConnection>;
|
|
117
122
|
getConnection(group: string, selector: string): Promise<PoolConnection>;
|
package/promise.js
CHANGED
|
@@ -393,6 +393,8 @@ declare class Connection extends QueryableBase(ExecutableBase(EventEmitter)) {
|
|
|
393
393
|
end(callback?: (err: QueryError | null) => void): void;
|
|
394
394
|
end(options: any, callback?: (err: QueryError | null) => void): void;
|
|
395
395
|
|
|
396
|
+
[Symbol.dispose](): void;
|
|
397
|
+
|
|
396
398
|
destroy(): void;
|
|
397
399
|
|
|
398
400
|
pause(): void;
|
|
@@ -53,6 +53,8 @@ declare class Pool extends QueryableBase(ExecutableBase(EventEmitter)) {
|
|
|
53
53
|
callback?: (err: NodeJS.ErrnoException | null, ...args: any[]) => any
|
|
54
54
|
): void;
|
|
55
55
|
|
|
56
|
+
[Symbol.dispose](): void;
|
|
57
|
+
|
|
56
58
|
on(event: string, listener: (...args: any[]) => void): this;
|
|
57
59
|
on(event: 'connection', listener: (connection: PoolConnection) => any): this;
|
|
58
60
|
on(event: 'acquire', listener: (connection: PoolConnection) => any): this;
|