mysql2 3.18.1 → 3.18.2-canary.b274e725

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mysql2",
3
- "version": "3.18.1",
3
+ "version": "3.18.2-canary.b274e725",
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",
@@ -5,6 +5,7 @@
5
5
 
6
6
  import { EventEmitter } from 'events';
7
7
  import { Readable } from 'stream';
8
+ import { Timezone } from 'sql-escaper';
8
9
  import { Query, QueryError } from './protocol/sequences/Query.js';
9
10
  import { Prepare, PrepareStatementInfo } from './protocol/sequences/Prepare.js';
10
11
  import {
@@ -150,7 +151,7 @@ export interface ConnectionOptions {
150
151
  /**
151
152
  * The timezone used to store local dates. (Default: 'local')
152
153
  */
153
- timezone?: string | 'local';
154
+ timezone?: Timezone;
154
155
 
155
156
  /**
156
157
  * The milliseconds before a timeout occurs during the initial connection to the MySQL server. (Default: 10 seconds)
@@ -1,6 +1,7 @@
1
1
  import { Sequence } from './Sequence.js';
2
2
  import { OkPacket, RowDataPacket, FieldPacket } from '../packets/index.js';
3
3
  import { Readable } from 'stream';
4
+ import { Timezone } from 'sql-escaper';
4
5
  import { TypeCast } from '../../parsers/typeCast.js';
5
6
 
6
7
  export type QueryValues =
@@ -95,6 +96,35 @@ export interface QueryOptions {
95
96
  * By specifying a function that returns a readable stream, an arbitrary stream can be sent when sending a local fs file.
96
97
  */
97
98
  infileStreamFactory?: (path: string) => Readable;
99
+
100
+ /**
101
+ * When dealing with big numbers (BIGINT and DECIMAL columns) in the database, you should enable this option
102
+ * (Default: false)
103
+ */
104
+ supportBigNumbers?: boolean;
105
+
106
+ /**
107
+ * Enabling both supportBigNumbers and bigNumberStrings forces big numbers (BIGINT and DECIMAL columns) to be
108
+ * always returned as JavaScript String objects (Default: false). Enabling supportBigNumbers but leaving
109
+ * bigNumberStrings disabled will return big numbers as String objects only when they cannot be accurately
110
+ * represented with JavaScript Number objects (which happens when they exceed the [-2^53, +2^53] range),
111
+ * otherwise they will be returned as Number objects.
112
+ * This option is ignored if supportBigNumbers is disabled.
113
+ */
114
+ bigNumberStrings?: boolean;
115
+
116
+ /**
117
+ * Force date types (TIMESTAMP, DATETIME, DATE) to be returned as strings rather then inflated into JavaScript Date
118
+ * objects. Can be true/false or an array of type names to keep as strings.
119
+ *
120
+ * (Default: false)
121
+ */
122
+ dateStrings?: boolean | Array<'TIMESTAMP' | 'DATETIME' | 'DATE'>;
123
+
124
+ /**
125
+ * The timezone used to store local dates. (Default: 'local')
126
+ */
127
+ timezone?: Timezone;
98
128
  }
99
129
 
100
130
  export interface StreamOptions {
@@ -5,14 +5,10 @@ export declare function ExecutableBase<T extends QueryableConstructor>(
5
5
  Base?: T
6
6
  ): {
7
7
  new (...args: any[]): {
8
- execute<T extends QueryResult>(sql: string): Promise<[T, FieldPacket[]]>;
9
8
  execute<T extends QueryResult>(
10
9
  sql: string,
11
10
  values?: QueryValues
12
11
  ): Promise<[T, FieldPacket[]]>;
13
- execute<T extends QueryResult>(
14
- options: QueryOptions
15
- ): Promise<[T, FieldPacket[]]>;
16
12
  execute<T extends QueryResult>(
17
13
  options: QueryOptions,
18
14
  values?: QueryValues
@@ -5,14 +5,11 @@ export declare function QueryableBase<T extends QueryableConstructor>(
5
5
  Base?: T
6
6
  ): {
7
7
  new (...args: any[]): {
8
- query<T extends QueryResult>(sql: string): Promise<[T, FieldPacket[]]>;
9
8
  query<T extends QueryResult>(
10
9
  sql: string,
11
10
  values?: any
12
11
  ): Promise<[T, FieldPacket[]]>;
13
- query<T extends QueryResult>(
14
- options: QueryOptions
15
- ): Promise<[T, FieldPacket[]]>;
12
+
16
13
  query<T extends QueryResult>(
17
14
  options: QueryOptions,
18
15
  values?: any