Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions lib/protocol/ClientInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,11 @@ ClientInfo.prototype.getUpdatedProperties = function getUpdatedProperties() {
return res;
};

ClientInfo.prototype.getUpdatedPropertiesSize = function getUpdatedProperties() {
var self = this;
var res = Object.keys(this._updatedProperties).reduce(function (p, c) {
p += c.length + self._properties[c].length
return p;
}, 0);
return res;
};
1 change: 1 addition & 0 deletions lib/protocol/Connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,7 @@ Connection.prototype.getAvailableSize = function getAvailableSize(forLobs = fals
if (this._statementContext) {
availableSize -= this._statementContext.size;
}
availableSize -= this._clientInfo.getUpdatedPropertiesSize() + SEGMENT_HEADER_LENGTH
return availableSize;
};

Expand Down
10 changes: 10 additions & 0 deletions test/lib.Connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,16 @@ describe('Lib', function () {
var c8 = createConnection({ packetSize: ps, packetSizeLimit: psl });
c8.getAvailableSize(false).should.equal(packetSizeMax - totalHeaderLength);
c8.getAvailableSize(true).should.equal(packetSizeMax - totalHeaderLength);

// client info property set
var c9 = createConnection();
c9._statementContext = {
size: 32,
};
c9.getClientInfo().setProperty('LOCALE', 'en_US');
var clientInfoSize = 11
c9.getAvailableSize().should.equal(packetSizeDefault - totalHeaderLength - 32 - clientInfoSize - 24);
c9.getAvailableSize(true).should.equal(packetSizeDefault - totalHeaderLength - 32 - clientInfoSize - 24);
});

it('should parse a reply', function () {
Expand Down