Emit message if the returned row is bigger than limit

This commit is contained in:
Daniel García Aubert 2016-12-07 15:12:43 +01:00
parent 83a946f61c
commit fa8cfcaebf
2 changed files with 10 additions and 0 deletions

View File

@ -153,6 +153,10 @@ Client.prototype.connect = function(callback) {
self.emit('notification', msg);
});
con.on('maxRowSize', function (msg) {
self.emit('maxRowSize', msg);
});
//process possible callback argument to Client#connect
if (callback) {
callback(null, self);

View File

@ -10,6 +10,8 @@ var net = require('net');
var EventEmitter = require('events').EventEmitter;
var util = require('util');
var defaults = require(__dirname + '/defaults');
var Writer = require('buffer-writer');
var Reader = require('packet-reader');
@ -521,6 +523,10 @@ var DataRowMessage = function(length, fieldCount) {
//extremely hot-path code
Connection.prototype.parseD = function(buffer, length) {
if (Number.isFinite(defaults.maxRowSize) && length > defaults.maxRowSize) {
return new Message('maxRowSize', length);
}
var fieldCount = this.parseInt16(buffer);
var msg = new DataRowMessage(length, fieldCount);
for(var i = 0; i < fieldCount; i++) {