MySQL reconnect?

Back to PHP-IRC Support

Page: 2  
From User Message Body
Mad_Clog
Post #951
user avatar
Member
Date: 5:41 pm, Mar 10 2009
Posts: 176


Yeah I guess so but still...
I'll have a go at my own implementation when i get some spare time somewhere this week.

btw Manick don't take this as an insult or anything, just trying to think along ;)

g2x3k
Post #989
Member
Date: 3:32 pm, Sep 4 2009
Posts: 6


i also had this problem since my mysql restarts once in a while when bots dont have too so be annoying have to restart all the bots
solution was minor core update in file: databases/mysql.php using manick´s reconnect function and added a bit to query function:
Code

<?
public function query($query, $values = array()) {
  //.....
  // line: 118-124
  $data = mysql_query($query, $this->dbIndex); 
  // insert:
  // reconnect if no connection
  if (mysql_errno() == 2006) {
    $this->reconnect();
    $data = mysql_query($query, $this->dbIndex);
  }
  // end..
  if (! $data)
    return false;
  return $data;
}
?>


theres prob better way then errno == 2006 to check for lost connection, but works here :)

Last edited by g2x3k at 7:29 pm, Sep 4 2009

   

Previous Page Pages (2) [ 1 2 ]  

Back to PHP-IRC Support