tedious 6.4.0 → 6.6.2
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/bulk-load.js +17 -22
- package/lib/connection.js +363 -251
- package/lib/connector.js +3 -1
- package/lib/data-type.js +111 -109
- package/lib/data-types/bigint.js +19 -7
- package/lib/data-types/binary.js +19 -10
- package/lib/data-types/bit.js +14 -4
- package/lib/data-types/bitn.js +26 -3
- package/lib/data-types/char.js +26 -13
- package/lib/data-types/date.js +18 -9
- package/lib/data-types/datetime.js +23 -5
- package/lib/data-types/datetime2.js +10 -22
- package/lib/data-types/datetimen.js +26 -3
- package/lib/data-types/datetimeoffset.js +11 -22
- package/lib/data-types/decimal.js +14 -6
- package/lib/data-types/decimaln.js +26 -5
- package/lib/data-types/float.js +14 -4
- package/lib/data-types/floatn.js +26 -3
- package/lib/data-types/image.js +12 -5
- package/lib/data-types/int.js +14 -4
- package/lib/data-types/intn.js +26 -3
- package/lib/data-types/money.js +14 -4
- package/lib/data-types/moneyn.js +26 -3
- package/lib/data-types/nchar.js +17 -6
- package/lib/data-types/ntext.js +26 -5
- package/lib/data-types/null.js +27 -3
- package/lib/data-types/numeric.js +14 -6
- package/lib/data-types/numericn.js +26 -5
- package/lib/data-types/nvarchar.js +20 -11
- package/lib/data-types/real.js +14 -4
- package/lib/data-types/smalldatetime.js +14 -4
- package/lib/data-types/smallint.js +14 -4
- package/lib/data-types/smallmoney.js +14 -4
- package/lib/data-types/sql-variant.js +23 -4
- package/lib/data-types/text.js +13 -7
- package/lib/data-types/time.js +9 -21
- package/lib/data-types/tinyint.js +14 -4
- package/lib/data-types/tvp.js +12 -3
- package/lib/data-types/udt.js +26 -3
- package/lib/data-types/uniqueidentifier.js +12 -5
- package/lib/data-types/varbinary.js +18 -8
- package/lib/data-types/varchar.js +19 -10
- package/lib/data-types/xml.js +26 -3
- package/lib/debug.js +3 -1
- package/lib/guid-parser.js +6 -6
- package/lib/incoming-message-stream.js +10 -7
- package/lib/instance-lookup.js +12 -6
- package/lib/library.js +6 -1
- package/lib/login7-payload.js +2 -3
- package/lib/message-io.js +14 -3
- package/lib/message.js +2 -3
- package/lib/metadata-parser.js +259 -136
- package/lib/ntlm-payload.js +12 -21
- package/lib/outgoing-message-stream.js +7 -6
- package/lib/packet.js +4 -5
- package/lib/prelogin-payload.js +3 -4
- package/lib/request.js +11 -11
- package/lib/rpcrequest-payload.js +28 -22
- package/lib/sender.js +25 -11
- package/lib/special-stored-procedure.js +9 -2
- package/lib/tds-versions.js +8 -2
- package/lib/tedious.js +75 -9
- package/lib/token/colmetadata-token-parser.js +20 -10
- package/lib/token/done-token-parser.js +32 -25
- package/lib/token/env-change-token-parser.js +50 -20
- package/lib/token/feature-ext-ack-parser.js +19 -14
- package/lib/token/fedauth-info-parser.js +17 -11
- package/lib/token/infoerror-token-parser.js +14 -14
- package/lib/token/loginack-token-parser.js +21 -12
- package/lib/token/nbcrow-token-parser.js +35 -23
- package/lib/token/order-token-parser.js +14 -7
- package/lib/token/returnstatus-token-parser.js +14 -7
- package/lib/token/returnvalue-token-parser.js +22 -11
- package/lib/token/row-token-parser.js +34 -22
- package/lib/token/sspi-token-parser.js +14 -8
- package/lib/token/stream-parser.js +95 -36
- package/lib/token/token-stream-parser.js +16 -10
- package/lib/token/token.js +396 -2
- package/lib/tracking-buffer/writable-tracking-buffer.js +37 -5
- package/lib/transaction.js +25 -16
- package/lib/transient-error-lookup.js +6 -1
- package/lib/value-parser.js +412 -315
- package/package.json +24 -21
- package/pull_request_template.md +1 -1
- package/tsconfig.json +1 -1
- package/lib/tracking-buffer/bigint.js +0 -102
package/lib/bulk-load.js
CHANGED
|
@@ -9,18 +9,17 @@ var _events = require("events");
|
|
|
9
9
|
|
|
10
10
|
var _writableTrackingBuffer = _interopRequireDefault(require("./tracking-buffer/writable-tracking-buffer"));
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
var _readableStream = require("readable-stream");
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
var _token = require("./token/token");
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
var _message = _interopRequireDefault(require("./message"));
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
var _packet = require("./packet");
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
var _errors = require("./errors");
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
RequestError = _require.RequestError;
|
|
22
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
24
23
|
|
|
25
24
|
const FLAGS = {
|
|
26
25
|
nullable: 1 << 0,
|
|
@@ -129,16 +128,12 @@ class BulkLoad extends _events.EventEmitter {
|
|
|
129
128
|
}
|
|
130
129
|
}
|
|
131
130
|
|
|
132
|
-
if (type.
|
|
133
|
-
|
|
134
|
-
column.precision = type.resolvePrecision(column);
|
|
135
|
-
}
|
|
131
|
+
if (type.resolvePrecision && column.precision == null) {
|
|
132
|
+
column.precision = type.resolvePrecision(column);
|
|
136
133
|
}
|
|
137
134
|
|
|
138
|
-
if (type.
|
|
139
|
-
|
|
140
|
-
column.scale = type.resolveScale(column);
|
|
141
|
-
}
|
|
135
|
+
if (type.resolveScale && column.scale == null) {
|
|
136
|
+
column.scale = type.resolveScale(column);
|
|
142
137
|
}
|
|
143
138
|
|
|
144
139
|
this.columns.push(column);
|
|
@@ -234,7 +229,7 @@ class BulkLoad extends _events.EventEmitter {
|
|
|
234
229
|
getColMetaData() {
|
|
235
230
|
const tBuf = new _writableTrackingBuffer.default(100, null, true); // TokenType
|
|
236
231
|
|
|
237
|
-
tBuf.writeUInt8(
|
|
232
|
+
tBuf.writeUInt8(_token.TYPE.COLMETADATA); // Count
|
|
238
233
|
|
|
239
234
|
tBuf.writeUInt16LE(this.columns.length);
|
|
240
235
|
|
|
@@ -273,7 +268,7 @@ class BulkLoad extends _events.EventEmitter {
|
|
|
273
268
|
createDoneToken() {
|
|
274
269
|
// It might be nice to make DoneToken a class if anything needs to create them, but for now, just do it here
|
|
275
270
|
const tBuf = new _writableTrackingBuffer.default(this.options.tdsVersion < '7_2' ? 9 : 13);
|
|
276
|
-
tBuf.writeUInt8(
|
|
271
|
+
tBuf.writeUInt8(_token.TYPE.DONE);
|
|
277
272
|
const status = DONE_STATUS.FINAL;
|
|
278
273
|
tBuf.writeUInt16LE(status);
|
|
279
274
|
tBuf.writeUInt16LE(0); // CurCmd (TDS ignores this)
|
|
@@ -303,8 +298,8 @@ class BulkLoad extends _events.EventEmitter {
|
|
|
303
298
|
}
|
|
304
299
|
|
|
305
300
|
getMessageStream() {
|
|
306
|
-
const message = new
|
|
307
|
-
type:
|
|
301
|
+
const message = new _message.default({
|
|
302
|
+
type: _packet.TYPE.BULK_LOAD
|
|
308
303
|
});
|
|
309
304
|
this.rowToPacketTransform.pipe(message);
|
|
310
305
|
this.rowToPacketTransform.once('finish', () => {
|
|
@@ -312,7 +307,7 @@ class BulkLoad extends _events.EventEmitter {
|
|
|
312
307
|
});
|
|
313
308
|
|
|
314
309
|
const onCancel = () => {
|
|
315
|
-
this.rowToPacketTransform.emit('error', RequestError('Canceled.', 'ECANCEL'));
|
|
310
|
+
this.rowToPacketTransform.emit('error', (0, _errors.RequestError)('Canceled.', 'ECANCEL'));
|
|
316
311
|
this.rowToPacketTransform.destroy();
|
|
317
312
|
};
|
|
318
313
|
|
|
@@ -335,7 +330,7 @@ var _default = BulkLoad;
|
|
|
335
330
|
exports.default = _default;
|
|
336
331
|
module.exports = BulkLoad; // A transform that converts rows to packets.
|
|
337
332
|
|
|
338
|
-
class RowTransform extends Transform {
|
|
333
|
+
class RowTransform extends _readableStream.Transform {
|
|
339
334
|
constructor(bulkLoad) {
|
|
340
335
|
super({
|
|
341
336
|
writableObjectMode: true
|
|
@@ -353,7 +348,7 @@ class RowTransform extends Transform {
|
|
|
353
348
|
}
|
|
354
349
|
|
|
355
350
|
const buf = new _writableTrackingBuffer.default(64, 'ucs2', true);
|
|
356
|
-
buf.writeUInt8(
|
|
351
|
+
buf.writeUInt8(_token.TYPE.ROW);
|
|
357
352
|
|
|
358
353
|
for (let i = 0; i < this.columns.length; i++) {
|
|
359
354
|
const c = this.columns[i];
|