File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ class Result {
1010 this . fields = [ ]
1111 this . rows = [ ]
1212 this . _prebuiltEmptyResultObject = null
13+ this . _parsers = [ ]
1314 }
1415
1516 consumeCommand ( pq ) {
@@ -21,13 +22,16 @@ class Result {
2122 const nfields = pq . nfields ( )
2223 this . fields = new Array ( nfields )
2324 const row = { }
25+ this . _parsers = new Array ( nfields )
2426 for ( let x = 0 ; x < nfields ; x ++ ) {
2527 const name = pq . fname ( x )
2628 row [ name ] = null
29+ const typeId = pq . ftype ( x )
2730 this . fields [ x ] = {
2831 name : name ,
29- dataTypeID : pq . ftype ( x ) ,
32+ dataTypeID : typeId ,
3033 }
34+ this . _parsers [ x ] = this . _types . getTypeParser ( typeId )
3135 }
3236 this . _prebuiltEmptyResultObject = { ...row }
3337 }
@@ -61,8 +65,7 @@ class Result {
6165 if ( rawValue === '' && pq . getisnull ( rowIndex , colIndex ) ) {
6266 return null
6367 }
64- const dataTypeId = this . fields [ colIndex ] . dataTypeID
65- return this . _types . getTypeParser ( dataTypeId ) ( rawValue )
68+ return this . _parsers [ colIndex ] ( rawValue )
6669 }
6770}
6871
You can’t perform that action at this time.
0 commit comments