From 1bdd33277c4628c18fa7d2c29a492850d8188877 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Thu, 18 May 2017 10:34:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=E6=96=AD=E7=BA=BF=E7=9A=84?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/db/Connection.php | 10 ++++++++++ 1 file changed, 10 insertions(+) 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; } }