コード例 #1
0
ファイル: QueryException.php プロジェクト: marella/phd
 /**
  * Format the SQL error message.
  *
  * @param string     $sql
  * @param array      $bindings
  * @param \Exception $previous
  *
  * @return string
  */
 protected function formatMessage($sql, $bindings, $previous)
 {
     return $previous->getMessage() . ' (SQL: ' . Str::replaceArray('\\?', $bindings, $sql) . ')';
 }
コード例 #2
0
ファイル: DatabaseManager.php プロジェクト: marella/phd
 /**
  * Parse the connection into an array of the name and read / write type.
  *
  * @param string $name
  *
  * @return array
  */
 protected function parseConnectionName($name)
 {
     $name = $name ?: $this->getDefaultConnection();
     return Str::endsWith($name, ['::read', '::write']) ? explode('::', $name, 2) : [$name, null];
 }
コード例 #3
0
 /**
  * Determine if the given exception was caused by a lost connection.
  *
  * @param \Exception $e
  *
  * @return bool
  */
 protected function causedByLostConnection(Exception $e)
 {
     $message = $e->getMessage();
     return Str::contains($message, ['server has gone away', 'no connection to the server', 'Lost connection', 'is dead or not enabled', 'Error while sending', 'decryption failed or bad record mac', 'SSL connection has been closed unexpectedly', 'Deadlock found when trying to get lock']);
 }