改进断线的异常判断

This commit is contained in:
thinkphp
2017-05-18 10:34:14 +08:00
parent faffdee907
commit 1bdd33277c

View File

@@ -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;
}
}