File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ class PgQueryStream extends Readable {
1515 this . handleCommandComplete = this . cursor . handleCommandComplete . bind ( this . cursor )
1616 this . handleReadyForQuery = this . cursor . handleReadyForQuery . bind ( this . cursor )
1717 this . handleError = this . cursor . handleError . bind ( this . cursor )
18+ this . handleEmptyQuery = this . cursor . handleEmptyQuery . bind ( this . cursor )
1819 }
1920
2021 submit ( connection ) {
Original file line number Diff line number Diff line change 1+ const assert = require ( 'assert' )
2+ const helper = require ( './helper' )
3+ const QueryStream = require ( '../' )
4+
5+ helper ( 'empty-query' , function ( client ) {
6+ it ( 'handles empty query' , function ( done ) {
7+ const stream = new QueryStream ( '-- this is a comment' , [ ] )
8+ const query = client . query ( stream )
9+ query . on ( 'end' , function ( ) {
10+ // nothing should happen for empty query
11+ done ( ) ;
12+ } ) . on ( 'data' , function ( ) {
13+ // noop to kick off reading
14+ } )
15+ } )
16+
17+ it ( 'continues to function after stream' , function ( done ) {
18+ client . query ( 'SELECT NOW()' , done )
19+ } )
20+ } )
You can’t perform that action at this time.
0 commit comments