@depup/mysql2 3.23.3-depup.0 → 3.24.0-depup.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/README.md +2 -2
- package/changes.json +1 -1
- package/index.js +5 -0
- package/lib/base/connection.js +3 -1
- package/lib/commands/execute.js +4 -1
- package/lib/commands/query.js +8 -8
- package/lib/compressed_protocol.js +5 -2
- package/lib/constants/types.js +1 -0
- package/lib/packet_parser.js +20 -16
- package/lib/packets/column_definition.js +11 -10
- package/lib/packets/encode_parameter.js +37 -7
- package/lib/packets/execute.js +74 -34
- package/lib/packets/packet.js +151 -21
- package/lib/packets/query.js +102 -66
- package/lib/packets/typed_parameter.js +381 -0
- package/lib/parsers/binary_parser.js +2 -2
- package/lib/parsers/parser_cache.js +21 -15
- package/lib/parsers/string.js +41 -0
- package/lib/promise/connection.js +6 -2
- package/lib/promise/pool.js +6 -2
- package/package.json +3 -3
- package/promise.js +5 -0
- package/typings/mysql/index.d.ts +1 -0
- package/typings/mysql/lib/Pool.d.ts +10 -0
- package/typings/mysql/lib/PoolConnection.d.ts +7 -2
- package/typings/mysql/lib/TypedParameter.d.ts +84 -0
- package/typings/mysql/lib/protocol/sequences/Query.d.ts +2 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A bind parameter carrying an explicit MySQL type.
|
|
3
|
+
*
|
|
4
|
+
* Produced by the `TypedParameter` factories and accepted anywhere
|
|
5
|
+
* `execute()` takes a value. The declared type is sent verbatim in
|
|
6
|
+
* `COM_STMT_EXECUTE` instead of being inferred from the JavaScript type.
|
|
7
|
+
*/
|
|
8
|
+
export interface TypedParameterValue {
|
|
9
|
+
readonly type: number;
|
|
10
|
+
readonly value: unknown;
|
|
11
|
+
readonly unsigned: boolean;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export type TypedParameterInput =
|
|
15
|
+
string | number | bigint | boolean | Date | Buffer | Uint8Array | null;
|
|
16
|
+
|
|
17
|
+
export interface TypedParameterFactory {
|
|
18
|
+
(value: TypedParameterInput): TypedParameterValue;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface IntegerTypedParameterFactory extends TypedParameterFactory {
|
|
22
|
+
unsigned(value: TypedParameterInput): TypedParameterValue;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface JsonTypedParameterFactory {
|
|
26
|
+
(value: TypedParameterInput | object): TypedParameterValue;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface TypedParameter {
|
|
30
|
+
TINY: IntegerTypedParameterFactory;
|
|
31
|
+
SHORT: IntegerTypedParameterFactory;
|
|
32
|
+
YEAR: IntegerTypedParameterFactory;
|
|
33
|
+
INT24: IntegerTypedParameterFactory;
|
|
34
|
+
LONG: IntegerTypedParameterFactory;
|
|
35
|
+
LONGLONG: IntegerTypedParameterFactory;
|
|
36
|
+
|
|
37
|
+
TINYINT: IntegerTypedParameterFactory;
|
|
38
|
+
SMALLINT: IntegerTypedParameterFactory;
|
|
39
|
+
MEDIUMINT: IntegerTypedParameterFactory;
|
|
40
|
+
INT: IntegerTypedParameterFactory;
|
|
41
|
+
INTEGER: IntegerTypedParameterFactory;
|
|
42
|
+
BIGINT: IntegerTypedParameterFactory;
|
|
43
|
+
|
|
44
|
+
FLOAT: TypedParameterFactory;
|
|
45
|
+
DOUBLE: TypedParameterFactory;
|
|
46
|
+
REAL: TypedParameterFactory;
|
|
47
|
+
|
|
48
|
+
DATE: TypedParameterFactory;
|
|
49
|
+
DATETIME: TypedParameterFactory;
|
|
50
|
+
TIMESTAMP: TypedParameterFactory;
|
|
51
|
+
TIME: TypedParameterFactory;
|
|
52
|
+
|
|
53
|
+
DECIMAL: TypedParameterFactory;
|
|
54
|
+
NEWDECIMAL: TypedParameterFactory;
|
|
55
|
+
VARCHAR: TypedParameterFactory;
|
|
56
|
+
VAR_STRING: TypedParameterFactory;
|
|
57
|
+
STRING: TypedParameterFactory;
|
|
58
|
+
CHAR: TypedParameterFactory;
|
|
59
|
+
VARBINARY: TypedParameterFactory;
|
|
60
|
+
BINARY: TypedParameterFactory;
|
|
61
|
+
ENUM: TypedParameterFactory;
|
|
62
|
+
SET: TypedParameterFactory;
|
|
63
|
+
BIT: TypedParameterFactory;
|
|
64
|
+
GEOMETRY: TypedParameterFactory;
|
|
65
|
+
VECTOR: TypedParameterFactory;
|
|
66
|
+
TINY_BLOB: TypedParameterFactory;
|
|
67
|
+
MEDIUM_BLOB: TypedParameterFactory;
|
|
68
|
+
LONG_BLOB: TypedParameterFactory;
|
|
69
|
+
BLOB: TypedParameterFactory;
|
|
70
|
+
TEXT: TypedParameterFactory;
|
|
71
|
+
|
|
72
|
+
JSON: JsonTypedParameterFactory;
|
|
73
|
+
|
|
74
|
+
NULL(): TypedParameterValue;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Constant `TypedParameter`.
|
|
79
|
+
*
|
|
80
|
+
* Please note that `TypedParameter` can only be accessed from the `mysql` object and not imported directly.
|
|
81
|
+
*/
|
|
82
|
+
declare const TypedParameter: TypedParameter;
|
|
83
|
+
|
|
84
|
+
export { TypedParameter };
|
|
@@ -3,8 +3,10 @@ import { OkPacket, RowDataPacket, FieldPacket } from '../packets/index.js';
|
|
|
3
3
|
import { Readable } from 'stream';
|
|
4
4
|
import { Raw, Timezone } from 'sql-escaper';
|
|
5
5
|
import { TypeCast } from '../../parsers/typeCast.js';
|
|
6
|
+
import { TypedParameterValue } from '../../TypedParameter.js';
|
|
6
7
|
|
|
7
8
|
export type ExecuteValues =
|
|
9
|
+
| TypedParameterValue
|
|
8
10
|
| string
|
|
9
11
|
| number
|
|
10
12
|
| bigint
|