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 CHANGED
@@ -1,11 +1,11 @@
1
+ import * as mysql from './typings/mysql/index.js';
1
2
  import {
2
3
  Connection as PromiseConnection,
3
4
  Pool as PromisePool,
4
5
  PoolConnection as PromisePoolConnection,
5
- } from './promise';
6
+ } from './promise.js';
6
7
 
7
- import * as mysql from './typings/mysql';
8
- export * from './typings/mysql';
8
+ export * from './typings/mysql/index.js';
9
9
 
10
10
  export interface Connection extends mysql.Connection {
11
11
  execute<
@@ -72,7 +72,13 @@ export interface Connection extends mysql.Connection {
72
72
  ): mysql.Query;
73
73
  ping(callback?: (err: mysql.QueryError | null) => any): void;
74
74
  unprepare(sql: string): mysql.PrepareStatementInfo;
75
- prepare(sql: string, callback?: (err: mysql.QueryError | null, statement: mysql.PrepareStatementInfo) => any): mysql.Prepare;
75
+ prepare(
76
+ sql: string,
77
+ callback?: (
78
+ err: mysql.QueryError | null,
79
+ statement: mysql.PrepareStatementInfo
80
+ ) => any
81
+ ): mysql.Prepare;
76
82
  serverHandshake(args: any): any;
77
83
  writeOk(args?: mysql.OkPacketParams): void;
78
84
  writeError(args?: mysql.ErrorPacketParams): void;
@@ -154,12 +160,19 @@ export interface Pool extends mysql.Connection {
154
160
  callback: (err: NodeJS.ErrnoException, connection: PoolConnection) => any
155
161
  ): void;
156
162
  releaseConnection(connection: PoolConnection | PromisePoolConnection): void;
163
+ on(event: string, listener: (args: any[]) => void): this;
157
164
  on(event: 'connection', listener: (connection: PoolConnection) => any): this;
158
165
  on(event: 'acquire', listener: (connection: PoolConnection) => any): this;
159
166
  on(event: 'release', listener: (connection: PoolConnection) => any): this;
160
167
  on(event: 'enqueue', listener: () => any): this;
161
168
  unprepare(sql: string): mysql.PrepareStatementInfo;
162
- prepare(sql: string, callback?: (err: mysql.QueryError | null, statement: mysql.PrepareStatementInfo) => any): mysql.Prepare;
169
+ prepare(
170
+ sql: string,
171
+ callback?: (
172
+ err: mysql.QueryError | null,
173
+ statement: mysql.PrepareStatementInfo
174
+ ) => any
175
+ ): mysql.Prepare;
163
176
  promise(promiseImpl?: PromiseConstructor): PromisePool;
164
177
  config: mysql.PoolOptions;
165
178
  }
@@ -195,7 +208,14 @@ export interface ConnectionConfig extends ConnectionOptions {
195
208
  getDefaultFlags(options?: ConnectionOptions): string[];
196
209
  getCharsetNumber(charset: string): number;
197
210
  getSSLProfile(name: string): { ca: string[] };
198
- parseUrl(url: string): { host: string, port: number, database: string, user: string, password: string, [key: string]: any };
211
+ parseUrl(url: string): {
212
+ host: string;
213
+ port: number;
214
+ database: string;
215
+ user: string;
216
+ password: string;
217
+ [key: string]: any;
218
+ };
199
219
  }
200
220
 
201
221
  export interface PoolOptions extends mysql.PoolOptions, ConnectionOptions {}
