Skip to content

Commit

Permalink
Merge pull request #594 from lukemurray/master
Browse files Browse the repository at this point in the history
avoid eval if the row is returned as an array
  • Loading branch information
brianc committed May 22, 2014
2 parents 79a4bf6 + a8f9b7d commit f8df873
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/result.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
};
Expand Down Expand Up @@ -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;

0 comments on commit f8df873

Please sign in to comment.