@@ -204,13 +204,27 @@ where
204204 /// One could use it to check if there is more than one result set in this query result.
205205 pub fn is_empty ( & self ) -> bool {
206206 match * self {
207- QueryResult ( Empty ( ..) ) => {
208- !self . get_status ( ) . contains ( StatusFlags :: SERVER_MORE_RESULTS_EXISTS )
209- } ,
207+ QueryResult ( Empty ( ..) ) => !self . more_results_exists ( ) ,
210208 _ => false ,
211209 }
212210 }
213211
212+ /// Returns `true` if the SERVER_MORE_RESULTS_EXISTS flag is contained in status flags
213+ /// of the connection.
214+ fn more_results_exists ( & self ) -> bool {
215+ self . get_status ( ) . contains ( StatusFlags :: SERVER_MORE_RESULTS_EXISTS )
216+ }
217+
218+ /// `true` if rows may exists for this query result.
219+ ///
220+ /// If `false` then there is no rows possible (for example UPDATE query).
221+ fn has_rows ( & self ) -> bool {
222+ match * self {
223+ QueryResult ( Empty ( ..) ) => false ,
224+ _ => true ,
225+ }
226+ }
227+
214228 /// Returns future that collects result set of this query result.
215229 ///
216230 /// It is parametrized by `R` and internally calls `R::from_row(Row)` on each row.
@@ -337,8 +351,13 @@ where
337351
338352 /// Returns future that will drop this query result end resolve to a wrapped `Queryable`.
339353 pub fn drop_result ( self ) -> BoxFuture < T > {
340- let fut = loop_fn ( self , |this| if this. is_empty ( ) {
341- A ( ok ( Loop :: Break ( this. into_inner ( ) ) ) )
354+ let fut = loop_fn ( self , |this| if !this. has_rows ( ) {
355+ if this. more_results_exists ( ) {
356+ let ( inner, cached) = this. into_inner ( ) ;
357+ A ( A ( inner. read_result_set ( cached) . map ( |new_this| Loop :: Continue ( new_this) ) ) )
358+ } else {
359+ A ( B ( ok ( Loop :: Break ( this. into_inner ( ) ) ) ) )
360+ }
342361 } else {
343362 B ( this. get_row_raw ( ) . map ( |( this, _) | Loop :: Continue ( this) ) )
344363 } ) ;
0 commit comments