mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-01 12:42:48 +08:00
改进主从读取
This commit is contained in:
@@ -451,24 +451,24 @@ abstract class Connection
|
||||
$this->debug(false);
|
||||
|
||||
if ($query && !empty($this->config['deploy']) && !empty($this->config['read_master'])) {
|
||||
$query->setModelReadMaster(true);
|
||||
$query->readMaster(true);
|
||||
}
|
||||
|
||||
$this->numRows = $this->PDOStatement->rowCount();
|
||||
return $this->numRows;
|
||||
} catch (\PDOException $e) {
|
||||
if ($this->isBreak($e)) {
|
||||
return $this->close()->execute($sql, $bind);
|
||||
return $this->close()->execute($sql, $bind, $query);
|
||||
}
|
||||
throw new PDOException($e, $this->config, $this->getLastsql());
|
||||
} catch (\Throwable $e) {
|
||||
if ($this->isBreak($e)) {
|
||||
return $this->close()->execute($sql, $bind);
|
||||
return $this->close()->execute($sql, $bind, $query);
|
||||
}
|
||||
throw $e;
|
||||
} catch (\Exception $e) {
|
||||
if ($this->isBreak($e)) {
|
||||
return $this->close()->execute($sql, $bind);
|
||||
return $this->close()->execute($sql, $bind, $query);
|
||||
}
|
||||
throw $e;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user