Emit message if the returned row is bigger than limit
This commit is contained in:
parent
83a946f61c
commit
fa8cfcaebf
@ -153,6 +153,10 @@ Client.prototype.connect = function(callback) {
|
|||||||
self.emit('notification', msg);
|
self.emit('notification', msg);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
con.on('maxRowSize', function (msg) {
|
||||||
|
self.emit('maxRowSize', msg);
|
||||||
|
});
|
||||||
|
|
||||||
//process possible callback argument to Client#connect
|
//process possible callback argument to Client#connect
|
||||||
if (callback) {
|
if (callback) {
|
||||||
callback(null, self);
|
callback(null, self);
|
||||||
|
@ -10,6 +10,8 @@ var net = require('net');
|
|||||||
var EventEmitter = require('events').EventEmitter;
|
var EventEmitter = require('events').EventEmitter;
|
||||||
var util = require('util');
|
var util = require('util');
|
||||||
|
|
||||||
|
var defaults = require(__dirname + '/defaults');
|
||||||
|
|
||||||
var Writer = require('buffer-writer');
|
var Writer = require('buffer-writer');
|
||||||
var Reader = require('packet-reader');
|
var Reader = require('packet-reader');
|
||||||
|
|
||||||
@ -521,6 +523,10 @@ var DataRowMessage = function(length, fieldCount) {
|
|||||||
|
|
||||||
//extremely hot-path code
|
//extremely hot-path code
|
||||||
Connection.prototype.parseD = function(buffer, length) {
|
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 fieldCount = this.parseInt16(buffer);
|
||||||
var msg = new DataRowMessage(length, fieldCount);
|
var msg = new DataRowMessage(length, fieldCount);
|
||||||
for(var i = 0; i < fieldCount; i++) {
|
for(var i = 0; i < fieldCount; i++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user