File tree 1 file changed +10
-3
lines changed
1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -50,14 +50,19 @@ Cursor.prototype.handleDataRow = function(msg) {
50
50
Cursor . prototype . _sendRows = function ( ) {
51
51
this . state = 'idle'
52
52
setImmediate ( function ( ) {
53
- this . _cb ( null , this . _rows )
53
+ var cb = this . _cb
54
+ //remove callback before calling it
55
+ //because likely a new one will be added
56
+ //within the call to this callback
57
+ this . _cb = null
58
+ if ( cb ) {
59
+ cb ( null , this . _rows )
60
+ }
54
61
this . _rows = [ ]
55
62
} . bind ( this ) )
56
63
}
57
64
58
65
Cursor . prototype . handleCommandComplete = function ( ) {
59
- this . _sendRows ( )
60
- this . state = 'done'
61
66
this . connection . sync ( )
62
67
}
63
68
@@ -66,6 +71,8 @@ Cursor.prototype.handlePortalSuspended = function() {
66
71
}
67
72
68
73
Cursor . prototype . handleReadyForQuery = function ( ) {
74
+ this . _sendRows ( )
75
+ this . state = 'done'
69
76
}
70
77
71
78
Cursor . prototype . handleError = function ( msg ) {
You can’t perform that action at this time.
0 commit comments