UNPKG

4.31 kBJavaScriptView Raw
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.default = void 0;
7var _writableTrackingBuffer = _interopRequireDefault(require("./tracking-buffer/writable-tracking-buffer"));
8var _allHeaders = require("./all-headers");
9function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10/*
11 s2.2.6.6
12 */
13class SqlBatchPayload {
14 constructor(sqlText, txnDescriptor, options) {
15 this.sqlText = sqlText;
16 this.txnDescriptor = txnDescriptor;
17 this.options = options;
18 }
19 *[Symbol.iterator]() {
20 if (this.options.tdsVersion >= '7_2') {
21 const buffer = new _writableTrackingBuffer.default(18, 'ucs2');
22 const outstandingRequestCount = 1;
23 (0, _allHeaders.writeToTrackingBuffer)(buffer, this.txnDescriptor, outstandingRequestCount);
24 yield buffer.data;
25 }
26 yield Buffer.from(this.sqlText, 'ucs2');
27 }
28 toString(indent = '') {
29 return indent + ('SQL Batch - ' + this.sqlText);
30 }
31}
32var _default = exports.default = SqlBatchPayload;
33module.exports = SqlBatchPayload;
34//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJfd3JpdGFibGVUcmFja2luZ0J1ZmZlciIsIl9pbnRlcm9wUmVxdWlyZURlZmF1bHQiLCJyZXF1aXJlIiwiX2FsbEhlYWRlcnMiLCJvYmoiLCJfX2VzTW9kdWxlIiwiZGVmYXVsdCIsIlNxbEJhdGNoUGF5bG9hZCIsImNvbnN0cnVjdG9yIiwic3FsVGV4dCIsInR4bkRlc2NyaXB0b3IiLCJvcHRpb25zIiwiU3ltYm9sIiwiaXRlcmF0b3IiLCJ0ZHNWZXJzaW9uIiwiYnVmZmVyIiwiV3JpdGFibGVUcmFja2luZ0J1ZmZlciIsIm91dHN0YW5kaW5nUmVxdWVzdENvdW50Iiwid3JpdGVUb1RyYWNraW5nQnVmZmVyIiwiZGF0YSIsIkJ1ZmZlciIsImZyb20iLCJ0b1N0cmlu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