/** * Create a new query exception instance. * * @param string $sql * @param array $bindings * @param \Exception $previous * @return void */ public QueryException(string sql, object[] bindings, QueryException previous) : base("", previous) { this._sql = sql; this._bindings = bindings; this._previous = previous; }
/** * 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 virtual T tryAgainIfCausedByLostConnection <T>(QueryException e, string query, object[] bindings, Func <Connection, string, object[], T> callback) { if (this.causedByLostConnection(e.getPrevious())) { this.reconnect(); return(this.runQueryCallback(query, bindings, callback)); } throw e; }
protected virtual bool causedByLostConnection(QueryException e) { return(false); }
protected override bool causedByLostConnection(QueryException e) { return(this._pdo == null || ((SqlConnection)this._pdo).State == System.Data.ConnectionState.Closed); }