Merge pull request #594 from lukemurray/master

avoid eval if the row is returned as an array
This commit is contained in:
Brian C 2014-05-22 12:09:09 -04:00
commit f8df873023

View File

@ -11,7 +11,8 @@ var Result = function(rowMode) {
this.fields = [];
this._parsers = [];
this.RowCtor = null;
if(rowMode == "array") {
this.rowAsArray = rowMode == "array";
if(this.rowAsArray) {
this.parseRow = this._parseRowAsArray;
}
};
@ -93,7 +94,9 @@ Result.prototype.addFields = function(fieldDescriptions) {
//results in ~60% speedup on large query result sets
ctorBody += inlineParser(desc.name, i);
}
this.RowCtor = Function("parsers", "rowData", ctorBody);
if(!this.rowAsArray) {
this.RowCtor = Function("parsers", "rowData", ctorBody);
}
};
module.exports = Result;