postgrejs 2.15.2 → 2.16.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/CHANGELOG.md +21 -0
- package/esm/connection/bind-param.js +5 -1
- package/esm/connection/connection.js +20 -16
- package/esm/connection/cursor.js +15 -10
- package/esm/connection/intl-connection.js +46 -41
- package/esm/connection/pool.js +32 -28
- package/esm/connection/portal.js +31 -27
- package/esm/connection/prepared-statement.js +35 -31
- package/esm/constants.js +125 -122
- package/esm/data-type-map.js +75 -71
- package/esm/data-types/bool-type.js +10 -7
- package/esm/data-types/box-type.js +10 -7
- package/esm/data-types/bytea-type.js +13 -9
- package/esm/data-types/char-type.js +10 -7
- package/esm/data-types/circle-type.js +10 -7
- package/esm/data-types/date-type.js +15 -12
- package/esm/data-types/float4-type.js +10 -7
- package/esm/data-types/float8-type.js +10 -7
- package/esm/data-types/int2-type.js +13 -10
- package/esm/data-types/int2-vector-type.js +16 -13
- package/esm/data-types/int4-type.js +13 -10
- package/esm/data-types/int8-type.js +12 -9
- package/esm/data-types/json-type.js +12 -9
- package/esm/data-types/jsonb-type.js +14 -11
- package/esm/data-types/lseg-type.js +10 -7
- package/esm/data-types/numeric-type.js +12 -8
- package/esm/data-types/oid-type.js +18 -15
- package/esm/data-types/point-type.js +10 -7
- package/esm/data-types/time-type.js +16 -13
- package/esm/data-types/timestamp-type.js +15 -12
- package/esm/data-types/timestamptz-type.js +15 -12
- package/esm/data-types/uuid-type.js +10 -7
- package/esm/data-types/varchar-type.js +10 -7
- package/esm/index.js +28 -25
- package/esm/interfaces/command-result.js +2 -1
- package/esm/interfaces/data-mapping-options.js +2 -1
- package/esm/interfaces/data-type.js +2 -1
- package/esm/interfaces/database-connection-params.js +2 -1
- package/esm/interfaces/field-info.js +2 -1
- package/esm/interfaces/query-options.js +2 -1
- package/esm/interfaces/query-result.js +2 -1
- package/esm/interfaces/script-execute-options.js +2 -1
- package/esm/interfaces/script-result.js +2 -1
- package/esm/interfaces/statement-prepare-options.js +2 -1
- package/esm/protocol/backend.js +28 -24
- package/esm/protocol/buffer-reader.js +5 -1
- package/esm/protocol/database-error.js +5 -1
- package/esm/protocol/frontend.js +31 -27
- package/esm/protocol/pg-socket.js +53 -48
- package/esm/protocol/protocol.js +5 -2
- package/esm/protocol/sasl.js +11 -7
- package/esm/protocol/smart-buffer.js +10 -5
- package/esm/safe-event-emitter.js +6 -2
- package/esm/types.js +2 -1
- package/esm/util/array-calculatedim.js +4 -1
- package/esm/util/bigint-methods.js +6 -2
- package/esm/util/config-from-env.js +8 -5
- package/esm/util/connection-config.js +13 -8
- package/esm/util/convert-row-to-object.js +4 -1
- package/esm/util/decode-binaryarray.js +6 -3
- package/esm/util/encode-binaryarray.js +8 -5
- package/esm/util/escape-literal.js +4 -1
- package/esm/util/fast-parseint.js +4 -1
- package/esm/util/get-parsers.js +11 -8
- package/esm/util/parse-array.js +4 -1
- package/esm/util/parse-datetime.js +8 -5
- package/esm/util/parse-row.js +4 -1
- package/esm/util/parse-time.js +12 -8
- package/esm/util/stringify-arrayliteral.js +6 -3
- package/esm/util/stringify-for-sql.js +12 -8
- package/esm/util/wrap-row-description.js +9 -6
- package/package.json +23 -16
- package/cjs/package.json +0 -3
- /package/{typings → types}/connection/bind-param.d.ts +0 -0
- /package/{typings → types}/connection/connection.d.ts +0 -0
- /package/{typings → types}/connection/cursor.d.ts +0 -0
- /package/{typings → types}/connection/intl-connection.d.ts +0 -0
- /package/{typings → types}/connection/pool.d.ts +0 -0
- /package/{typings → types}/connection/portal.d.ts +0 -0
- /package/{typings → types}/connection/prepared-statement.d.ts +0 -0
- /package/{typings → types}/constants.d.ts +0 -0
- /package/{typings → types}/data-type-map.d.ts +0 -0
- /package/{typings → types}/data-types/bool-type.d.ts +0 -0
- /package/{typings → types}/data-types/box-type.d.ts +0 -0
- /package/{typings → types}/data-types/bytea-type.d.ts +0 -0
- /package/{typings → types}/data-types/char-type.d.ts +0 -0
- /package/{typings → types}/data-types/circle-type.d.ts +0 -0
- /package/{typings → types}/data-types/date-type.d.ts +0 -0
- /package/{typings → types}/data-types/float4-type.d.ts +0 -0
- /package/{typings → types}/data-types/float8-type.d.ts +0 -0
- /package/{typings → types}/data-types/int2-type.d.ts +0 -0
- /package/{typings → types}/data-types/int2-vector-type.d.ts +0 -0
- /package/{typings → types}/data-types/int4-type.d.ts +0 -0
- /package/{typings → types}/data-types/int8-type.d.ts +0 -0
- /package/{typings → types}/data-types/json-type.d.ts +0 -0
- /package/{typings → types}/data-types/jsonb-type.d.ts +0 -0
- /package/{typings → types}/data-types/lseg-type.d.ts +0 -0
- /package/{typings → types}/data-types/numeric-type.d.ts +0 -0
- /package/{typings → types}/data-types/oid-type.d.ts +0 -0
- /package/{typings → types}/data-types/point-type.d.ts +0 -0
- /package/{typings → types}/data-types/time-type.d.ts +0 -0
- /package/{typings → types}/data-types/timestamp-type.d.ts +0 -0
- /package/{typings → types}/data-types/timestamptz-type.d.ts +0 -0
- /package/{typings → types}/data-types/uuid-type.d.ts +0 -0
- /package/{typings → types}/data-types/varchar-type.d.ts +0 -0
- /package/{typings → types}/index.d.ts +0 -0
- /package/{typings → types}/interfaces/command-result.d.ts +0 -0
- /package/{typings → types}/interfaces/data-mapping-options.d.ts +0 -0
- /package/{typings → types}/interfaces/data-type.d.ts +0 -0
- /package/{typings → types}/interfaces/database-connection-params.d.ts +0 -0
- /package/{typings → types}/interfaces/field-info.d.ts +0 -0
- /package/{typings → types}/interfaces/query-options.d.ts +0 -0
- /package/{typings → types}/interfaces/query-result.d.ts +0 -0
- /package/{typings → types}/interfaces/script-execute-options.d.ts +0 -0
- /package/{typings → types}/interfaces/script-result.d.ts +0 -0
- /package/{typings → types}/interfaces/statement-prepare-options.d.ts +0 -0
- /package/{typings → types}/protocol/backend.d.ts +0 -0
- /package/{typings → types}/protocol/buffer-reader.d.ts +0 -0
- /package/{typings → types}/protocol/database-error.d.ts +0 -0
- /package/{typings → types}/protocol/frontend.d.ts +0 -0
- /package/{typings → types}/protocol/pg-socket.d.ts +0 -0
- /package/{typings → types}/protocol/protocol.d.ts +0 -0
- /package/{typings → types}/protocol/sasl.d.ts +0 -0
- /package/{typings → types}/protocol/smart-buffer.d.ts +0 -0
- /package/{typings → types}/safe-event-emitter.d.ts +0 -0
- /package/{typings → types}/types.d.ts +0 -0
- /package/{typings → types}/util/array-calculatedim.d.ts +0 -0
- /package/{typings → types}/util/bigint-methods.d.ts +0 -0
- /package/{typings → types}/util/config-from-env.d.ts +0 -0
- /package/{typings → types}/util/connection-config.d.ts +0 -0
- /package/{typings → types}/util/convert-row-to-object.d.ts +0 -0
- /package/{typings → types}/util/decode-binaryarray.d.ts +0 -0
- /package/{typings → types}/util/encode-binaryarray.d.ts +0 -0
- /package/{typings → types}/util/escape-literal.d.ts +0 -0
- /package/{typings → types}/util/fast-parseint.d.ts +0 -0
- /package/{typings → types}/util/get-parsers.d.ts +0 -0
- /package/{typings → types}/util/parse-array.d.ts +0 -0
- /package/{typings → types}/util/parse-datetime.d.ts +0 -0
- /package/{typings → types}/util/parse-row.d.ts +0 -0
- /package/{typings → types}/util/parse-time.d.ts +0 -0
- /package/{typings → types}/util/stringify-arrayliteral.d.ts +0 -0
- /package/{typings → types}/util/stringify-for-sql.d.ts +0 -0
- /package/{typings → types}/util/wrap-row-description.d.ts +0 -0
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ArrayTimeType = exports.TimeType = void 0;
|
|
4
|
+
const constants_js_1 = require("../constants.js");
|
|
5
|
+
const parse_time_js_1 = require("../util/parse-time.js");
|
|
3
6
|
const timeMul = 4294967296;
|
|
4
|
-
|
|
7
|
+
exports.TimeType = {
|
|
5
8
|
name: 'time',
|
|
6
|
-
oid: DataTypeOIDs.time,
|
|
9
|
+
oid: constants_js_1.DataTypeOIDs.time,
|
|
7
10
|
jsType: 'string',
|
|
8
11
|
parseBinary(v, options) {
|
|
9
|
-
const fetchAsString = options.fetchAsString && options.fetchAsString.includes(DataTypeOIDs.time);
|
|
12
|
+
const fetchAsString = options.fetchAsString && options.fetchAsString.includes(constants_js_1.DataTypeOIDs.time);
|
|
10
13
|
const hi = v.readInt32BE();
|
|
11
14
|
const lo = v.readUInt32BE(4);
|
|
12
15
|
let d = new Date((lo + hi * timeMul) / 1000);
|
|
@@ -17,7 +20,7 @@ export const TimeType = {
|
|
|
17
20
|
},
|
|
18
21
|
encodeBinary(buf, v, options) {
|
|
19
22
|
if (typeof v === 'string')
|
|
20
|
-
v = parseTime(v, false, options.utcDates);
|
|
23
|
+
v = (0, parse_time_js_1.parseTime)(v, false, options.utcDates);
|
|
21
24
|
if (!(v instanceof Date))
|
|
22
25
|
v = new Date(v);
|
|
23
26
|
// Postgresql ignores timezone data so we are
|
|
@@ -29,13 +32,13 @@ export const TimeType = {
|
|
|
29
32
|
buf.writeUInt32BE(lo);
|
|
30
33
|
},
|
|
31
34
|
parseText(v, options) {
|
|
32
|
-
if (options.fetchAsString && options.fetchAsString.includes(DataTypeOIDs.time))
|
|
35
|
+
if (options.fetchAsString && options.fetchAsString.includes(constants_js_1.DataTypeOIDs.time))
|
|
33
36
|
return v;
|
|
34
|
-
return parseTime(v, false, options.utcDates);
|
|
37
|
+
return (0, parse_time_js_1.parseTime)(v, false, options.utcDates);
|
|
35
38
|
},
|
|
36
39
|
isType(v) {
|
|
37
40
|
return ((v instanceof Date && v.getFullYear() === 1970 && v.getMonth() === 0 && v.getDate() === 1) ||
|
|
38
|
-
(typeof v === 'string' && STRICT_TIME_PATTERN.test(v)));
|
|
41
|
+
(typeof v === 'string' && parse_time_js_1.STRICT_TIME_PATTERN.test(v)));
|
|
39
42
|
},
|
|
40
43
|
};
|
|
41
44
|
function padZero(v) {
|
|
@@ -44,9 +47,9 @@ function padZero(v) {
|
|
|
44
47
|
function dateToTimeString(d) {
|
|
45
48
|
return padZero(d.getHours()) + ':' + padZero(d.getMinutes()) + ':' + padZero(d.getSeconds());
|
|
46
49
|
}
|
|
47
|
-
|
|
48
|
-
...TimeType,
|
|
50
|
+
exports.ArrayTimeType = {
|
|
51
|
+
...exports.TimeType,
|
|
49
52
|
name: '_time',
|
|
50
|
-
oid: DataTypeOIDs._time,
|
|
51
|
-
elementsOID: DataTypeOIDs.time,
|
|
53
|
+
oid: constants_js_1.DataTypeOIDs._time,
|
|
54
|
+
elementsOID: constants_js_1.DataTypeOIDs.time,
|
|
52
55
|
};
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ArrayTimestampType = exports.TimestampType = void 0;
|
|
4
|
+
const constants_js_1 = require("../constants.js");
|
|
5
|
+
const parse_datetime_js_1 = require("../util/parse-datetime.js");
|
|
3
6
|
const timeShift = 946684800000;
|
|
4
7
|
const timeMul = 4294967296;
|
|
5
|
-
|
|
8
|
+
exports.TimestampType = {
|
|
6
9
|
name: 'timestamp',
|
|
7
|
-
oid: DataTypeOIDs.timestamp,
|
|
10
|
+
oid: constants_js_1.DataTypeOIDs.timestamp,
|
|
8
11
|
jsType: 'Date',
|
|
9
12
|
parseBinary(v, options) {
|
|
10
|
-
const fetchAsString = options.fetchAsString && options.fetchAsString.includes(DataTypeOIDs.timestamp);
|
|
13
|
+
const fetchAsString = options.fetchAsString && options.fetchAsString.includes(constants_js_1.DataTypeOIDs.timestamp);
|
|
11
14
|
const hi = v.readInt32BE();
|
|
12
15
|
const lo = v.readUInt32BE(4);
|
|
13
16
|
if (lo === 0xffffffff && hi === 0x7fffffff)
|
|
@@ -23,7 +26,7 @@ export const TimestampType = {
|
|
|
23
26
|
},
|
|
24
27
|
encodeBinary(buf, v, options) {
|
|
25
28
|
if (typeof v === 'string')
|
|
26
|
-
v = parseDateTime(v, true, false, options.utcDates);
|
|
29
|
+
v = (0, parse_datetime_js_1.parseDateTime)(v, true, false, options.utcDates);
|
|
27
30
|
if (v === Infinity) {
|
|
28
31
|
buf.writeInt32BE(0x7fffffff); // hi
|
|
29
32
|
buf.writeUInt32BE(0xffffffff); // lo
|
|
@@ -45,9 +48,9 @@ export const TimestampType = {
|
|
|
45
48
|
buf.writeUInt32BE(lo);
|
|
46
49
|
},
|
|
47
50
|
parseText(v, options) {
|
|
48
|
-
if (options.fetchAsString && options.fetchAsString.includes(DataTypeOIDs.timestamp))
|
|
51
|
+
if (options.fetchAsString && options.fetchAsString.includes(constants_js_1.DataTypeOIDs.timestamp))
|
|
49
52
|
return v;
|
|
50
|
-
return parseDateTime(v, true, false, options.utcDates);
|
|
53
|
+
return (0, parse_datetime_js_1.parseDateTime)(v, true, false, options.utcDates);
|
|
51
54
|
},
|
|
52
55
|
isType(v) {
|
|
53
56
|
return (v instanceof Date &&
|
|
@@ -71,9 +74,9 @@ function dateToTimestampString(d) {
|
|
|
71
74
|
':' +
|
|
72
75
|
padZero(d.getSeconds()));
|
|
73
76
|
}
|
|
74
|
-
|
|
75
|
-
...TimestampType,
|
|
77
|
+
exports.ArrayTimestampType = {
|
|
78
|
+
...exports.TimestampType,
|
|
76
79
|
name: '_timestamp',
|
|
77
|
-
oid: DataTypeOIDs._timestamp,
|
|
78
|
-
elementsOID: DataTypeOIDs.timestamp,
|
|
80
|
+
oid: constants_js_1.DataTypeOIDs._timestamp,
|
|
81
|
+
elementsOID: constants_js_1.DataTypeOIDs.timestamp,
|
|
79
82
|
};
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ArrayTimestamptzType = exports.TimestamptzType = void 0;
|
|
4
|
+
const constants_js_1 = require("../constants.js");
|
|
5
|
+
const parse_datetime_js_1 = require("../util/parse-datetime.js");
|
|
3
6
|
const timeShift = 946684800000;
|
|
4
7
|
const timeMul = 4294967296;
|
|
5
|
-
|
|
8
|
+
exports.TimestamptzType = {
|
|
6
9
|
name: 'timestamptz',
|
|
7
|
-
oid: DataTypeOIDs.timestamptz,
|
|
10
|
+
oid: constants_js_1.DataTypeOIDs.timestamptz,
|
|
8
11
|
jsType: 'Date',
|
|
9
12
|
parseBinary(v, options) {
|
|
10
|
-
const fetchAsString = options.fetchAsString && options.fetchAsString.includes(DataTypeOIDs.timestamptz);
|
|
13
|
+
const fetchAsString = options.fetchAsString && options.fetchAsString.includes(constants_js_1.DataTypeOIDs.timestamptz);
|
|
11
14
|
const hi = v.readInt32BE();
|
|
12
15
|
const lo = v.readUInt32BE(4);
|
|
13
16
|
if (lo === 0xffffffff && hi === 0x7fffffff)
|
|
@@ -23,7 +26,7 @@ export const TimestamptzType = {
|
|
|
23
26
|
},
|
|
24
27
|
encodeBinary(buf, v, options) {
|
|
25
28
|
if (typeof v === 'string')
|
|
26
|
-
v = parseDateTime(v, true, true, options.utcDates);
|
|
29
|
+
v = (0, parse_datetime_js_1.parseDateTime)(v, true, true, options.utcDates);
|
|
27
30
|
if (v === Infinity) {
|
|
28
31
|
buf.writeInt32BE(0x7fffffff); // hi
|
|
29
32
|
buf.writeUInt32BE(0xffffffff); // lo
|
|
@@ -44,8 +47,8 @@ export const TimestamptzType = {
|
|
|
44
47
|
buf.writeUInt32BE(lo);
|
|
45
48
|
},
|
|
46
49
|
parseText(v, options) {
|
|
47
|
-
const d = parseDateTime(v, true, true, options.utcDates);
|
|
48
|
-
if (options.fetchAsString && options.fetchAsString.includes(DataTypeOIDs.timestamptz)) {
|
|
50
|
+
const d = (0, parse_datetime_js_1.parseDateTime)(v, true, true, options.utcDates);
|
|
51
|
+
if (options.fetchAsString && options.fetchAsString.includes(constants_js_1.DataTypeOIDs.timestamptz)) {
|
|
49
52
|
if (d instanceof Date)
|
|
50
53
|
return dateToTimestamptzString(d);
|
|
51
54
|
if (d === Infinity)
|
|
@@ -63,9 +66,9 @@ export const TimestamptzType = {
|
|
|
63
66
|
function dateToTimestamptzString(d) {
|
|
64
67
|
return d.toISOString().replace('T', ' ');
|
|
65
68
|
}
|
|
66
|
-
|
|
67
|
-
...TimestamptzType,
|
|
69
|
+
exports.ArrayTimestamptzType = {
|
|
70
|
+
...exports.TimestamptzType,
|
|
68
71
|
name: '_timestamptz',
|
|
69
|
-
oid: DataTypeOIDs._timestamptz,
|
|
70
|
-
elementsOID: DataTypeOIDs.timestamptz,
|
|
72
|
+
oid: constants_js_1.DataTypeOIDs._timestamptz,
|
|
73
|
+
elementsOID: constants_js_1.DataTypeOIDs.timestamptz,
|
|
71
74
|
};
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ArrayUuidType = exports.UuidType = void 0;
|
|
4
|
+
const constants_js_1 = require("../constants.js");
|
|
2
5
|
const GUID_PATTERN = /^[0-9a-fA-F]{8}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{12}$/;
|
|
3
|
-
|
|
6
|
+
exports.UuidType = {
|
|
4
7
|
name: 'uuid',
|
|
5
|
-
oid: DataTypeOIDs.uuid,
|
|
8
|
+
oid: constants_js_1.DataTypeOIDs.uuid,
|
|
6
9
|
jsType: 'String',
|
|
7
10
|
parseBinary(v) {
|
|
8
11
|
return (v.toString('hex', 0, 4) +
|
|
@@ -28,9 +31,9 @@ export const UuidType = {
|
|
|
28
31
|
return typeof v === 'string' && GUID_PATTERN.test(v);
|
|
29
32
|
},
|
|
30
33
|
};
|
|
31
|
-
|
|
32
|
-
...UuidType,
|
|
34
|
+
exports.ArrayUuidType = {
|
|
35
|
+
...exports.UuidType,
|
|
33
36
|
name: '_uuid',
|
|
34
|
-
oid: DataTypeOIDs._uuid,
|
|
35
|
-
elementsOID: DataTypeOIDs.uuid,
|
|
37
|
+
oid: constants_js_1.DataTypeOIDs._uuid,
|
|
38
|
+
elementsOID: constants_js_1.DataTypeOIDs.uuid,
|
|
36
39
|
};
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ArrayVarcharType = exports.VarcharType = void 0;
|
|
4
|
+
const constants_js_1 = require("../constants.js");
|
|
5
|
+
exports.VarcharType = {
|
|
3
6
|
name: 'varchar',
|
|
4
|
-
oid: DataTypeOIDs.varchar,
|
|
7
|
+
oid: constants_js_1.DataTypeOIDs.varchar,
|
|
5
8
|
jsType: 'string',
|
|
6
9
|
parseBinary(v) {
|
|
7
10
|
return v.toString('utf8');
|
|
@@ -16,9 +19,9 @@ export const VarcharType = {
|
|
|
16
19
|
return typeof v === 'string';
|
|
17
20
|
},
|
|
18
21
|
};
|
|
19
|
-
|
|
20
|
-
...VarcharType,
|
|
22
|
+
exports.ArrayVarcharType = {
|
|
23
|
+
...exports.VarcharType,
|
|
21
24
|
name: '_varchar',
|
|
22
|
-
oid: DataTypeOIDs._varchar,
|
|
23
|
-
elementsOID: DataTypeOIDs.varchar,
|
|
25
|
+
oid: constants_js_1.DataTypeOIDs._varchar,
|
|
26
|
+
elementsOID: constants_js_1.DataTypeOIDs.varchar,
|
|
24
27
|
};
|
package/esm/index.js
CHANGED
|
@@ -1,25 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./connection/bind-param.js"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./connection/connection.js"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./connection/cursor.js"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./connection/pool.js"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./connection/prepared-statement.js"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./constants.js"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./data-type-map.js"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./interfaces/command-result.js"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./interfaces/data-mapping-options.js"), exports);
|
|
13
|
+
tslib_1.__exportStar(require("./interfaces/data-type.js"), exports);
|
|
14
|
+
tslib_1.__exportStar(require("./interfaces/database-connection-params.js"), exports);
|
|
15
|
+
tslib_1.__exportStar(require("./interfaces/field-info.js"), exports);
|
|
16
|
+
tslib_1.__exportStar(require("./interfaces/query-options.js"), exports);
|
|
17
|
+
tslib_1.__exportStar(require("./interfaces/query-result.js"), exports);
|
|
18
|
+
tslib_1.__exportStar(require("./interfaces/script-execute-options.js"), exports);
|
|
19
|
+
tslib_1.__exportStar(require("./interfaces/script-result.js"), exports);
|
|
20
|
+
tslib_1.__exportStar(require("./interfaces/statement-prepare-options.js"), exports);
|
|
21
|
+
tslib_1.__exportStar(require("./protocol/database-error.js"), exports);
|
|
22
|
+
tslib_1.__exportStar(require("./protocol/smart-buffer.js"), exports);
|
|
23
|
+
tslib_1.__exportStar(require("./types.js"), exports);
|
|
24
|
+
tslib_1.__exportStar(require("./util/connection-config.js"), exports);
|
|
25
|
+
tslib_1.__exportStar(require("./util/escape-literal.js"), exports);
|
|
26
|
+
tslib_1.__exportStar(require("./util/parse-datetime.js"), exports);
|
|
27
|
+
tslib_1.__exportStar(require("./util/stringify-arrayliteral.js"), exports);
|
|
28
|
+
tslib_1.__exportStar(require("./util/stringify-for-sql.js"), exports);
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
package/esm/protocol/backend.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Backend = void 0;
|
|
4
|
+
const buffer_reader_js_1 = require("./buffer-reader.js");
|
|
5
|
+
const protocol_js_1 = require("./protocol.js");
|
|
3
6
|
// 1 byte message type, 4 byte frame length
|
|
4
7
|
const HEADER_LENGTH = 5;
|
|
5
8
|
const ErrorFieldTypes = {
|
|
@@ -22,7 +25,7 @@ const ErrorFieldTypes = {
|
|
|
22
25
|
L: 'line',
|
|
23
26
|
R: 'routine',
|
|
24
27
|
};
|
|
25
|
-
|
|
28
|
+
class Backend {
|
|
26
29
|
reset() {
|
|
27
30
|
this._buf = undefined;
|
|
28
31
|
}
|
|
@@ -31,7 +34,7 @@ export class Backend {
|
|
|
31
34
|
data = Buffer.concat([this._buf, data]);
|
|
32
35
|
this._buf = undefined;
|
|
33
36
|
}
|
|
34
|
-
const io = new BufferReader(data);
|
|
37
|
+
const io = new buffer_reader_js_1.BufferReader(data);
|
|
35
38
|
let offsetBookmark;
|
|
36
39
|
while (io.length - io.offset >= HEADER_LENGTH) {
|
|
37
40
|
offsetBookmark = io.offset;
|
|
@@ -53,24 +56,25 @@ export class Backend {
|
|
|
53
56
|
this._buf = io.readBuffer(io.length - io.offset);
|
|
54
57
|
}
|
|
55
58
|
}
|
|
59
|
+
exports.Backend = Backend;
|
|
56
60
|
const MessageParsers = {
|
|
57
|
-
[Protocol.BackendMessageCode.Authentication]: parseAuthentication,
|
|
58
|
-
[Protocol.BackendMessageCode.BackendKeyData]: parseBackendKeyData,
|
|
59
|
-
[Protocol.BackendMessageCode.CommandComplete]: parseCommandComplete,
|
|
60
|
-
[Protocol.BackendMessageCode.CopyData]: parseCopyData,
|
|
61
|
-
[Protocol.BackendMessageCode.CopyInResponse]: parseCopyResponse,
|
|
62
|
-
[Protocol.BackendMessageCode.CopyOutResponse]: parseCopyResponse,
|
|
63
|
-
[Protocol.BackendMessageCode.CopyBothResponse]: parseCopyResponse,
|
|
64
|
-
[Protocol.BackendMessageCode.DataRow]: parseDataRow,
|
|
65
|
-
[Protocol.BackendMessageCode.ErrorResponse]: parseErrorResponse,
|
|
66
|
-
[Protocol.BackendMessageCode.NoticeResponse]: parseErrorResponse,
|
|
67
|
-
[Protocol.BackendMessageCode.NotificationResponse]: parseNotificationResponse,
|
|
68
|
-
[Protocol.BackendMessageCode.FunctionCallResponse]: parseFunctionCallResponse,
|
|
69
|
-
[Protocol.BackendMessageCode.NegotiateProtocolVersion]: parseNegotiateProtocolVersion,
|
|
70
|
-
[Protocol.BackendMessageCode.ParameterDescription]: parseParameterDescription,
|
|
71
|
-
[Protocol.BackendMessageCode.ParameterStatus]: parseParameterStatus,
|
|
72
|
-
[Protocol.BackendMessageCode.ReadyForQuery]: parseReadyForQuery,
|
|
73
|
-
[Protocol.BackendMessageCode.RowDescription]: parseRowDescription,
|
|
61
|
+
[protocol_js_1.Protocol.BackendMessageCode.Authentication]: parseAuthentication,
|
|
62
|
+
[protocol_js_1.Protocol.BackendMessageCode.BackendKeyData]: parseBackendKeyData,
|
|
63
|
+
[protocol_js_1.Protocol.BackendMessageCode.CommandComplete]: parseCommandComplete,
|
|
64
|
+
[protocol_js_1.Protocol.BackendMessageCode.CopyData]: parseCopyData,
|
|
65
|
+
[protocol_js_1.Protocol.BackendMessageCode.CopyInResponse]: parseCopyResponse,
|
|
66
|
+
[protocol_js_1.Protocol.BackendMessageCode.CopyOutResponse]: parseCopyResponse,
|
|
67
|
+
[protocol_js_1.Protocol.BackendMessageCode.CopyBothResponse]: parseCopyResponse,
|
|
68
|
+
[protocol_js_1.Protocol.BackendMessageCode.DataRow]: parseDataRow,
|
|
69
|
+
[protocol_js_1.Protocol.BackendMessageCode.ErrorResponse]: parseErrorResponse,
|
|
70
|
+
[protocol_js_1.Protocol.BackendMessageCode.NoticeResponse]: parseErrorResponse,
|
|
71
|
+
[protocol_js_1.Protocol.BackendMessageCode.NotificationResponse]: parseNotificationResponse,
|
|
72
|
+
[protocol_js_1.Protocol.BackendMessageCode.FunctionCallResponse]: parseFunctionCallResponse,
|
|
73
|
+
[protocol_js_1.Protocol.BackendMessageCode.NegotiateProtocolVersion]: parseNegotiateProtocolVersion,
|
|
74
|
+
[protocol_js_1.Protocol.BackendMessageCode.ParameterDescription]: parseParameterDescription,
|
|
75
|
+
[protocol_js_1.Protocol.BackendMessageCode.ParameterStatus]: parseParameterStatus,
|
|
76
|
+
[protocol_js_1.Protocol.BackendMessageCode.ReadyForQuery]: parseReadyForQuery,
|
|
77
|
+
[protocol_js_1.Protocol.BackendMessageCode.RowDescription]: parseRowDescription,
|
|
74
78
|
};
|
|
75
79
|
function parseAuthentication(io, code, len) {
|
|
76
80
|
const kind = io.readUInt32BE();
|
|
@@ -150,13 +154,13 @@ function parseCopyData(io, code, len) {
|
|
|
150
154
|
}
|
|
151
155
|
function parseCopyResponse(io) {
|
|
152
156
|
const out = {
|
|
153
|
-
overallFormat: io.readUInt8() === 0 ? Protocol.DataFormat.text : Protocol.DataFormat.binary,
|
|
157
|
+
overallFormat: io.readUInt8() === 0 ? protocol_js_1.Protocol.DataFormat.text : protocol_js_1.Protocol.DataFormat.binary,
|
|
154
158
|
columnCount: io.readUInt16BE(),
|
|
155
159
|
};
|
|
156
160
|
if (out.columnCount) {
|
|
157
161
|
out.columnFormats = [];
|
|
158
162
|
for (let i = 0; i < out.columnCount; i++) {
|
|
159
|
-
out.columnFormats.push(io.readUInt16BE() === 0 ? Protocol.DataFormat.text : Protocol.DataFormat.binary);
|
|
163
|
+
out.columnFormats.push(io.readUInt16BE() === 0 ? protocol_js_1.Protocol.DataFormat.text : protocol_js_1.Protocol.DataFormat.binary);
|
|
160
164
|
}
|
|
161
165
|
}
|
|
162
166
|
return out;
|
|
@@ -244,7 +248,7 @@ function parseRowDescription(io) {
|
|
|
244
248
|
dataTypeId: io.readInt32BE(),
|
|
245
249
|
fixedSize: io.readInt16BE(),
|
|
246
250
|
modifier: io.readInt32BE(),
|
|
247
|
-
format: io.readInt16BE() === 0 ? Protocol.DataFormat.text : Protocol.DataFormat.binary,
|
|
251
|
+
format: io.readInt16BE() === 0 ? protocol_js_1.Protocol.DataFormat.text : protocol_js_1.Protocol.DataFormat.binary,
|
|
248
252
|
};
|
|
249
253
|
out.fields.push(field);
|
|
250
254
|
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BufferReader = void 0;
|
|
4
|
+
class BufferReader {
|
|
2
5
|
constructor(buffer) {
|
|
3
6
|
this.offset = 0;
|
|
4
7
|
this.buffer = buffer;
|
|
@@ -72,3 +75,4 @@ export class BufferReader {
|
|
|
72
75
|
throw new Error('Eof in buffer detected');
|
|
73
76
|
}
|
|
74
77
|
}
|
|
78
|
+
exports.BufferReader = BufferReader;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DatabaseError = void 0;
|
|
4
|
+
class DatabaseError extends Error {
|
|
2
5
|
constructor(msg) {
|
|
3
6
|
super(msg.message);
|
|
4
7
|
Object.assign(this, {
|
|
@@ -11,3 +14,4 @@ export class DatabaseError extends Error {
|
|
|
11
14
|
this.position = parseInt(msg.position, 10) || undefined;
|
|
12
15
|
}
|
|
13
16
|
}
|
|
17
|
+
exports.DatabaseError = DatabaseError;
|
package/esm/protocol/frontend.js
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Frontend = void 0;
|
|
4
|
+
const constants_js_1 = require("../constants.js");
|
|
5
|
+
const encode_binaryarray_js_1 = require("../util/encode-binaryarray.js");
|
|
6
|
+
const stringify_arrayliteral_js_1 = require("../util/stringify-arrayliteral.js");
|
|
7
|
+
const protocol_js_1 = require("./protocol.js");
|
|
8
|
+
const smart_buffer_js_1 = require("./smart-buffer.js");
|
|
9
|
+
const DataFormat = protocol_js_1.Protocol.DataFormat;
|
|
10
|
+
const StaticFlushBuffer = Buffer.from([protocol_js_1.Protocol.FrontendMessageCode.Flush, 0x00, 0x00, 0x00, 0x04]);
|
|
11
|
+
const StaticTerminateBuffer = Buffer.from([protocol_js_1.Protocol.FrontendMessageCode.Terminate, 0x00, 0x00, 0x00, 0x04]);
|
|
12
|
+
const StaticSyncBuffer = Buffer.from([protocol_js_1.Protocol.FrontendMessageCode.Sync, 0x00, 0x00, 0x00, 0x04]);
|
|
13
|
+
class Frontend {
|
|
11
14
|
constructor(options) {
|
|
12
|
-
this._io = new SmartBuffer(options?.buffer);
|
|
15
|
+
this._io = new smart_buffer_js_1.SmartBuffer(options?.buffer);
|
|
13
16
|
}
|
|
14
17
|
getSSLRequestMessage() {
|
|
15
18
|
return this._io
|
|
@@ -23,8 +26,8 @@ export class Frontend {
|
|
|
23
26
|
const io = this._io
|
|
24
27
|
.start()
|
|
25
28
|
.writeInt32BE(0) // Preserve length
|
|
26
|
-
.writeInt16BE(Protocol.VERSION_MAJOR)
|
|
27
|
-
.writeInt16BE(Protocol.VERSION_MINOR);
|
|
29
|
+
.writeInt16BE(protocol_js_1.Protocol.VERSION_MAJOR)
|
|
30
|
+
.writeInt16BE(protocol_js_1.Protocol.VERSION_MINOR);
|
|
28
31
|
for (const [k, v] of Object.entries(args)) {
|
|
29
32
|
if (k !== 'client_encoding')
|
|
30
33
|
io.writeCString(k, 'utf8').writeCString(v, 'utf8');
|
|
@@ -35,7 +38,7 @@ export class Frontend {
|
|
|
35
38
|
getPasswordMessage(password) {
|
|
36
39
|
const io = this._io
|
|
37
40
|
.start()
|
|
38
|
-
.writeInt8(Protocol.FrontendMessageCode.PasswordMessage)
|
|
41
|
+
.writeInt8(protocol_js_1.Protocol.FrontendMessageCode.PasswordMessage)
|
|
39
42
|
.writeInt32BE(0) // Preserve header
|
|
40
43
|
.writeCString(password, 'utf8');
|
|
41
44
|
return setLengthAndFlush(io, 1);
|
|
@@ -43,7 +46,7 @@ export class Frontend {
|
|
|
43
46
|
getSASLMessage(sasl) {
|
|
44
47
|
const io = this._io
|
|
45
48
|
.start()
|
|
46
|
-
.writeInt8(Protocol.FrontendMessageCode.PasswordMessage)
|
|
49
|
+
.writeInt8(protocol_js_1.Protocol.FrontendMessageCode.PasswordMessage)
|
|
47
50
|
.writeInt32BE(0) // Preserve header
|
|
48
51
|
.writeCString(sasl.mechanism, 'utf8')
|
|
49
52
|
.writeLString(sasl.clientFirstMessage);
|
|
@@ -52,7 +55,7 @@ export class Frontend {
|
|
|
52
55
|
getSASLFinalMessage(session) {
|
|
53
56
|
const io = this._io
|
|
54
57
|
.start()
|
|
55
|
-
.writeInt8(Protocol.FrontendMessageCode.PasswordMessage)
|
|
58
|
+
.writeInt8(protocol_js_1.Protocol.FrontendMessageCode.PasswordMessage)
|
|
56
59
|
.writeInt32BE(0) // Preserve header
|
|
57
60
|
.writeString(session.clientFinalMessage);
|
|
58
61
|
return setLengthAndFlush(io, 1);
|
|
@@ -62,7 +65,7 @@ export class Frontend {
|
|
|
62
65
|
throw new Error('Query name length must be lower than 63');
|
|
63
66
|
const io = this._io
|
|
64
67
|
.start()
|
|
65
|
-
.writeInt8(Protocol.FrontendMessageCode.Parse)
|
|
68
|
+
.writeInt8(protocol_js_1.Protocol.FrontendMessageCode.Parse)
|
|
66
69
|
.writeInt32BE(0) // Preserve header
|
|
67
70
|
.writeCString(args.statement || '', 'utf8')
|
|
68
71
|
.writeCString(args.sql, 'utf8')
|
|
@@ -81,12 +84,12 @@ export class Frontend {
|
|
|
81
84
|
throw new Error('Query name length must be lower than 63');
|
|
82
85
|
const io = this._io
|
|
83
86
|
.start()
|
|
84
|
-
.writeInt8(Protocol.FrontendMessageCode.Bind)
|
|
87
|
+
.writeInt8(protocol_js_1.Protocol.FrontendMessageCode.Bind)
|
|
85
88
|
.writeInt32BE(0) // Preserve header
|
|
86
89
|
.writeCString(args.portal || '', 'utf8')
|
|
87
90
|
.writeCString(args.statement || '', 'utf8');
|
|
88
91
|
const { params, paramTypes, queryOptions } = args;
|
|
89
|
-
const columnFormat = queryOptions.columnFormat != null ? queryOptions.columnFormat : DEFAULT_COLUMN_FORMAT;
|
|
92
|
+
const columnFormat = queryOptions.columnFormat != null ? queryOptions.columnFormat : constants_js_1.DEFAULT_COLUMN_FORMAT;
|
|
90
93
|
if (params && params.length) {
|
|
91
94
|
io.writeInt16BE(params.length);
|
|
92
95
|
const formatOffset = io.offset;
|
|
@@ -106,14 +109,14 @@ export class Frontend {
|
|
|
106
109
|
if (dt) {
|
|
107
110
|
if (typeof dt.encodeBinary === 'function') {
|
|
108
111
|
// Set param format to binary
|
|
109
|
-
io.buffer.writeInt16BE(Protocol.DataFormat.binary, formatOffset + i * 2);
|
|
112
|
+
io.buffer.writeInt16BE(protocol_js_1.Protocol.DataFormat.binary, formatOffset + i * 2);
|
|
110
113
|
// Preserve data length
|
|
111
114
|
io.writeInt32BE(0);
|
|
112
115
|
const dataOffset = io.offset;
|
|
113
116
|
if (dt.elementsOID) {
|
|
114
117
|
// If data type is array
|
|
115
118
|
v = Array.isArray(v) ? v : [v];
|
|
116
|
-
encodeBinaryArray(io, v, dt.elementsOID, queryOptions, dt.encodeBinary, dt.encodeCalculateDim);
|
|
119
|
+
(0, encode_binaryarray_js_1.encodeBinaryArray)(io, v, dt.elementsOID, queryOptions, dt.encodeBinary, dt.encodeCalculateDim);
|
|
117
120
|
}
|
|
118
121
|
else {
|
|
119
122
|
dt.encodeBinary(io, v, queryOptions);
|
|
@@ -121,13 +124,13 @@ export class Frontend {
|
|
|
121
124
|
io.buffer.writeInt32BE(io.length - dataOffset, dataOffset - 4); // Update length
|
|
122
125
|
}
|
|
123
126
|
else if (typeof dt.encodeText === 'function') {
|
|
124
|
-
v = dt.elementsOID ? stringifyArrayLiteral(v, queryOptions, dt.encodeText) : dt.encodeText(v, queryOptions);
|
|
127
|
+
v = dt.elementsOID ? (0, stringify_arrayliteral_js_1.stringifyArrayLiteral)(v, queryOptions, dt.encodeText) : dt.encodeText(v, queryOptions);
|
|
125
128
|
io.writeLString(v, 'utf8');
|
|
126
129
|
}
|
|
127
130
|
}
|
|
128
131
|
else if (Buffer.isBuffer(v)) {
|
|
129
132
|
// Set param format to binary
|
|
130
|
-
io.buffer.writeInt16BE(Protocol.DataFormat.binary, formatOffset + i * 2);
|
|
133
|
+
io.buffer.writeInt16BE(protocol_js_1.Protocol.DataFormat.binary, formatOffset + i * 2);
|
|
131
134
|
// Preserve data length
|
|
132
135
|
io.writeInt32BE(0);
|
|
133
136
|
const dataOffset = io.offset;
|
|
@@ -163,7 +166,7 @@ export class Frontend {
|
|
|
163
166
|
}
|
|
164
167
|
const io = this._io
|
|
165
168
|
.start()
|
|
166
|
-
.writeInt8(Protocol.FrontendMessageCode.Describe)
|
|
169
|
+
.writeInt8(protocol_js_1.Protocol.FrontendMessageCode.Describe)
|
|
167
170
|
.writeInt32BE(0) // Preserve header
|
|
168
171
|
.writeUInt8(args.type.charCodeAt(0))
|
|
169
172
|
.writeCString(args.name || '', 'utf8');
|
|
@@ -175,7 +178,7 @@ export class Frontend {
|
|
|
175
178
|
}
|
|
176
179
|
const io = this._io
|
|
177
180
|
.start()
|
|
178
|
-
.writeInt8(Protocol.FrontendMessageCode.Execute)
|
|
181
|
+
.writeInt8(protocol_js_1.Protocol.FrontendMessageCode.Execute)
|
|
179
182
|
.writeInt32BE(0) // Preserve header
|
|
180
183
|
.writeCString(args.portal || '', 'utf8')
|
|
181
184
|
.writeUInt32BE(args.fetchCount || 0);
|
|
@@ -187,7 +190,7 @@ export class Frontend {
|
|
|
187
190
|
}
|
|
188
191
|
const io = this._io
|
|
189
192
|
.start()
|
|
190
|
-
.writeInt8(Protocol.FrontendMessageCode.Close)
|
|
193
|
+
.writeInt8(protocol_js_1.Protocol.FrontendMessageCode.Close)
|
|
191
194
|
.writeInt32BE(0) // Preserve header
|
|
192
195
|
.writeUInt8(args.type.charCodeAt(0))
|
|
193
196
|
.writeCString(args.name || '', 'utf8');
|
|
@@ -196,7 +199,7 @@ export class Frontend {
|
|
|
196
199
|
getQueryMessage(sql) {
|
|
197
200
|
const io = this._io
|
|
198
201
|
.start()
|
|
199
|
-
.writeInt8(Protocol.FrontendMessageCode.Query)
|
|
202
|
+
.writeInt8(protocol_js_1.Protocol.FrontendMessageCode.Query)
|
|
200
203
|
.writeInt32BE(0) // Preserve header
|
|
201
204
|
.writeCString(sql || '', 'utf8');
|
|
202
205
|
return setLengthAndFlush(io, 1);
|
|
@@ -211,6 +214,7 @@ export class Frontend {
|
|
|
211
214
|
return StaticSyncBuffer;
|
|
212
215
|
}
|
|
213
216
|
}
|
|
217
|
+
exports.Frontend = Frontend;
|
|
214
218
|
function setLengthAndFlush(io, lengthOffset) {
|
|
215
219
|
io.buffer.writeUInt32BE(io.length - lengthOffset, lengthOffset);
|
|
216
220
|
return io.flush();
|