title: Corrupted mysql table, cause crash in mysql.h (c++)
body: <p>i've created a very simple mysql class in c+, but when happen that mysql crash , indexes of tables become corrupted, and all my c++ programs crash too because seems that are unable to recognize corrupted table and allowing me to handle the issue ..</p>
  
  <pre><code>Q_RES = mysql_real_query(MY_mysql, tmp_query.c_str(), (unsigned int) tmp_query.size());
  
  if (Q_RES != 0) {
      if (Q_RES == CR_COMMANDS_OUT_OF_SYNC) cout &lt;&lt; "errorquery : CR_COMMANDS_OUT_OF_SYNC " &lt;&lt; endl;
      if (Q_RES == CR_SERVER_GONE_ERROR) cout &lt;&lt; "errorquery : CR_SERVER_GONE_ERROR " &lt;&lt; endl;
      if (Q_RES == CR_SERVER_LOST) cout &lt;&lt; "errorquery : CR_SERVER_LOST " &lt;&lt; endl;
  
      LAST_ERROR = mysql_error(MY_mysql);
  
      if (n_retrycount &lt; n_retry_limit) { // RETRY!
          n_retrycount++;
          sleep(1);
          cout &lt;&lt; "SLEEP - query retry! " &lt;&lt; endl;
          ping();
          return select_sql(tmp_query);
      }
      return false;
  }
  MY_result = mysql_store_result(MY_mysql);
  B_stored_results = true;
  
  cout &lt;&lt; "b8" &lt;&lt; endl;
  LAST_affected_rows = (mysql_num_rows(MY_result) + 1); // coult return -1
  cout &lt;&lt; "b8-1" &lt;&lt; endl;
  </code></pre>
  
  <p>the program terminate with a "segmentation fault" after doing the "b8" and before the "b8-1"
  , Q_RES have no issue even if the table is corrupted.. i would like to know if there is a way to recognize that the table have problems and so then i can run a mysql repair or mysql check ..</p>
  
  <p>thanks,
  Francesco</p>