Browse Source

db_mysql: proper handling of mysql_next_result(...) return code

- it indicates the presence of another result if return is 0
- reported by  Maxim (simax), FS#434
Daniel-Constantin Mierla 11 years ago
parent
commit
37f0964278
1 changed files with 2 additions and 2 deletions
  1. 2 2
      modules/db_mysql/km_dbase.c

+ 2 - 2
modules/db_mysql/km_dbase.c

@@ -258,7 +258,7 @@ static int db_mysql_store_result(const db1_con_t* _h, db1_res_t** _r)
 		db_mysql_free_result(_h, *_r);
 		db_mysql_free_result(_h, *_r);
 		*_r = 0;
 		*_r = 0;
 #if (MYSQL_VERSION_ID >= 40100)
 #if (MYSQL_VERSION_ID >= 40100)
-		while( mysql_more_results(CON_CONNECTION(_h)) && mysql_next_result(CON_CONNECTION(_h)) > 0 ) {
+		while( mysql_more_results(CON_CONNECTION(_h)) && mysql_next_result(CON_CONNECTION(_h)) == 0 ) {
 			MYSQL_RES *res = mysql_store_result( CON_CONNECTION(_h) );
 			MYSQL_RES *res = mysql_store_result( CON_CONNECTION(_h) );
 			mysql_free_result(res);
 			mysql_free_result(res);
 		}
 		}
@@ -268,7 +268,7 @@ static int db_mysql_store_result(const db1_con_t* _h, db1_res_t** _r)
 
 
 done:
 done:
 #if (MYSQL_VERSION_ID >= 40100)
 #if (MYSQL_VERSION_ID >= 40100)
-	while( mysql_more_results(CON_CONNECTION(_h)) && mysql_next_result(CON_CONNECTION(_h)) > 0 ) {
+	while( mysql_more_results(CON_CONNECTION(_h)) && mysql_next_result(CON_CONNECTION(_h)) == 0 ) {
 		MYSQL_RES *res = mysql_store_result( CON_CONNECTION(_h) );
 		MYSQL_RES *res = mysql_store_result( CON_CONNECTION(_h) );
 		mysql_free_result(res);
 		mysql_free_result(res);
 	}
 	}