title: How to set a timeout for MySQL query using C API
body: <p>I know there are lots of similar questions here, also there are lots of results, when I google it, but none of them answers my question. I read <a href="https://stackoverflow.com/questions/2137084/setup-mysql-query-timeout">this</a>, <a href="https://stackoverflow.com/questions/3957579/timeout-a-query">this</a>, <a href="https://stackoverflow.com/questions/2385913/how-to-set-timeout-in-mysql-c-connector">this</a> and <a href="https://stackoverflow.com/questions/81644/how-to-timeout-a-mysql-query-in-c">this</a> but none of them works for me. I don't talk about any locks, I don't wanna do this using MySQL c++ connector, just the C API. </p>
  
  <p>Also, what is very important here: I do this on LINUX. Why I mention this? Because in the documentation for mysql_options:</p>
  
  <pre>MYSQL_OPT_READ_TIMEOUT - ...This option works only for 
  TCP/IP connections and, prior to MySQL 5.0.25, only for Windows.
  
  MYSQL_OPT_WRITE_TIMEOUT- ... This option works only for 
  TCP/IP connections and, prior to MySQL 5.0.25, only for Windows</pre>
  
  <p>So, is there any way to set a query timeout for versions, prior 5.0.25?</p>
  
  <p>My MySQL version:</p>
  
  <pre>[root@xxx kiril]# mysql --version
  mysql  Ver 14.12 Distrib 5.0.22, for redhat-linux-gnu (i686) using readline 5.0</pre>
  
  <p><strong>EDIT:</strong> At least, is there any way to cancel a query? I can start a timer as different thread, but when it expires.. can I cancel the query somehow?</p>