Example #1
0
 /**
  * Should we reconnect to the database after this sort of error?
  *
  * @param PdoException $e
  *
  * @return bool
  */
 private function _shouldReconnectAfterException(PdoException $e)
 {
     // 2006  = MySQL server has gone away
     // 1047  = ER_UNKNOWN_COM_ERROR - happens when a PXC node is resyncing:
     //          "WSREP has not yet prepared node for application use"
     // HY000 = General SQL error
     $codes = ['2006', '1047', 'HY000'];
     $p = $e->getPrevious();
     return in_array((string) $e->getCode(), $codes, true) || $p && in_array((string) $p->getCode(), $codes, true);
 }