// Generated by CoffeeScript 1.7.1
var SqlBatchPayload, WritableTrackingBuffer, writeAllHeaders;

WritableTrackingBuffer = require('./tracking-buffer/tracking-buffer').WritableTrackingBuffer;

writeAllHeaders = require('./all-headers').writeToTrackingBuffer;


/*
  s2.2.6.6
 */

SqlBatchPayload = (function() {
  function SqlBatchPayload(sqlText, txnDescriptor, options) {
    var buffer, outstandingRequestCount;
    this.sqlText = sqlText;
    buffer = new WritableTrackingBuffer(100 + (2 * this.sqlText.length), 'ucs2');
    if (options.tdsVersion >= '7_2') {
      outstandingRequestCount = 1;
      writeAllHeaders(buffer, txnDescriptor, outstandingRequestCount);
    }
    buffer.writeString(this.sqlText, 'ucs2');
    this.data = buffer.data;
  }

  SqlBatchPayload.prototype.toString = function(indent) {
    indent || (indent = '');
    return indent + ("SQL Batch - " + this.sqlText);
  };

  return SqlBatchPayload;

})();

module.exports = SqlBatchPayload;
