diff --git a/library/think/db/Connection.php b/library/think/db/Connection.php index 7dd54abd..fb38f6bc 100644 --- a/library/think/db/Connection.php +++ b/library/think/db/Connection.php @@ -386,6 +386,11 @@ abstract class Connection return $this->close()->query($sql, $bind, $master, $pdo); } throw new PDOException($e, $this->config, $this->getLastsql()); + } catch (\ErrorException $e) { + if ($this->config['break_reconnect'] && $this->isBreak($e)) { + return $this->close()->query($sql, $bind, $master, $pdo); + } + throw $e; } } @@ -444,6 +449,11 @@ abstract class Connection return $this->close()->execute($sql, $bind); } throw new PDOException($e, $this->config, $this->getLastsql()); + } catch (\ErrorException $e) { + if ($this->config['break_reconnect'] && $this->isBreak($e)) { + return $this->close()->execute($sql, $bind); + } + throw $e; } }