- int r = mysql_query(&connection, query.c_str());
- if (!r)
- {
- res = mysql_store_result(&connection);
- unsigned long rows = mysql_affected_rows(&connection);
- mysql_free_result(res);
- return rows;
- }
- return 0;
+ /* If the connection is down, we return a negative value - New to 1.1 */
+ if (!CheckConnection()) return -1;
+
+ int r = mysql_query(&connection, query.c_str());
+ if (!r)
+ {
+ res = mysql_store_result(&connection);
+ unsigned long rows = mysql_affected_rows(&connection);
+ mysql_free_result(res);
+ return rows;
+ }
+ return 0;