File tree 2 files changed +21
-0
lines changed
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 {
15
15
this . handleCommandComplete = this . cursor . handleCommandComplete . bind ( this . cursor )
16
16
this . handleReadyForQuery = this . cursor . handleReadyForQuery . bind ( this . cursor )
17
17
this . handleError = this . cursor . handleError . bind ( this . cursor )
18
+ this . handleEmptyQuery = this . cursor . handleEmptyQuery . bind ( this . cursor )
18
19
}
19
20
20
21
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