/** * Retorna a DATA pela Query. * * @return array */ public function data() { if (is_null($this->data) != true) { return $this->data; } return $this->data = $this->query->get(); }
/** * 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; }
public static function reportError(QueryException $e, $file, $line) { echo "error code " . $e->getCode() . " found at line: " . $line . "<br>"; echo "in file: " . $file . "<br>"; echo "with message: " . "<br>"; echo $e->getMessage(); //var_dump($e); }
/** * 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'); }
/** * 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']); }
/** * Método para guardar una excepción de mysql en el log y lanzarla. * * @param string $file Nombre del archivo donde se generó la excepción. * @param \Illuminate\Database\QueryException $exception Contiene la Excepción de Mysql. */ public static function addErrorMysql($file, $exception) { self::addError("Mysql", array("file" => $file, "message" => $exception->getMessage(), "code" => $exception->getCode())); }
/** * Get used driver error * * @return string */ public function getDriverErrorMessage() { return $this->driverException->getMessage(); }