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.fields = [];
|
||||||
this._parsers = [];
|
this._parsers = [];
|
||||||
this.RowCtor = null;
|
this.RowCtor = null;
|
||||||
if(rowMode == "array") {
|
this.rowAsArray = rowMode == "array";
|
||||||
|
if(this.rowAsArray) {
|
||||||
this.parseRow = this._parseRowAsArray;
|
this.parseRow = this._parseRowAsArray;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -93,7 +94,9 @@ Result.prototype.addFields = function(fieldDescriptions) {
|
|||||||
//results in ~60% speedup on large query result sets
|
//results in ~60% speedup on large query result sets
|
||||||
ctorBody += inlineParser(desc.name, i);
|
ctorBody += inlineParser(desc.name, i);
|
||||||
}
|
}
|
||||||
this.RowCtor = Function("parsers", "rowData", ctorBody);
|
if(!this.rowAsArray) {
|
||||||
|
this.RowCtor = Function("parsers", "rowData", ctorBody);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = Result;
|
module.exports = Result;
|
||||||
|
Loading…
Reference in New Issue
Block a user