/** * @param null $params * @return null * @throws */ public function execute($params = null) { $logger = $this->conn->getConfiguration()->getSQLLogger(); if ($logger) { $logger->startQuery($this->sql, $this->params, $this->types); } $stmt = null; $attempt = 0; $retry = true; while ($retry) { $retry = false; try { $stmt = $this->stmt->execute($params); } catch (\Exception $e) { if ($this->conn->validateReconnectAttempt($e, $attempt)) { $this->conn->close(); $this->createStatement(); $attempt++; $retry = true; } else { throw $e; } } } if ($logger) { $logger->stopQuery(); } $this->params = array(); $this->types = array(); return $stmt; }
/** * @param null $params * @return null * @throws */ public function execute($params = null) { $stmt = null; $attempt = 0; $retry = true; while ($retry) { $retry = false; try { $stmt = $this->stmt->execute($params); } catch (\Exception $e) { if ($this->conn->canTryAgain($attempt) && $this->conn->getDriver()->isGoneAwayException($e)) { $this->conn->close(); $this->createStatement(); $attempt++; $retry = true; } else { throw $e; } } } return $stmt; }