+/* more results? -1 = no, >0 = error, 0 = yes (keep looping)
+ This is needed because of the CLIENT_MULTI_RESULTS on mysql_real_connect(),
+ we don't expect any more results. */
+
+while((i = mysql_next_result(mysql_handle)) >= 0) {
+ if(i == 0) { /* Just ignore more results */
+ DEBUG(D_lookup) debug_printf("MYSQL: got unexpected more results\n");
+ continue;
+ }
+
+ *errmsg = string_sprintf("MYSQL: lookup result error when checking for more results: %s\n",
+ mysql_error(mysql_handle));
+ goto MYSQL_EXIT;
+}
+