node-firebird 2.3.0 → 2.3.1
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/lib/index.js +0 -7
- package/lib/utils.js +1 -1
- package/lib/wire/serialize.js +12 -11
- package/package.json +1 -2
package/lib/index.js
CHANGED
|
@@ -23,13 +23,6 @@ exports.ISOLATION_REPEATABLE_READ = Const.ISOLATION_REPEATABLE_READ;
|
|
|
23
23
|
exports.ISOLATION_SERIALIZABLE = Const.ISOLATION_SERIALIZABLE;
|
|
24
24
|
exports.ISOLATION_READ_COMMITTED_READ_ONLY = Const.ISOLATION_READ_COMMITTED_READ_ONLY;
|
|
25
25
|
|
|
26
|
-
if (!String.prototype.padLeft) {
|
|
27
|
-
String.prototype.padLeft = function(max, c) {
|
|
28
|
-
var self = this;
|
|
29
|
-
return new Array(Math.max(0, max - self.length + 1)).join(c || ' ') + self;
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
|
|
33
26
|
exports.escape = escape;
|
|
34
27
|
|
|
35
28
|
exports.attach = function(options, callback) {
|
package/lib/utils.js
CHANGED
|
@@ -149,7 +149,7 @@ const escape = function(value, protocolVersion) {
|
|
|
149
149
|
}
|
|
150
150
|
|
|
151
151
|
if (value instanceof Date)
|
|
152
|
-
return "'" + value.getFullYear() + '-' + (value.getMonth()+1).toString().
|
|
152
|
+
return "'" + value.getFullYear() + '-' + (value.getMonth()+1).toString().padStart(2, '0') + '-' + value.getDate().toString().padStart(2, '0') + ' ' + value.getHours().toString().padStart(2, '0') + ':' + value.getMinutes().toString().padStart(2, '0') + ':' + value.getSeconds().toString().padStart(2, '0') + '.' + value.getMilliseconds().toString().padStart(3, '0') + "'";
|
|
153
153
|
|
|
154
154
|
throw new Error('Escape supports only primitive values.');
|
|
155
155
|
};
|
package/lib/wire/serialize.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
2
|
const { encodeDecimal64, decodeDecimal64, encodeDecimal128, decodeDecimal128 } = require('../ieee754-decimal');
|
|
3
3
|
|
|
4
4
|
function align(n) {
|
|
@@ -277,11 +277,11 @@ class XdrWriter {
|
|
|
277
277
|
|
|
278
278
|
addInt64(value) {
|
|
279
279
|
this.ensure(8);
|
|
280
|
-
|
|
281
|
-
this
|
|
282
|
-
|
|
283
|
-
this.buffer.
|
|
284
|
-
this.pos +=
|
|
280
|
+
// Note: precision is limited to Number.MAX_SAFE_INTEGER (±2^53-1).
|
|
281
|
+
// Values outside this range lose precision, which matches the previous
|
|
282
|
+
// Long.fromNumber() behaviour.
|
|
283
|
+
this.buffer.writeBigInt64BE(BigInt(Math.trunc(value)), this.pos);
|
|
284
|
+
this.pos += 8;
|
|
285
285
|
}
|
|
286
286
|
|
|
287
287
|
addInt128(value) {
|
|
@@ -410,11 +410,12 @@ class XdrReader {
|
|
|
410
410
|
}
|
|
411
411
|
|
|
412
412
|
readInt64() {
|
|
413
|
-
|
|
414
|
-
this
|
|
415
|
-
|
|
416
|
-
this.pos
|
|
417
|
-
|
|
413
|
+
// Note: precision is limited to Number.MAX_SAFE_INTEGER (±2^53-1).
|
|
414
|
+
// Values outside this range lose precision, which matches the previous
|
|
415
|
+
// Long(low, high).toNumber() behaviour.
|
|
416
|
+
const result = Number(this.buffer.readBigInt64BE(this.pos));
|
|
417
|
+
this.pos += 8;
|
|
418
|
+
return result;
|
|
418
419
|
}
|
|
419
420
|
|
|
420
421
|
readInt128() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-firebird",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.1",
|
|
4
4
|
"description": "Pure JavaScript and Asynchronous Firebird client for Node.js.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"firebird",
|
|
@@ -29,7 +29,6 @@
|
|
|
29
29
|
"lint": "oxlint"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"long": "^5.2.3"
|
|
33
32
|
},
|
|
34
33
|
"devDependencies": {
|
|
35
34
|
"coveralls-next": "^6.0.1",
|