File tree 2 files changed +11
-3
lines changed
2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -129,9 +129,7 @@ function Connection(options = {}) {
129
129
function onready ( err ) {
130
130
err
131
131
? ( backend . query ? backend . query . reject ( err ) : error ( err ) )
132
- : ( backend . query && backend . query . resolve ( backend . query . stream
133
- ? backend . query . result . count
134
- : ( backend . query . results || backend . query . result ) ) )
132
+ : ( backend . query && backend . query . resolve ( backend . query . results || backend . query . result ) )
135
133
136
134
backend . query = backend . error = null
137
135
timeout && queries . length === 0 && idle ( )
Original file line number Diff line number Diff line change @@ -735,6 +735,16 @@ t('bytea serializes and parses', async() => {
735
735
return [ 0 , Buffer . compare ( buf , ( await sql `select x from test` ) [ 0 ] . x ) ]
736
736
} )
737
737
738
+ t ( 'Stream works' , async ( ) => {
739
+ let result
740
+ await sql `select 1 as x` . stream ( ( { x } ) => result = x )
741
+ return [ 1 , result ]
742
+ } )
743
+
744
+ t ( 'Stream returns empty array' , async ( ) => {
745
+ return [ 0 , ( await sql `select 1 as x` . stream ( x => { } ) ) . length ]
746
+ } )
747
+
738
748
t ( 'Transform row' , async ( ) => {
739
749
const sql = postgres ( {
740
750
...options ,
You can’t perform that action at this time.
0 commit comments