File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ class Result {
99 this . rowCount = undefined
1010 this . fields = [ ]
1111 this . rows = [ ]
12+ this . _prebuiltEmptyResultObject = null
1213 }
1314
1415 consumeCommand ( pq ) {
@@ -19,9 +20,12 @@ class Result {
1920 consumeFields ( pq ) {
2021 const nfields = pq . nfields ( )
2122 this . fields = new Array ( nfields )
23+ this . _prebuiltEmptyResultObject = { }
2224 for ( var x = 0 ; x < nfields ; x ++ ) {
25+ var name = pq . fname ( x )
26+ this . _prebuiltEmptyResultObject [ name ] = null
2327 this . fields [ x ] = {
24- name : pq . fname ( x ) ,
28+ name : name ,
2529 dataTypeID : pq . ftype ( x ) ,
2630 }
2731 }
@@ -36,7 +40,7 @@ class Result {
3640 }
3741
3842 consumeRowAsObject ( pq , rowIndex ) {
39- const row = { }
43+ const row = { ... this . _prebuiltEmptyResultObject }
4044 for ( var j = 0 ; j < this . fields . length ; j ++ ) {
4145 row [ this . fields [ j ] . name ] = this . readValue ( pq , rowIndex , j )
4246 }
You can’t perform that action at this time.
0 commit comments