mysql2 3.3.0 → 3.3.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/index.d.ts
CHANGED
|
@@ -78,6 +78,7 @@ export interface Connection extends mysql.Connection {
|
|
|
78
78
|
writeEof(warnings?: number, statusFlags?: number): void;
|
|
79
79
|
writeTextResult(rows?: Array<any>, columns?: Array<any>): void;
|
|
80
80
|
writePacket(packet: any): void;
|
|
81
|
+
promise(promiseImpl?: PromiseConstructor): PromiseConnection;
|
|
81
82
|
sequenceId: number;
|
|
82
83
|
}
|
|
83
84
|
|
|
@@ -157,7 +158,7 @@ export interface Pool extends mysql.Connection {
|
|
|
157
158
|
on(event: 'enqueue', listener: () => any): this;
|
|
158
159
|
unprepare(sql: string): mysql.PrepareStatementInfo;
|
|
159
160
|
prepare(sql: string, callback?: (err: mysql.QueryError | null, statement: mysql.PrepareStatementInfo) => any): mysql.Prepare;
|
|
160
|
-
|
|
161
|
+
promise(promiseImpl?: PromiseConstructor): PromisePoolConnection;
|
|
161
162
|
config: mysql.PoolOptions;
|
|
162
163
|
}
|
|
163
164
|
|
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 LRU = require('lru-cache');
|
|
25
|
+
const LRU = require('lru-cache').default;
|
|
26
26
|
|
|
27
27
|
const PacketParser = require('./packet_parser.js');
|
|
28
28
|
const Packets = require('./packets/index.js');
|
package/package.json
CHANGED
package/promise.d.ts
CHANGED
|
@@ -84,6 +84,7 @@ export interface Connection extends EventEmitter {
|
|
|
84
84
|
|
|
85
85
|
export interface PoolConnection extends Connection {
|
|
86
86
|
connection: Connection;
|
|
87
|
+
getConnection(): Promise<PoolConnection>;
|
|
87
88
|
release(): void;
|
|
88
89
|
}
|
|
89
90
|
|
|
@@ -153,6 +154,3 @@ export interface PreparedStatementInfo {
|
|
|
153
154
|
execute(parameters: any[]): Promise<[RowDataPacket[][] | RowDataPacket[] | OkPacket | OkPacket[] | ResultSetHeader, FieldPacket[]]>;
|
|
154
155
|
}
|
|
155
156
|
|
|
156
|
-
export interface PromisePoolConnection extends Connection {
|
|
157
|
-
destroy(): any;
|
|
158
|
-
}
|
package/typings/mysql/index.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ import BasePrepare = require('./lib/protocol/sequences/Prepare');
|
|
|
12
12
|
import {QueryOptions, StreamOptions, QueryError} from './lib/protocol/sequences/Query';
|
|
13
13
|
import {PrepareStatementInfo} from './lib/protocol/sequences/Prepare';
|
|
14
14
|
import Server = require('./lib/Server');
|
|
15
|
-
import { Pool as PromisePool } from '../../promise';
|
|
15
|
+
import { Pool as PromisePool, Connection as PromiseConnection } from '../../promise';
|
|
16
16
|
|
|
17
17
|
export function createConnection(connectionUri: string): Connection;
|
|
18
18
|
export function createConnection(config: BaseConnection.ConnectionOptions): Connection;
|
|
@@ -41,7 +41,7 @@ export * from './lib/protocol/packets/index';
|
|
|
41
41
|
|
|
42
42
|
// Expose class interfaces
|
|
43
43
|
export interface Connection extends BaseConnection {
|
|
44
|
-
promise(promiseImpl?: PromiseConstructor):
|
|
44
|
+
promise(promiseImpl?: PromiseConstructor): PromiseConnection;
|
|
45
45
|
}
|
|
46
46
|
export interface PoolConnection extends BasePoolConnection {}
|
|
47
47
|
export interface Pool extends BasePool {}
|
|
@@ -289,9 +289,11 @@ declare class Connection extends EventEmitter {
|
|
|
289
289
|
|
|
290
290
|
rollback(callback: (err: Query.QueryError | null) => void): void;
|
|
291
291
|
|
|
292
|
-
execute(sql: string, callback?: (err:
|
|
292
|
+
execute<T extends RowDataPacket[][] | RowDataPacket[] | OkPacket | OkPacket[] | ResultSetHeader>(sql: string, callback?: (err: Query.QueryError | null, result: T, fields: FieldPacket[]) => any): Query;
|
|
293
|
+
execute<T extends RowDataPacket[][] | RowDataPacket[] | OkPacket | OkPacket[] | ResultSetHeader>(sql: string, values: any | any[] | { [param: string]: any }, callback?: (err: Query.QueryError | null, result: T, fields: FieldPacket[]) => any): Query;
|
|
294
|
+
execute<T extends RowDataPacket[][] | RowDataPacket[] | OkPacket | OkPacket[] | ResultSetHeader>(options: Query.QueryOptions, callback?: (err: Query.QueryError | null, result: T, fields?: FieldPacket[]) => any): Query;
|
|
295
|
+
execute<T extends RowDataPacket[][] | RowDataPacket[] | OkPacket | OkPacket[] | ResultSetHeader>(options: Query.QueryOptions, values: any | any[] | { [param: string]: any }, callback?: (err: Query.QueryError | null, result: T, fields: FieldPacket[]) => any): Query;
|
|
293
296
|
|
|
294
|
-
execute(sql: string, values: any | any[] | { [param: string]: any }, callback?: (err: any, rows: Array<any>, fields: Array<any>) => any): any;
|
|
295
297
|
|
|
296
298
|
unprepare(sql: string): any;
|
|
297
299
|
|
|
@@ -4,6 +4,7 @@ import {OkPacket, RowDataPacket, FieldPacket, ResultSetHeader} from './protocol/
|
|
|
4
4
|
import Connection = require('./Connection');
|
|
5
5
|
import PoolConnection = require('./PoolConnection');
|
|
6
6
|
import {EventEmitter} from 'events';
|
|
7
|
+
import {PoolConnection as PromisePoolConnection} from '../../../promise';
|
|
7
8
|
|
|
8
9
|
declare namespace Pool {
|
|
9
10
|
|
|
@@ -66,12 +67,17 @@ declare class Pool extends EventEmitter {
|
|
|
66
67
|
query<T extends RowDataPacket[][] | RowDataPacket[] | OkPacket | OkPacket[] | ResultSetHeader>(options: Query.QueryOptions, callback?: (err: Query.QueryError | null, result: T, fields?: FieldPacket[]) => any): Query;
|
|
67
68
|
query<T extends RowDataPacket[][] | RowDataPacket[] | OkPacket | OkPacket[] | ResultSetHeader>(options: Query.QueryOptions, values: any | any[] | { [param: string]: any }, callback?: (err: Query.QueryError | null, result: T, fields: FieldPacket[]) => any): Query;
|
|
68
69
|
|
|
70
|
+
execute<T extends RowDataPacket[][] | RowDataPacket[] | OkPacket | OkPacket[] | ResultSetHeader>(sql: string, callback?: (err: Query.QueryError | null, result: T, fields: FieldPacket[]) => any): Query;
|
|
71
|
+
execute<T extends RowDataPacket[][] | RowDataPacket[] | OkPacket | OkPacket[] | ResultSetHeader>(sql: string, values: any | any[] | { [param: string]: any }, callback?: (err: Query.QueryError | null, result: T, fields: FieldPacket[]) => any): Query;
|
|
72
|
+
execute<T extends RowDataPacket[][] | RowDataPacket[] | OkPacket | OkPacket[] | ResultSetHeader>(options: Query.QueryOptions, callback?: (err: Query.QueryError | null, result: T, fields?: FieldPacket[]) => any): Query;
|
|
73
|
+
execute<T extends RowDataPacket[][] | RowDataPacket[] | OkPacket | OkPacket[] | ResultSetHeader>(options: Query.QueryOptions, values: any | any[] | { [param: string]: any }, callback?: (err: Query.QueryError | null, result: T, fields: FieldPacket[]) => any): Query;
|
|
74
|
+
|
|
69
75
|
end(callback?: (err: NodeJS.ErrnoException | null, ...args: any[]) => any): void;
|
|
70
76
|
|
|
71
77
|
on(event: string, listener: Function): this;
|
|
72
78
|
on(event: 'connection', listener: (connection: PoolConnection) => any): this;
|
|
73
79
|
|
|
74
|
-
promise(promiseImpl?:
|
|
80
|
+
promise(promiseImpl?: PromiseConstructor): PromisePoolConnection;
|
|
75
81
|
}
|
|
76
82
|
|
|
77
83
|
export = Pool;
|