Merge pull request #594 from lukemurray/master
avoid eval if the row is returned as an array
This commit is contained in:
commit
f8df873023
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user