In UseQueryResult::fetch_row and StoreQueryResult::StoreQueryResult, when
DBDriver::fetch_row returns NULL it is assumed to mean there are no more
rows. DBDriver::fetch_row can also return NULL when there are error
conditions (such as the connection being dropped while iterating), and yet
no exception is thrown when they are enabled. This can result in incomplete
result sets if the error state is not checked immediately after the query
completed, which is probably unexpected behaviour?

We've fixed this with the following patch:

--- 2019-07-21 04:32:30.000000000 -0700
+++ 2019-10-25 15:38:30.659424092 -0700
@@ -110,8 +110,10 @@
 				++it;
 			}
 		}
-
 		dbd->free_result(res);
+		if (throw_exceptions() && dbd->errnum() != 0) {
+			throw UseQueryError(dbd->error());
+		}
 	}
 }

@@ -190,6 +192,9 @@
 		}
 	}
 	else {
+		if (throw_exceptions() && driver_->errnum() != 0) {
+			throw UseQueryError(driver_->error());
+		}
 		Prior to v3, this was considered an error, but it just means
 		we've fallen off the end of a "use" query's result set.  You
 		can't predict when this will happen, but it isn't an error.