Comparing version 0.2.3 to 0.2.4
@@ -196,2 +196,3 @@ // Generated by CoffeeScript 1.7.1 | ||
var sqlRequest; | ||
this.clearRequestTimer(); | ||
this.transitionTo(this.STATE.LOGGED_IN); | ||
@@ -206,2 +207,5 @@ sqlRequest = this.request; | ||
name: 'SentAttention', | ||
enter: function() { | ||
return this.attentionReceived = false; | ||
}, | ||
events: { | ||
@@ -214,9 +218,17 @@ socketError: function(error) { | ||
}, | ||
attention: function() { | ||
return this.attentionReceived = true; | ||
}, | ||
message: function() { | ||
var sqlRequest; | ||
if (this.request.canceled) { | ||
this.transitionTo(this.STATE.LOGGED_IN); | ||
var message, sqlRequest; | ||
if (this.attentionReceived) { | ||
sqlRequest = this.request; | ||
this.request = void 0; | ||
return sqlRequest.callback(RequestError("Canceled.", 'ECANCEL')); | ||
this.transitionTo(this.STATE.LOGGED_IN); | ||
if (sqlRequest.canceled) { | ||
return sqlRequest.callback(RequestError("Canceled.", 'ECANCEL')); | ||
} else { | ||
message = "Timeout: Request failed to complete in " + this.config.options.requestTimeout + "ms"; | ||
return sqlRequest.callback(RequestError(message, 'ETIMEOUT')); | ||
} | ||
} | ||
@@ -246,2 +258,3 @@ } | ||
this.socketError = __bind(this.socketError, this); | ||
this.requestTimeout = __bind(this.requestTimeout, this); | ||
this.connectTimeout = __bind(this.connectTimeout, this); | ||
@@ -268,2 +281,3 @@ this.defaultConfig(); | ||
this.clearConnectTimer(); | ||
this.clearRequestTimer(); | ||
this.closeConnection(); | ||
@@ -475,2 +489,5 @@ this.emit('end'); | ||
if (_this.request) { | ||
if (token.attention) { | ||
_this.dispatchEvent("attention"); | ||
} | ||
_this.request.emit('done', token.rowCount, token.more, _this.request.rows); | ||
@@ -481,7 +498,4 @@ if (token.rowCount !== void 0) { | ||
if (_this.config.options.rowCollectionOnDone) { | ||
_this.request.rows = []; | ||
return _this.request.rows = []; | ||
} | ||
if (token.attention) { | ||
return _this.request.canceled = true; | ||
} | ||
} | ||
@@ -549,2 +563,8 @@ }; | ||
Connection.prototype.createRequestTimer = function() { | ||
if (this.config.options.requestTimeout) { | ||
return this.requestTimer = setTimeout(this.requestTimeout, this.config.options.requestTimeout); | ||
} | ||
}; | ||
Connection.prototype.connectTimeout = function() { | ||
@@ -559,2 +579,8 @@ var message; | ||
Connection.prototype.requestTimeout = function() { | ||
this.requestTimer = void 0; | ||
this.messageIo.sendMessage(TYPE.ATTENTION); | ||
return this.transitionTo(this.STATE.SENT_ATTENTION); | ||
}; | ||
Connection.prototype.clearConnectTimer = function() { | ||
@@ -566,2 +592,8 @@ if (this.connectTimer) { | ||
Connection.prototype.clearRequestTimer = function() { | ||
if (this.requestTimer) { | ||
return clearTimeout(this.requestTimer); | ||
} | ||
}; | ||
Connection.prototype.transitionTo = function(newState) { | ||
@@ -791,2 +823,3 @@ var _ref1, _ref2; | ||
this.request.rows = []; | ||
this.createRequestTimer(); | ||
this.messageIo.sendMessage(packetType, payload.data, this.resetConnectionOnNextRequest); | ||
@@ -808,2 +841,3 @@ this.resetConnectionOnNextRequest = false; | ||
} else { | ||
this.request.canceled = true; | ||
this.messageIo.sendMessage(TYPE.ATTENTION); | ||
@@ -810,0 +844,0 @@ this.transitionTo(this.STATE.SENT_ATTENTION); |
@@ -260,3 +260,3 @@ // Generated by CoffeeScript 1.7.1 | ||
sign = parameter.value < 0 ? 0 : 1; | ||
value = Math.abs(parameter.value * Math.pow(10, parameter.scale)); | ||
value = Math.round(Math.abs(parameter.value * Math.pow(10, parameter.scale))); | ||
if (parameter.precision <= 9) { | ||
@@ -329,3 +329,3 @@ buffer.writeUInt8(5); | ||
sign = parameter.value < 0 ? 0 : 1; | ||
value = Math.abs(parameter.value * Math.pow(10, parameter.scale)); | ||
value = Math.round(Math.abs(parameter.value * Math.pow(10, parameter.scale))); | ||
if (parameter.precision <= 9) { | ||
@@ -332,0 +332,0 @@ buffer.writeUInt8(5); |
// Generated by CoffeeScript 1.7.1 | ||
var MAX, MONEY_DIVISOR, NULL, PLP_NULL, THREE_AND_A_THIRD, UNKNOWN_PLP_LEN, guidParser, iconv, parse, readBinary, readChars, readDate, readDateTime, readDateTime2, readDateTimeOffset, readMax, readMaxBinary, readMaxChars, readMaxNChars, readNChars, readSmallDateTime, readTime, sprintf; | ||
var DEFAULT_ENCODING, MAX, MONEY_DIVISOR, NULL, PLP_NULL, THREE_AND_A_THIRD, UNKNOWN_PLP_LEN, guidParser, iconv, parse, readBinary, readChars, readDate, readDateTime, readDateTime2, readDateTimeOffset, readMax, readMaxBinary, readMaxChars, readMaxNChars, readNChars, readSmallDateTime, readTime, sprintf; | ||
@@ -24,2 +24,4 @@ iconv = require('iconv-lite'); | ||
DEFAULT_ENCODING = 'utf8'; | ||
parse = function(buffer, metaData, options) { | ||
@@ -313,2 +315,5 @@ var codepage, dataLength, high, low, sign, textPointerLength, textPointerNull, type, value; | ||
readChars = function(buffer, dataLength, codepage) { | ||
if (codepage == null) { | ||
codepage = DEFAULT_ENCODING; | ||
} | ||
if (dataLength === NULL) { | ||
@@ -336,2 +341,5 @@ return null; | ||
readMaxChars = function(buffer, codepage) { | ||
if (codepage == null) { | ||
codepage = DEFAULT_ENCODING; | ||
} | ||
return readMax(buffer, function(valueBuffer) { | ||
@@ -338,0 +346,0 @@ return iconv.decode(valueBuffer, codepage); |
@@ -29,3 +29,3 @@ { | ||
], | ||
"version": "0.2.3", | ||
"version": "0.2.4", | ||
"main": "./lib/tedious.js", | ||
@@ -40,3 +40,3 @@ "repository": { | ||
"dependencies": { | ||
"iconv-lite": "0.2.7", | ||
"iconv-lite": "0.4.2", | ||
"sprintf": "0.1.1" | ||
@@ -43,0 +43,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
164642
4779
+ Addediconv-lite@0.4.2(transitive)
- Removediconv-lite@0.2.7(transitive)
Updatediconv-lite@0.4.2