package/lib/connection.js CHANGED
@@ -54,7 +54,9 @@ class Connection extends EventEmitter {
54
54
 
55
55
  // Optionally enable keep-alive on the socket.
56
56
  if (this.config.enableKeepAlive) {
57
- this.stream.setKeepAlive(true, this.config.keepAliveInitialDelay);
57
+ this.stream.on('connect', () => {
58
+ this.stream.setKeepAlive(true, this.config.keepAliveInitialDelay);
59
+ });
58
60
  }
59
61
 
60
62
  // Enable TCP_NODELAY flag. This is needed so that the network packets
@@ -50,6 +50,7 @@ class ResultSetHeader {
50
50
  stateChanges = {
51
51
  systemVariables: {},
52
52
  schema: null,
53
+ gtids: [],
53
54
  trackStateChange: null
54
55
  };
55
56
  }
@@ -72,6 +73,12 @@ class ResultSetHeader {
72
73
  stateChanges.trackStateChange = packet.readLengthCodedString(
73
74
  encoding
74
75
  );
76
+ } else if (type === sessionInfoTypes.STATE_GTIDS) {
77
+ // TODO: find if the first length coded string means anything. Usually comes as empty
78
+ // eslint-disable-next-line no-unused-vars
79
+ const _unknownString = packet.readLengthCodedString(encoding);
80
+ const gtid = packet.readLengthCodedString(encoding);
81
+ stateChanges.gtids = gtid.split(',');
75
82
  } else {
76
83
  // unsupported session track type. For now just ignore
77
84
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mysql2",
3
- "version": "3.3.4",
3
+ "version": "3.4.0",
4
4
  "description": "fast mysql driver. Implements core protocol, prepared statements, ssl and compression in native JS",
5
5
  "main": "index.js",
6
6
  "directories": {
@@ -9,7 +9,7 @@
9
9
  "typings": "typings/mysql/index",
10
10
  "scripts": {
11
11
  "lint": "npm run lint:docs && npm run lint:code",
12
- "lint:code": "eslint index.js promise.js \"lib/**/*.js\" \"test/**/*.js\" \"benchmarks/**/*.js\"",
12
+ "lint:code": "eslint index.js promise.js index.d.ts promise.d.ts \"typings/**/*.ts\" \"lib/**/*.js\" \"test/**/*.{js,ts}\" \"benchmarks/**/*.js\"",
13
13
  "lint:docs": "eslint Contributing.md README.md \"documentation/**/*.md\" \"examples/*.js\"",
14
14
  "test": "node ./test/run.js",
15
15
  "test:tsc-build": "cd \"test/tsc-build\" && npx tsc -p \"tsconfig.json\"",
@@ -19,8 +19,7 @@
19
19
  "prettier:docs": "prettier --single-quote --trailing-comma none --write README.md documentation/*",
20
20
  "precommit": "lint-staged",
21
21
  "eslint-check": "eslint --print-config .eslintrc | eslint-config-prettier-check",
22
- "wait-port": "wait-on",
23
- "type-test": "node ./node_modules/typescript/bin/tsc -p tests.json && mocha typings/test --timeout 10000"
22
+ "wait-port": "wait-on"
24
23
  },
25
24
  "lint-staged": {
26
25
  "*.js": [
@@ -67,15 +66,12 @@
67
66
  "sqlstring": "^2.3.2"
68
67
  },
69
68
  "devDependencies": {
70
- "@types/chai": "^4.3.4",
71
- "@types/mocha": "^10.0.0",
72
69
  "@types/node": "^20.0.0",
73
70
  "@typescript-eslint/eslint-plugin": "^5.42.1",
74
71
  "@typescript-eslint/parser": "^5.42.1",
75
72
  "assert-diff": "^3.0.2",
76
73
  "benchmark": "^2.1.4",
77
- "c8": "^7.10.0",
78
- "chai": "^4.3.7",
74
+ "c8": "^8.0.0",
79
75
  "error-stack-parser": "^2.0.3",
80
76
  "eslint": "^8.27.0",
81
77
  "eslint-config-prettier": "^8.5.0",
@@ -83,7 +79,6 @@
83
79
  "eslint-plugin-markdown": "^3.0.0",
84
80
  "husky": "^8.0.2",
85
81
  "lint-staged": "^13.0.3",
86
- "mocha": "^10.0.0",
87
82
  "portfinder": "^1.0.28",
88
83
  "prettier": "^2.4.1",
89
84
  "progress": "^2.0.3",
package/promise.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { EventEmitter } from 'events';
2
+
1
3
  import {
2
4
  RowDataPacket,
3
5
  OkPacket,
@@ -6,64 +8,134 @@ import {
6
8
  QueryOptions,
7
9
  ConnectionOptions,
8
10
  PoolOptions,
9
- Pool as CorePool
10
- } from './index';
11
-
12
- import { EventEmitter } from 'events';
13
- export * from './index';
14
-
15
- export interface Connection extends EventEmitter {
16
- config: ConnectionOptions;
17
- threadId: number;
18
-
19
- connect(): Promise<void>;
20
- ping(): Promise<void>;
11
+ Pool as CorePool,
12
+ } from './index.js';
21
13
 
22
- beginTransaction(): Promise<void>;
23
- commit(): Promise<void>;
24
- rollback(): Promise<void>;
14
+ export * from './index.js';
25
15
 
26
- changeUser(options: ConnectionOptions): Promise<void>;
16
+ export interface PreparedStatementInfo {
17
+ close(): Promise<void>;
18
+ execute(
19
+ parameters: any[]
20
+ ): Promise<
21
+ [
22
+ (
23
+ | RowDataPacket[][]
24
+ | RowDataPacket[]
25
+ | OkPacket
26
+ | OkPacket[]
27
+ | ResultSetHeader
28
+ ),
29
+ FieldPacket[]
30
+ ]
31
+ >;
32
+ }
27
33
 
28
- query<T extends RowDataPacket[][] | RowDataPacket[] | OkPacket | OkPacket[] | ResultSetHeader>(
34
+ export interface Connection extends EventEmitter {
35
+ query<
36
+ T extends
37
+ | RowDataPacket[][]
38
+ | RowDataPacket[]
39
+ | OkPacket
40
+ | OkPacket[]
41
+ | ResultSetHeader
42
+ >(
29
43
  sql: string
30
44
  ): Promise<[T, FieldPacket[]]>;
31
- query<T extends RowDataPacket[][] | RowDataPacket[] | OkPacket | OkPacket[] | ResultSetHeader>(
45
+ query<
46
+ T extends
47
+ | RowDataPacket[][]
48
+ | RowDataPacket[]
49
+ | OkPacket
50
+ | OkPacket[]
51
+ | ResultSetHeader
52
+ >(
32
53
  sql: string,
33
54
  values: any | any[] | { [param: string]: any }
34
55
  ): Promise<[T, FieldPacket[]]>;
35
- query<T extends RowDataPacket[][] | RowDataPacket[] | OkPacket | OkPacket[] | ResultSetHeader>(
56
+ query<
57
+ T extends
58
+ | RowDataPacket[][]
59
+ | RowDataPacket[]
60
+ | OkPacket
61
+ | OkPacket[]
62
+ | ResultSetHeader
63
+ >(
36
64
  options: QueryOptions
37
65
  ): Promise<[T, FieldPacket[]]>;
38
- query<T extends RowDataPacket[][] | RowDataPacket[] | OkPacket | OkPacket[] | ResultSetHeader>(
66
+ query<
67
+ T extends
68
+ | RowDataPacket[][]
69
+ | RowDataPacket[]
70
+ | OkPacket
71
+ | OkPacket[]
72
+ | ResultSetHeader
73
+ >(
39
74
  options: QueryOptions,
40
75
  values: any | any[] | { [param: string]: any }
41
76
  ): Promise<[T, FieldPacket[]]>;
42
77
 
43
78
  execute<
44
- T extends RowDataPacket[][] | RowDataPacket[] | OkPacket | OkPacket[] | ResultSetHeader
79
+ T extends
80
+ | RowDataPacket[][]
81
+ | RowDataPacket[]
82
+ | OkPacket
83
+ | OkPacket[]
84
+ | ResultSetHeader
45
85
  >(
46
86
  sql: string
47
87
  ): Promise<[T, FieldPacket[]]>;
48
88
  execute<
49
- T extends RowDataPacket[][] | RowDataPacket[] | OkPacket | OkPacket[] | ResultSetHeader
89
+ T extends
90
+ | RowDataPacket[][]
91
+ | RowDataPacket[]
92
+ | OkPacket
93
+ | OkPacket[]
94
+ | ResultSetHeader
50
95
  >(
51
96
  sql: string,
52
97
  values: any | any[] | { [param: string]: any }
53
98
  ): Promise<[T, FieldPacket[]]>;
54
99
  execute<
55
- T extends RowDataPacket[][] | RowDataPacket[] | OkPacket | OkPacket[] | ResultSetHeader
100
+ T extends
101
+ | RowDataPacket[][]
102
+ | RowDataPacket[]
103
+ | OkPacket
104
+ | OkPacket[]
105
+ | ResultSetHeader
56
106
  >(
57
107
  options: QueryOptions
58
108
  ): Promise<[T, FieldPacket[]]>;
59
109
  execute<
60
- T extends RowDataPacket[][] | RowDataPacket[] | OkPacket | OkPacket[] | ResultSetHeader
110
+ T extends
111
+ | RowDataPacket[][]
112
+ | RowDataPacket[]
113
+ | OkPacket
114
+ | OkPacket[]
115
+ | ResultSetHeader
61
116
  >(
62
117
  options: QueryOptions,
63
118
  values: any | any[] | { [param: string]: any }
64
119
  ): Promise<[T, FieldPacket[]]>;
65
120
 
121
+ config: ConnectionOptions;
122
+
123
+ threadId: number;
124
+
125
+ connect(): Promise<void>;
126
+
127
+ ping(): Promise<void>;
128
+
129
+ beginTransaction(): Promise<void>;
130
+
131
+ commit(): Promise<void>;
132
+
133
+ rollback(): Promise<void>;
134
+
135
+ changeUser(options: ConnectionOptions): Promise<void>;
136
+
66
137
  prepare(options: string | QueryOptions): Promise<PreparedStatementInfo>;
138
+
67
139
  unprepare(sql: string | QueryOptions): void;
68
140
 
69
141
  end(options?: any): Promise<void>;
@@ -88,57 +160,110 @@ export interface PoolConnection extends Connection {
88
160
  }
89
161
 
90
162
  export interface Pool extends EventEmitter, Connection {
91
- query<T extends RowDataPacket[][] | RowDataPacket[] | OkPacket | OkPacket[] | ResultSetHeader>(
163
+ query<
164
+ T extends
165
+ | RowDataPacket[][]
166
+ | RowDataPacket[]
167
+ | OkPacket
168
+ | OkPacket[]
169
+ | ResultSetHeader
170
+ >(
92
171
  sql: string
93
172
  ): Promise<[T, FieldPacket[]]>;
94
- query<T extends RowDataPacket[][] | RowDataPacket[] | OkPacket | OkPacket[] | ResultSetHeader>(
173
+ query<
174
+ T extends
175
+ | RowDataPacket[][]
176
+ | RowDataPacket[]
177
+ | OkPacket
178
+ | OkPacket[]
179
+ | ResultSetHeader
180
+ >(
95
181
  sql: string,
96
182
  values: any | any[] | { [param: string]: any }
97
183
  ): Promise<[T, FieldPacket[]]>;
98
- query<T extends RowDataPacket[][] | RowDataPacket[] | OkPacket | OkPacket[] | ResultSetHeader>(
184
+ query<
185
+ T extends
186
+ | RowDataPacket[][]
187
+ | RowDataPacket[]
188
+ | OkPacket
189
+ | OkPacket[]
190
+ | ResultSetHeader
191
+ >(
99
192
  options: QueryOptions
100
193
  ): Promise<[T, FieldPacket[]]>;
101
- query<T extends RowDataPacket[][] | RowDataPacket[] | OkPacket | OkPacket[] | ResultSetHeader>(
194
+ query<
195
+ T extends
196
+ | RowDataPacket[][]
197
+ | RowDataPacket[]
198
+ | OkPacket
199
+ | OkPacket[]
200
+ | ResultSetHeader
201
+ >(
102
202
  options: QueryOptions,
103
203
  values: any | any[] | { [param: string]: any }
104
204
  ): Promise<[T, FieldPacket[]]>;
105
205
 
106
206
  execute<
107
- T extends RowDataPacket[][] | RowDataPacket[] | OkPacket | OkPacket[] | ResultSetHeader
207
+ T extends
208
+ | RowDataPacket[][]
209
+ | RowDataPacket[]
210
+ | OkPacket
211
+ | OkPacket[]
212
+ | ResultSetHeader
108
213
  >(
109
214
  sql: string
110
215
  ): Promise<[T, FieldPacket[]]>;
111
216
  execute<
112
- T extends RowDataPacket[][] | RowDataPacket[] | OkPacket | OkPacket[] | ResultSetHeader
217
+ T extends
218
+ | RowDataPacket[][]
219
+ | RowDataPacket[]
220
+ | OkPacket
221
+ | OkPacket[]
222
+ | ResultSetHeader
113
223
  >(
114
224
  sql: string,
115
225
  values: any | any[] | { [param: string]: any }
116
226
  ): Promise<[T, FieldPacket[]]>;
117
227
  execute<
118
- T extends RowDataPacket[][] | RowDataPacket[] | OkPacket | OkPacket[] | ResultSetHeader
228
+ T extends
229
+ | RowDataPacket[][]
230
+ | RowDataPacket[]
231
+ | OkPacket
232
+ | OkPacket[]
233
+ | ResultSetHeader
119
234
  >(
120
235
  options: QueryOptions
121
236
  ): Promise<[T, FieldPacket[]]>;
122
237
  execute<
123
- T extends RowDataPacket[][] | RowDataPacket[] | OkPacket | OkPacket[] | ResultSetHeader
238
+ T extends
239
+ | RowDataPacket[][]
240
+ | RowDataPacket[]
241
+ | OkPacket
242
+ | OkPacket[]
243
+ | ResultSetHeader
124
244
  >(
125
245
  options: QueryOptions,
126
246
  values: any | any[] | { [param: string]: any }
127
247
  ): Promise<[T, FieldPacket[]]>;
128
248
 
129
249
  getConnection(): Promise<PoolConnection>;
250
+
130
251
  releaseConnection(connection: PoolConnection): void;
252
+
131
253
  on(event: 'connection', listener: (connection: PoolConnection) => any): this;
132
254
  on(event: 'acquire', listener: (connection: PoolConnection) => any): this;
133
255
  on(event: 'release', listener: (connection: PoolConnection) => any): this;
134
256
  on(event: 'enqueue', listener: () => any): this;
257
+
135
258
  end(): Promise<void>;
136
259
 
137
260
  escape(value: any): string;
261
+
138
262
  escapeId(value: string): string;
139
263
  escapeId(values: string[]): string;
264
+
140
265
  format(sql: string, values?: any | any[] | { [param: string]: any }): string;
141
-
266
+
142
267
  pool: CorePool;
143
268
  }
144
269
 
@@ -146,10 +271,6 @@ export function createConnection(connectionUri: string): Promise<Connection>;
146
271
  export function createConnection(
147
272
  config: ConnectionOptions
148
273
  ): Promise<Connection>;
274
+
149
275
  export function createPool(connectionUri: string): Pool;
150
276
  export function createPool(config: PoolOptions): Pool;
151
-
152
- export interface PreparedStatementInfo {
153
- close(): Promise<void>;
154
- execute(parameters: any[]): Promise<[RowDataPacket[][] | RowDataPacket[] | OkPacket | OkPacket[] | ResultSetHeader, FieldPacket[]]>;
155
- }
@@ -1,50 +1,45 @@
1
- import * as crypto from 'crypto';
2
-
3
- import BaseConnection = require('./lib/Connection');
4
- import {ConnectionOptions, SslOptions} from './lib/Connection';
5
- import BasePoolConnection = require('./lib/PoolConnection');
6
- import BasePool = require('./lib/Pool');
7
- import {PoolOptions} from './lib/Pool';
8
- import BasePoolCluster = require('./lib/PoolCluster');
9
- import {PoolClusterOptions} from './lib/PoolCluster';
10
- import BaseQuery = require('./lib/protocol/sequences/Query');
11
- import BasePrepare = require('./lib/protocol/sequences/Prepare');
12
- import {QueryOptions, StreamOptions, QueryError} from './lib/protocol/sequences/Query';
13
- import {PrepareStatementInfo} from './lib/protocol/sequences/Prepare';
14
- import Server = require('./lib/Server');
15
- import { Pool as PromisePool, Connection as PromiseConnection } from '../../promise';
16
-
17
- export function createConnection(connectionUri: string): Connection;
18
- export function createConnection(config: BaseConnection.ConnectionOptions): Connection;
19
- export function createPool(config: BasePool.PoolOptions): BasePool;
20
- export function createPoolCluster(config?: BasePoolCluster.PoolClusterOptions): PoolCluster;
21
- export function escape(value: any): string;
22
- export function escapeId(value: any): string;
23
- export function format(sql: string): string;
24
- export function format(sql: string, values: any[], stringifyObjects?: boolean, timeZone?: string): string;
25
- export function format(sql: string, values: any, stringifyObjects?: boolean, timeZone?: string): string;
26
- export function raw(sql: string): {
27
- toSqlString: () => string
28
- };
29
- export function createServer(handler: (conn: BaseConnection) => any): Server;
1
+ import { RsaPublicKey, RsaPrivateKey, KeyLike } from 'crypto';
2
+ import { Pool as BasePool, PoolOptions } from './lib/Pool.js';
3
+ import {
4
+ Connection as BaseConnection,
5
+ ConnectionOptions,
6
+ SslOptions,
7
+ } from './lib/Connection.js';
8
+ import {
9
+ Query as BaseQuery,
10
+ QueryOptions,
11
+ QueryError,
12
+ } from './lib/protocol/sequences/Query.js';
13
+ import {
14
+ PoolCluster as BasePoolCluster,
15
+ PoolClusterOptions,
16
+ } from './lib/PoolCluster.js';
17
+ import { PoolConnection as BasePoolConnection } from './lib/PoolConnection.js';
18
+ import {
19
+ Prepare as BasePrepare,
20
+ PrepareStatementInfo,
21
+ } from './lib/protocol/sequences/Prepare.js';
22
+ import { Server } from './lib/Server.js';
23
+ import { Connection as PromiseConnection } from '../../promise.js';
30
24
 
31
25
  export {
32
- ConnectionOptions,
33
- SslOptions,
34
- PoolOptions,
35
- PoolClusterOptions,
36
- QueryOptions,
37
- QueryError,
38
- PrepareStatementInfo
26
+ ConnectionOptions,
27
+ SslOptions,
28
+ PoolOptions,
29
+ PoolClusterOptions,
30
+ QueryOptions,
31
+ QueryError,
32
+ PrepareStatementInfo,
39
33
  };
40
- export * from './lib/protocol/packets/index';
34
+
35
+ export * from './lib/protocol/packets/index.js';
41
36
 
42
37
  // Expose class interfaces
43
38
  export interface Connection extends BaseConnection {
44
39
  promise(promiseImpl?: PromiseConstructor): PromiseConnection;
45
40
  }
46
- export interface PoolConnection extends BasePoolConnection {}
47
41
  export interface Pool extends BasePool {}
42
+ export interface PoolConnection extends BasePoolConnection {}
48
43
  export interface PoolCluster extends BasePoolCluster {}
49
44
  export interface Query extends BaseQuery {}
50
45
  export interface Prepare extends BasePrepare {}
@@ -56,23 +51,55 @@ export type AuthPlugin = (pluginMetadata: {
56
51
  pluginData: Buffer
57
52
  ) => Promise<string> | string | Buffer | Promise<Buffer> | null;
58
53
 
59
- type AuthPluginDefinition<T> = (pluginOptions?: T) => AuthPlugin
54
+ type AuthPluginDefinition<T> = (pluginOptions?: T) => AuthPlugin;
60
55
 
61
56
  export const authPlugins: {
62
57
  caching_sha2_password: AuthPluginDefinition<{
63
- overrideIsSecure?: boolean,
64
- serverPublicKey?: crypto.RsaPublicKey | crypto.RsaPrivateKey | crypto.KeyLike,
58
+ overrideIsSecure?: boolean;
59
+ serverPublicKey?: RsaPublicKey | RsaPrivateKey | KeyLike;
65
60
  jonServerPublicKey?: (data: Buffer) => void;
66
- }>,
61
+ }>;
67
62
  mysql_clear_password: AuthPluginDefinition<{
68
63
  password?: string;
69
- }>,
64
+ }>;
70
65
  mysql_native_password: AuthPluginDefinition<{
71
66
  password?: string;
72
67
  passwordSha1?: string;
73
- }>,
68
+ }>;
74
69
  sha256_password: AuthPluginDefinition<{
75
- serverPublicKey?: crypto.RsaPublicKey | crypto.RsaPrivateKey | crypto.KeyLike,
70
+ serverPublicKey?: RsaPublicKey | RsaPrivateKey | KeyLike;
76
71
  joinServerPublicKey?: (data: Buffer) => void;
77
- }>,
78
- }
72
+ }>;
73
+ };
74
+
75
+ export function createConnection(connectionUri: string): Connection;
76
+ export function createConnection(config: ConnectionOptions): Connection;
77
+
78
+ export function createPool(config: PoolOptions): BasePool;
79
+
80
+ export function createPoolCluster(config?: PoolClusterOptions): PoolCluster;
81
+
82
+ export function escape(value: any): string;
83
+
84
+ export function escapeId(value: any): string;
85
+
86
+ export function format(sql: string): string;
87
+ export function format(
88
+ sql: string,
89
+ values: any[],
90
+ stringifyObjects?: boolean,
91
+ timeZone?: string
92
+ ): string;
93
+
94
+ export function format(
95
+ sql: string,
96
+ values: any,
97
+ stringifyObjects?: boolean,
98
+ timeZone?: string
99
+ ): string;
100
+
101
+ export function raw(sql: string): {
102
+ toSqlString: () => string;
103
+ };
104
+
105
+ export function createServer(handler: (conn: BaseConnection) => any): Server;