コード例 #1
0
 /**
  * Determine if the given exception was caused by a lost connection.
  *
  * @param  \Illuminate\Database\QueryException
  * @return bool
  */
 protected function causedByLostConnection(QueryException $e)
 {
     return str_contains($e->getPrevious()->getMessage(), 'server has gone away');
 }
コード例 #2
0
 /**
  * Handle a query exception that occurred during query execution.
  *
  * @param  \Illuminate\Database\QueryException  $e
  * @param  string    $query
  * @param  array     $bindings
  * @param  \Closure  $callback
  * @return mixed
  *
  * @throws \Illuminate\Database\QueryException
  */
 protected function tryAgainIfCausedByLostConnection(QueryException $e, $query, $bindings, Closure $callback)
 {
     if ($this->causedByLostConnection($e->getPrevious())) {
         $this->reconnect();
         return $this->runQueryCallback($query, $bindings, $callback);
     }
     throw $e;
 }
コード例 #3
0
ファイル: Connection.php プロジェクト: hilmysyarif/sisfito
 /**
  * Determine if the given exception was caused by a lost connection.
  *
  * @param  \Illuminate\Database\QueryException  $e
  * @return bool
  */
 protected function causedByLostConnection(QueryException $e)
 {
     $message = $e->getPrevious()->getMessage();
     return Str::contains($message, ['server has gone away', 'no connection to the server', 'Lost connection']);
 }