示例#1
0
 /**
  * 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;
 }
示例#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 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;
 }
示例#3
0
 protected virtual bool causedByLostConnection(QueryException e)
 {
     return(false);
 }
示例#4
0
 protected override bool causedByLostConnection(QueryException e)
 {
     return(this._pdo == null || ((SqlConnection)this._pdo).State == System.Data.ConnectionState.Closed);
 }