File tree 2 files changed +10
-9
lines changed
2 files changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,6 @@ function Backend({
15
15
onnotice,
16
16
onnotify
17
17
} ) {
18
- let result = null
19
18
let rows = 0
20
19
21
20
const backend = Object . entries ( {
@@ -79,12 +78,14 @@ function Backend({
79
78
}
80
79
81
80
function CommandComplete ( x ) {
82
- backend . query && resolve ( backend . query . stream
83
- ? rows + 1
84
- : result
81
+ if ( ! backend . query )
82
+ return
83
+
84
+ backend . query . result . count = + x . utf8Slice ( 5 , x . length - 1 ) . split ( ' ' ) . pop ( ) // eslint-disable-line
85
+ resolve ( backend . query . stream
86
+ ? backend . query . result . count
87
+ : backend . query . result
85
88
)
86
- result = null
87
- rows = 0
88
89
}
89
90
90
91
function CopyDone ( x ) {
@@ -113,7 +114,7 @@ function Backend({
113
114
114
115
backend . query . stream
115
116
? backend . query . stream ( row , rows ++ )
116
- : result . push ( row )
117
+ : backend . query . result . push ( row )
117
118
}
118
119
119
120
function CopyData ( x ) {
@@ -170,7 +171,6 @@ function Backend({
170
171
}
171
172
172
173
function RowDescription ( x ) {
173
- result = [ ]
174
174
rows = 0
175
175
176
176
if ( backend . query . statement . columns )
Original file line number Diff line number Diff line change @@ -87,6 +87,7 @@ export default function Connection(options = {}) {
87
87
}
88
88
89
89
function send ( query , { sig, str, args = [ ] } ) {
90
+ query . result = [ ]
90
91
timeout && clearTimeout ( timer )
91
92
! connection . ready || backend . query
92
93
? queries . push ( query )
@@ -144,7 +145,7 @@ export default function Connection(options = {}) {
144
145
if ( length >= buffer . length )
145
146
break
146
147
147
- ( backend [ buffer [ 0 ] ] || unknown ) ( buffer )
148
+ ( backend [ buffer [ 0 ] ] || unknown ) ( buffer . slice ( 0 , length + 1 ) )
148
149
buffer = buffer . slice ( length + 1 )
149
150
}
150
151
}
You can’t perform that action at this time.
0 commit comments