mysql2 3.3.4 → 3.4.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/index.d.ts +26 -6
- package/lib/connection.js +3 -1
- package/lib/packets/resultset_header.js +7 -0
- package/package.json +4 -9
- package/promise.d.ts +159 -38
- package/typings/mysql/index.d.ts +74 -47
- package/typings/mysql/lib/Connection.d.ts +408 -293
- package/typings/mysql/lib/Pool.d.ts +178 -79
- package/typings/mysql/lib/PoolCluster.d.ts +58 -45
- package/typings/mysql/lib/PoolConnection.d.ts +4 -5
- package/typings/mysql/lib/Server.d.ts +4 -6
- package/typings/mysql/lib/protocol/packets/Field.d.ts +12 -13
- package/typings/mysql/lib/protocol/packets/FieldPacket.d.ts +18 -19
- package/typings/mysql/lib/protocol/packets/OkPacket.d.ts +12 -13
- package/typings/mysql/lib/protocol/packets/ResultSetHeader.d.ts +11 -12
- package/typings/mysql/lib/protocol/packets/RowDataPacket.d.ts +6 -7
- package/typings/mysql/lib/protocol/packets/index.d.ts +14 -15
- package/typings/mysql/lib/protocol/packets/params/ErrorPacketParams.d.ts +1 -1
- package/typings/mysql/lib/protocol/packets/params/OkPacketParams.d.ts +1 -1
- package/typings/mysql/lib/protocol/sequences/Prepare.d.ts +55 -42
- package/typings/mysql/lib/protocol/sequences/Query.d.ts +143 -142
- package/typings/mysql/lib/protocol/sequences/Sequence.d.ts +3 -3
|
@@ -3,301 +3,416 @@
|
|
|
3
3
|
// connection options relevant for multifactor authentication.
|
|
4
4
|
// Modifications copyright (c) 2021, Oracle and/or its affiliates.
|
|
5
5
|
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* The source IP address to use for TCP connection
|
|
74
|
-
*/
|
|
75
|
-
localAddress?: string;
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* The path to a unix domain socket to connect to. When used host and port are ignored
|
|
79
|
-
*/
|
|
80
|
-
socketPath?: string;
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* The timezone used to store local dates. (Default: 'local')
|
|
84
|
-
*/
|
|
85
|
-
timezone?: string | 'local';
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* The milliseconds before a timeout occurs during the initial connection to the MySQL server. (Default: 10 seconds)
|
|
89
|
-
*/
|
|
90
|
-
connectTimeout?: number;
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Stringify objects instead of converting to values. (Default: 'false')
|
|
94
|
-
*/
|
|
95
|
-
stringifyObjects?: boolean;
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Allow connecting to MySQL instances that ask for the old (insecure) authentication method. (Default: false)
|
|
99
|
-
*/
|
|
100
|
-
insecureAuth?: boolean;
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Determines if column values should be converted to native JavaScript types. It is not recommended (and may go away / change in the future)
|
|
104
|
-
* to disable type casting, but you can currently do so on either the connection or query level. (Default: true)
|
|
105
|
-
*
|
|
106
|
-
* You can also specify a function (field: any, next: () => void) => {} to do the type casting yourself.
|
|
107
|
-
*
|
|
108
|
-
* WARNING: YOU MUST INVOKE the parser using one of these three field functions in your custom typeCast callback. They can only be called once.
|
|
109
|
-
*
|
|
110
|
-
* field.string()
|
|
111
|
-
* field.buffer()
|
|
112
|
-
* field.geometry()
|
|
113
|
-
*
|
|
114
|
-
* are aliases for
|
|
115
|
-
*
|
|
116
|
-
* parser.parseLengthCodedString()
|
|
117
|
-
* parser.parseLengthCodedBuffer()
|
|
118
|
-
* parser.parseGeometryValue()
|
|
119
|
-
*
|
|
120
|
-
* You can find which field function you need to use by looking at: RowDataPacket.prototype._typeCast
|
|
121
|
-
*/
|
|
122
|
-
typeCast?: boolean | ((field: any, next: () => void) => any);
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* A custom query format function
|
|
126
|
-
*/
|
|
127
|
-
queryFormat?: (query: string, values: any) => void;
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* When dealing with big numbers (BIGINT and DECIMAL columns) in the database, you should enable this option
|
|
131
|
-
* (Default: false)
|
|
132
|
-
*/
|
|
133
|
-
supportBigNumbers?: boolean;
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* Enabling both supportBigNumbers and bigNumberStrings forces big numbers (BIGINT and DECIMAL columns) to be
|
|
137
|
-
* always returned as JavaScript String objects (Default: false). Enabling supportBigNumbers but leaving
|
|
138
|
-
* bigNumberStrings disabled will return big numbers as String objects only when they cannot be accurately
|
|
139
|
-
* represented with [JavaScript Number objects](https://262.ecma-international.org/5.1/#sec-8.5)
|
|
140
|
-
* (which happens when they exceed the [-2^53, +2^53] range), otherwise they will be returned as Number objects.
|
|
141
|
-
* This option is ignored if supportBigNumbers is disabled.
|
|
142
|
-
*/
|
|
143
|
-
bigNumberStrings?: boolean;
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* Force date types (TIMESTAMP, DATETIME, DATE) to be returned as strings rather then inflated into JavaScript Date
|
|
147
|
-
* objects. Can be true/false or an array of type names to keep as strings.
|
|
148
|
-
*
|
|
149
|
-
* (Default: false)
|
|
150
|
-
*/
|
|
151
|
-
dateStrings?: boolean | Array<'TIMESTAMP' | 'DATETIME' | 'DATE'>;
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* This will print all incoming and outgoing packets on stdout.
|
|
155
|
-
* You can also restrict debugging to packet types by passing an array of types (strings) to debug;
|
|
156
|
-
*
|
|
157
|
-
* (Default: false)
|
|
158
|
-
*/
|
|
159
|
-
debug?: any;
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* Generates stack traces on Error to include call site of library entrance ('long stack traces'). Slight
|
|
163
|
-
* performance penalty for most calls. (Default: true)
|
|
164
|
-
*/
|
|
165
|
-
trace?: boolean;
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* Allow multiple mysql statements per query. Be careful with this, it exposes you to SQL injection attacks. (Default: false)
|
|
169
|
-
*/
|
|
170
|
-
multipleStatements?: boolean;
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
* List of connection flags to use other than the default ones. It is also possible to blacklist default ones
|
|
174
|
-
*/
|
|
175
|
-
flags?: Array<string>;
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* object with ssl parameters or a string containing name of ssl profile
|
|
179
|
-
*/
|
|
180
|
-
ssl?: string | SslOptions;
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* Return each row as an array, not as an object.
|
|
185
|
-
* This is useful when you have duplicate column names.
|
|
186
|
-
* This can also be set in the `QueryOption` object to be applied per-query.
|
|
187
|
-
*/
|
|
188
|
-
rowsAsArray?: boolean
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
export interface SslOptions {
|
|
192
|
-
/**
|
|
193
|
-
* A string or buffer holding the PFX or PKCS12 encoded private key, certificate and CA certificates
|
|
194
|
-
*/
|
|
195
|
-
pfx?: string;
|
|
196
|
-
|
|
197
|
-
/**
|
|
198
|
-
* Either a string/buffer or list of strings/Buffers holding the PEM encoded private key(s) to use
|
|
199
|
-
*/
|
|
200
|
-
key?: string | string[] | Buffer | Buffer[];
|
|
201
|
-
|
|
202
|
-
/**
|
|
203
|
-
* A string of passphrase for the private key or pfx
|
|
204
|
-
*/
|
|
205
|
-
passphrase?: string;
|
|
206
|
-
|
|
207
|
-
/**
|
|
208
|
-
* A string/buffer or list of strings/Buffers holding the PEM encoded certificate(s)
|
|
209
|
-
*/
|
|
210
|
-
cert?: string | string[] | Buffer | Buffer[];
|
|
211
|
-
|
|
212
|
-
/**
|
|
213
|
-
* Either a string/Buffer or list of strings/Buffers of PEM encoded CA certificates to trust.
|
|
214
|
-
*/
|
|
215
|
-
ca?: string | string[] | Buffer | Buffer[];
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* Either a string or list of strings of PEM encoded CRLs (Certificate Revocation List)
|
|
219
|
-
*/
|
|
220
|
-
crl?: string | string[];
|
|
221
|
-
|
|
222
|
-
/**
|
|
223
|
-
* A string describing the ciphers to use or exclude
|
|
224
|
-
*/
|
|
225
|
-
ciphers?: string;
|
|
226
|
-
|
|
227
|
-
/**
|
|
228
|
-
* You can also connect to a MySQL server without properly providing the appropriate CA to trust. You should not do this.
|
|
229
|
-
*/
|
|
230
|
-
rejectUnauthorized?: boolean;
|
|
231
|
-
|
|
232
|
-
/**
|
|
233
|
-
* Configure the minimum supported version of SSL, the default is TLSv1.2.
|
|
234
|
-
*/
|
|
235
|
-
minVersion?: string;
|
|
236
|
-
|
|
237
|
-
/**
|
|
238
|
-
* Configure the maximum supported version of SSL, the default is TLSv1.3.
|
|
239
|
-
*/
|
|
240
|
-
maxVersion?: string;
|
|
241
|
-
|
|
242
|
-
/**
|
|
243
|
-
* You can verify the server name identity presented on the server certificate when connecting to a MySQL server.
|
|
244
|
-
* You should enable this but it is disabled by default right now for backwards compatibility.
|
|
245
|
-
*/
|
|
246
|
-
verifyIdentity?: boolean;
|
|
247
|
-
}
|
|
6
|
+
import { EventEmitter } from 'events';
|
|
7
|
+
import { Query, QueryError, QueryOptions } from './protocol/sequences/Query.js';
|
|
8
|
+
import {
|
|
9
|
+
OkPacket,
|
|
10
|
+
FieldPacket,
|
|
11
|
+
RowDataPacket,
|
|
12
|
+
ResultSetHeader,
|
|
13
|
+
} from './protocol/packets/index.js';
|
|
14
|
+
|
|
15
|
+
export interface SslOptions {
|
|
16
|
+
/**
|
|
17
|
+
* A string or buffer holding the PFX or PKCS12 encoded private key, certificate and CA certificates
|
|
18
|
+
*/
|
|
19
|
+
pfx?: string;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Either a string/buffer or list of strings/Buffers holding the PEM encoded private key(s) to use
|
|
23
|
+
*/
|
|
24
|
+
key?: string | string[] | Buffer | Buffer[];
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* A string of passphrase for the private key or pfx
|
|
28
|
+
*/
|
|
29
|
+
passphrase?: string;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* A string/buffer or list of strings/Buffers holding the PEM encoded certificate(s)
|
|
33
|
+
*/
|
|
34
|
+
cert?: string | string[] | Buffer | Buffer[];
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Either a string/Buffer or list of strings/Buffers of PEM encoded CA certificates to trust.
|
|
38
|
+
*/
|
|
39
|
+
ca?: string | string[] | Buffer | Buffer[];
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Either a string or list of strings of PEM encoded CRLs (Certificate Revocation List)
|
|
43
|
+
*/
|
|
44
|
+
crl?: string | string[];
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* A string describing the ciphers to use or exclude
|
|
48
|
+
*/
|
|
49
|
+
ciphers?: string;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* You can also connect to a MySQL server without properly providing the appropriate CA to trust. You should not do this.
|
|
53
|
+
*/
|
|
54
|
+
rejectUnauthorized?: boolean;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Configure the minimum supported version of SSL, the default is TLSv1.2.
|
|
58
|
+
*/
|
|
59
|
+
minVersion?: string;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Configure the maximum supported version of SSL, the default is TLSv1.3.
|
|
63
|
+
*/
|
|
64
|
+
maxVersion?: string;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* You can verify the server name identity presented on the server certificate when connecting to a MySQL server.
|
|
68
|
+
* You should enable this but it is disabled by default right now for backwards compatibility.
|
|
69
|
+
*/
|
|
70
|
+
verifyIdentity?: boolean;
|
|
248
71
|
}
|
|
249
72
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
73
|
+
export interface ConnectionOptions {
|
|
74
|
+
/**
|
|
75
|
+
* DECIMAL and NEWDECIMAL types will be returned as numbers if this option is set to `true` ( default: `false`).
|
|
76
|
+
*/
|
|
77
|
+
decimalNumbers?: boolean;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* The MySQL user to authenticate as
|
|
81
|
+
*/
|
|
82
|
+
user?: string;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* The password of that MySQL user
|
|
86
|
+
*/
|
|
87
|
+
password?: string;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Alias for the MySQL user password. Makes a bit more sense in a multifactor authentication setup (see
|
|
91
|
+
* "password2" and "password3")
|
|
92
|
+
*/
|
|
93
|
+
password1?: string;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* 2nd factor authentication password. Mandatory when the authentication policy for the MySQL user account
|
|
97
|
+
* requires an additional authentication method that needs a password.
|
|
98
|
+
* https://dev.mysql.com/doc/refman/8.0/en/multifactor-authentication.html
|
|
99
|
+
*/
|
|
100
|
+
password2?: string;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* 3rd factor authentication password. Mandatory when the authentication policy for the MySQL user account
|
|
104
|
+
* requires two additional authentication methods and the last one needs a password.
|
|
105
|
+
* https://dev.mysql.com/doc/refman/8.0/en/multifactor-authentication.html
|
|
106
|
+
*/
|
|
107
|
+
password3?: string;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Name of the database to use for this connection
|
|
111
|
+
*/
|
|
112
|
+
database?: string;
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* The charset for the connection. This is called 'collation' in the SQL-level of MySQL (like utf8_general_ci).
|
|
116
|
+
* If a SQL-level charset is specified (like utf8mb4) then the default collation for that charset is used.
|
|
117
|
+
* (Default: 'UTF8_GENERAL_CI')
|
|
118
|
+
*/
|
|
119
|
+
charset?: string;
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* The hostname of the database you are connecting to. (Default: localhost)
|
|
123
|
+
*/
|
|
124
|
+
host?: string;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* The port number to connect to. (Default: 3306)
|
|
128
|
+
*/
|
|
129
|
+
port?: number;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* The source IP address to use for TCP connection
|
|
133
|
+
*/
|
|
134
|
+
localAddress?: string;
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* The path to a unix domain socket to connect to. When used host and port are ignored
|
|
138
|
+
*/
|
|
139
|
+
socketPath?: string;
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* The timezone used to store local dates. (Default: 'local')
|
|
143
|
+
*/
|
|
144
|
+
timezone?: string | 'local';
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* The milliseconds before a timeout occurs during the initial connection to the MySQL server. (Default: 10 seconds)
|
|
148
|
+
*/
|
|
149
|
+
connectTimeout?: number;
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Stringify objects instead of converting to values. (Default: 'false')
|
|
153
|
+
*/
|
|
154
|
+
stringifyObjects?: boolean;
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Allow connecting to MySQL instances that ask for the old (insecure) authentication method. (Default: false)
|
|
158
|
+
*/
|
|
159
|
+
insecureAuth?: boolean;
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Determines if column values should be converted to native JavaScript types. It is not recommended (and may go away / change in the future)
|
|
163
|
+
* to disable type casting, but you can currently do so on either the connection or query level. (Default: true)
|
|
164
|
+
*
|
|
165
|
+
* You can also specify a function (field: any, next: () => void) => {} to do the type casting yourself.
|
|
166
|
+
*
|
|
167
|
+
* WARNING: YOU MUST INVOKE the parser using one of these three field functions in your custom typeCast callback. They can only be called once.
|
|
168
|
+
*
|
|
169
|
+
* field.string()
|
|
170
|
+
* field.buffer()
|
|
171
|
+
* field.geometry()
|
|
172
|
+
*
|
|
173
|
+
* are aliases for
|
|
174
|
+
*
|
|
175
|
+
* parser.parseLengthCodedString()
|
|
176
|
+
* parser.parseLengthCodedBuffer()
|
|
177
|
+
* parser.parseGeometryValue()
|
|
178
|
+
*
|
|
179
|
+
* You can find which field function you need to use by looking at: RowDataPacket.prototype._typeCast
|
|
180
|
+
*/
|
|
181
|
+
typeCast?: boolean | ((field: any, next: () => void) => any);
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* A custom query format function
|
|
185
|
+
*/
|
|
186
|
+
queryFormat?: (query: string, values: any) => void;
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* When dealing with big numbers (BIGINT and DECIMAL columns) in the database, you should enable this option
|
|
190
|
+
* (Default: false)
|
|
191
|
+
*/
|
|
192
|
+
supportBigNumbers?: boolean;
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Enabling both supportBigNumbers and bigNumberStrings forces big numbers (BIGINT and DECIMAL columns) to be
|
|
196
|
+
* always returned as JavaScript String objects (Default: false). Enabling supportBigNumbers but leaving
|
|
197
|
+
* bigNumberStrings disabled will return big numbers as String objects only when they cannot be accurately
|
|
198
|
+
* represented with [JavaScript Number objects](https://262.ecma-international.org/5.1/#sec-8.5)
|
|
199
|
+
* (which happens when they exceed the [-2^53, +2^53] range), otherwise they will be returned as Number objects.
|
|
200
|
+
* This option is ignored if supportBigNumbers is disabled.
|
|
201
|
+
*/
|
|
202
|
+
bigNumberStrings?: boolean;
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Force date types (TIMESTAMP, DATETIME, DATE) to be returned as strings rather then inflated into JavaScript Date
|
|
206
|
+
* objects. Can be true/false or an array of type names to keep as strings.
|
|
207
|
+
*
|
|
208
|
+
* (Default: false)
|
|
209
|
+
*/
|
|
210
|
+
dateStrings?: boolean | Array<'TIMESTAMP' | 'DATETIME' | 'DATE'>;
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* This will print all incoming and outgoing packets on stdout.
|
|
214
|
+
* You can also restrict debugging to packet types by passing an array of types (strings) to debug;
|
|
215
|
+
*
|
|
216
|
+
* (Default: false)
|
|
217
|
+
*/
|
|
218
|
+
debug?: any;
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Generates stack traces on Error to include call site of library entrance ('long stack traces'). Slight
|
|
222
|
+
* performance penalty for most calls. (Default: true)
|
|
223
|
+
*/
|
|
224
|
+
trace?: boolean;
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Allow multiple mysql statements per query. Be careful with this, it exposes you to SQL injection attacks. (Default: false)
|
|
228
|
+
*/
|
|
229
|
+
multipleStatements?: boolean;
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* List of connection flags to use other than the default ones. It is also possible to blacklist default ones
|
|
233
|
+
*/
|
|
234
|
+
flags?: Array<string>;
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* object with ssl parameters or a string containing name of ssl profile
|
|
238
|
+
*/
|
|
239
|
+
ssl?: string | SslOptions;
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Return each row as an array, not as an object.
|
|
243
|
+
* This is useful when you have duplicate column names.
|
|
244
|
+
* This can also be set in the `QueryOption` object to be applied per-query.
|
|
245
|
+
*/
|
|
246
|
+
rowsAsArray?: boolean;
|
|
247
|
+
}
|
|
299
248
|
|
|
300
|
-
|
|
249
|
+
declare class Connection extends EventEmitter {
|
|
250
|
+
config: ConnectionOptions;
|
|
251
|
+
|
|
252
|
+
threadId: number;
|
|
253
|
+
|
|
254
|
+
authorized: boolean;
|
|
255
|
+
|
|
256
|
+
static createQuery<
|
|
257
|
+
T extends
|
|
258
|
+
| RowDataPacket[][]
|
|
259
|
+
| RowDataPacket[]
|
|
260
|
+
| OkPacket
|
|
261
|
+
| OkPacket[]
|
|
262
|
+
| ResultSetHeader
|
|
263
|
+
>(
|
|
264
|
+
sql: string,
|
|
265
|
+
callback?: (err: QueryError | null, result: T, fields: FieldPacket[]) => any
|
|
266
|
+
): Query;
|
|
267
|
+
static createQuery<
|
|
268
|
+
T extends
|
|
269
|
+
| RowDataPacket[][]
|
|
270
|
+
| RowDataPacket[]
|
|
271
|
+
| OkPacket
|
|
272
|
+
| OkPacket[]
|
|
273
|
+
| ResultSetHeader
|
|
274
|
+
>(
|
|
275
|
+
sql: string,
|
|
276
|
+
values: any | any[] | { [param: string]: any },
|
|
277
|
+
callback?: (err: QueryError | null, result: T, fields: FieldPacket[]) => any
|
|
278
|
+
): Query;
|
|
279
|
+
|
|
280
|
+
beginTransaction(callback: (err: QueryError | null) => void): void;
|
|
281
|
+
|
|
282
|
+
connect(callback?: (err: QueryError | null) => void): void;
|
|
283
|
+
|
|
284
|
+
commit(callback?: (err: QueryError | null) => void): void;
|
|
285
|
+
|
|
286
|
+
changeUser(
|
|
287
|
+
options: ConnectionOptions,
|
|
288
|
+
callback?: (err: QueryError | null) => void
|
|
289
|
+
): void;
|
|
290
|
+
|
|
291
|
+
query<
|
|
292
|
+
T extends
|
|
293
|
+
| RowDataPacket[][]
|
|
294
|
+
| RowDataPacket[]
|
|
295
|
+
| OkPacket
|
|
296
|
+
| OkPacket[]
|
|
297
|
+
| ResultSetHeader
|
|
298
|
+
>(
|
|
299
|
+
sql: string,
|
|
300
|
+
callback?: (err: QueryError | null, result: T, fields: FieldPacket[]) => any
|
|
301
|
+
): Query;
|
|
302
|
+
query<
|
|
303
|
+
T extends
|
|
304
|
+
| RowDataPacket[][]
|
|
305
|
+
| RowDataPacket[]
|
|
306
|
+
| OkPacket
|
|
307
|
+
| OkPacket[]
|
|
308
|
+
| ResultSetHeader
|
|
309
|
+
>(
|
|
310
|
+
sql: string,
|
|
311
|
+
values: any | any[] | { [param: string]: any },
|
|
312
|
+
callback?: (err: QueryError | null, result: T, fields: FieldPacket[]) => any
|
|
313
|
+
): Query;
|
|
314
|
+
query<
|
|
315
|
+
T extends
|
|
316
|
+
| RowDataPacket[][]
|
|
317
|
+
| RowDataPacket[]
|
|
318
|
+
| OkPacket
|
|
319
|
+
| OkPacket[]
|
|
320
|
+
| ResultSetHeader
|
|
321
|
+
>(
|
|
322
|
+
options: QueryOptions,
|
|
323
|
+
callback?: (
|
|
324
|
+
err: QueryError | null,
|
|
325
|
+
result: T,
|
|
326
|
+
fields?: FieldPacket[]
|
|
327
|
+
) => any
|
|
328
|
+
): Query;
|
|
329
|
+
query<
|
|
330
|
+
T extends
|
|
331
|
+
| RowDataPacket[][]
|
|
332
|
+
| RowDataPacket[]
|
|
333
|
+
| OkPacket
|
|
334
|
+
| OkPacket[]
|
|
335
|
+
| ResultSetHeader
|
|
336
|
+
>(
|
|
337
|
+
options: QueryOptions,
|
|
338
|
+
values: any | any[] | { [param: string]: any },
|
|
339
|
+
callback?: (err: QueryError | null, result: T, fields: FieldPacket[]) => any
|
|
340
|
+
): Query;
|
|
341
|
+
|
|
342
|
+
execute<
|
|
343
|
+
T extends
|
|
344
|
+
| RowDataPacket[][]
|
|
345
|
+
| RowDataPacket[]
|
|
346
|
+
| OkPacket
|
|
347
|
+
| OkPacket[]
|
|
348
|
+
| ResultSetHeader
|
|
349
|
+
>(
|
|
350
|
+
sql: string,
|
|
351
|
+
callback?: (err: QueryError | null, result: T, fields: FieldPacket[]) => any
|
|
352
|
+
): Query;
|
|
353
|
+
execute<
|
|
354
|
+
T extends
|
|
355
|
+
| RowDataPacket[][]
|
|
356
|
+
| RowDataPacket[]
|
|
357
|
+
| OkPacket
|
|
358
|
+
| OkPacket[]
|
|
359
|
+
| ResultSetHeader
|
|
360
|
+
>(
|
|
361
|
+
sql: string,
|
|
362
|
+
values: any | any[] | { [param: string]: any },
|
|
363
|
+
callback?: (err: QueryError | null, result: T, fields: FieldPacket[]) => any
|
|
364
|
+
): Query;
|
|
365
|
+
execute<
|
|
366
|
+
T extends
|
|
367
|
+
| RowDataPacket[][]
|
|
368
|
+
| RowDataPacket[]
|
|
369
|
+
| OkPacket
|
|
370
|
+
| OkPacket[]
|
|
371
|
+
| ResultSetHeader
|
|
372
|
+
>(
|
|
373
|
+
options: QueryOptions,
|
|
374
|
+
callback?: (
|
|
375
|
+
err: QueryError | null,
|
|
376
|
+
result: T,
|
|
377
|
+
fields?: FieldPacket[]
|
|
378
|
+
) => any
|
|
379
|
+
): Query;
|
|
380
|
+
execute<
|
|
381
|
+
T extends
|
|
382
|
+
| RowDataPacket[][]
|
|
383
|
+
| RowDataPacket[]
|
|
384
|
+
| OkPacket
|
|
385
|
+
| OkPacket[]
|
|
386
|
+
| ResultSetHeader
|
|
387
|
+
>(
|
|
388
|
+
options: QueryOptions,
|
|
389
|
+
values: any | any[] | { [param: string]: any },
|
|
390
|
+
callback?: (err: QueryError | null, result: T, fields: FieldPacket[]) => any
|
|
391
|
+
): Query;
|
|
392
|
+
|
|
393
|
+
end(callback?: (err: QueryError | null) => void): void;
|
|
394
|
+
end(options: any, callback?: (err: QueryError | null) => void): void;
|
|
395
|
+
|
|
396
|
+
destroy(): void;
|
|
397
|
+
|
|
398
|
+
pause(): void;
|
|
399
|
+
|
|
400
|
+
resume(): void;
|
|
401
|
+
|
|
402
|
+
escape(value: any): string;
|
|
403
|
+
|
|
404
|
+
escapeId(value: string): string;
|
|
405
|
+
escapeId(values: string[]): string;
|
|
406
|
+
|
|
407
|
+
format(sql: string, values?: any | any[] | { [param: string]: any }): string;
|
|
408
|
+
|
|
409
|
+
on(event: string, listener: (args: any[]) => void): this;
|
|
410
|
+
|
|
411
|
+
rollback(callback: (err: QueryError | null) => void): void;
|
|
412
|
+
|
|
413
|
+
unprepare(sql: string): any;
|
|
414
|
+
|
|
415
|
+
serverHandshake(args: any): any;
|
|
301
416
|
}
|
|
302
417
|
|
|
303
|
-
export
|
|
418
|
+
export { Connection };
|