File tree 1 file changed +19
-14
lines changed
1 file changed +19
-14
lines changed Original file line number Diff line number Diff line change @@ -117,15 +117,25 @@ func (rows *mysqlRows) nextResultSet() (int, error) {
117
117
return rows .mc .readResultSetHeaderPacket ()
118
118
}
119
119
120
- func (rows * binaryRows ) NextResultSet () error {
121
- resLen , err := rows .nextResultSet ()
122
- if err != nil {
123
- return err
124
- }
120
+ func (rows * mysqlRows ) nextNotEmptyResultSet () (int , error ) {
121
+ for {
122
+ resLen , err := rows .nextResultSet ()
123
+ if err != nil {
124
+ return 0 , err
125
+ }
126
+
127
+ if resLen > 0 {
128
+ return resLen , nil
129
+ }
125
130
126
- if resLen == 0 {
127
131
rows .rs .done = true
128
- return rows .NextResultSet ()
132
+ }
133
+ }
134
+
135
+ func (rows * binaryRows ) NextResultSet () (err error ) {
136
+ resLen , err := rows .nextNotEmptyResultSet ()
137
+ if err != nil {
138
+ return err
129
139
}
130
140
131
141
// get columns, if not cached, read them and cache them.
@@ -155,17 +165,12 @@ func (rows *binaryRows) Next(dest []driver.Value) error {
155
165
return io .EOF
156
166
}
157
167
158
- func (rows * textRows ) NextResultSet () error {
159
- resLen , err := rows .nextResultSet ()
168
+ func (rows * textRows ) NextResultSet () ( err error ) {
169
+ resLen , err := rows .nextNotEmptyResultSet ()
160
170
if err != nil {
161
171
return err
162
172
}
163
173
164
- if resLen == 0 {
165
- rows .rs .done = true
166
- return rows .NextResultSet ()
167
- }
168
-
169
174
rows .rs .columns , err = rows .mc .readColumns (resLen )
170
175
return err
171
176
}
You can’t perform that action at this time.
0 commit comments