Skip to content

Commit a8f9b7d

Browse files
committed
avoid eval if the row is returned as an array
1 parent 3898f5d commit a8f9b7d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/result.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ var Result = function(rowMode) {
1111
this.fields = [];
1212
this._parsers = [];
1313
this.RowCtor = null;
14-
if(rowMode == "array") {
14+
this.rowAsArray = rowMode == "array";
15+
if(this.rowAsArray) {
1516
this.parseRow = this._parseRowAsArray;
1617
}
1718
};
@@ -93,7 +94,9 @@ Result.prototype.addFields = function(fieldDescriptions) {
9394
//results in ~60% speedup on large query result sets
9495
ctorBody += inlineParser(desc.name, i);
9596
}
96-
this.RowCtor = Function("parsers", "rowData", ctorBody);
97+
if(!this.rowAsArray) {
98+
this.RowCtor = Function("parsers", "rowData", ctorBody);
99+
}
97100
};
98101

99102
module.exports = Result;

0 commit comments

Comments
 (0)