mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 15:12:48 +08:00
改进
This commit is contained in:
@@ -451,7 +451,7 @@ abstract class Connection
|
|||||||
$this->debug(false, '', true);
|
$this->debug(false, '', true);
|
||||||
|
|
||||||
if ($query && !empty($this->config['deploy']) && !empty($this->config['read_master'])) {
|
if ($query && !empty($this->config['deploy']) && !empty($this->config['read_master'])) {
|
||||||
$query->readMaster(true);
|
$query->readMaster();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->numRows = $this->PDOStatement->rowCount();
|
$this->numRows = $this->PDOStatement->rowCount();
|
||||||
|
|||||||
@@ -145,17 +145,19 @@ class Query
|
|||||||
/**
|
/**
|
||||||
* 设置后续从主库读取数据
|
* 设置后续从主库读取数据
|
||||||
* @access public
|
* @access public
|
||||||
* @param bool $master
|
* @param bool $allTable
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function readMaster($master = true)
|
public function readMaster($allTable = false)
|
||||||
{
|
{
|
||||||
if ($master) {
|
if ($allTable) {
|
||||||
|
$table = '*';
|
||||||
|
} else {
|
||||||
$table = isset($this->options['table']) ? $this->options['table'] : $this->getTable();
|
$table = isset($this->options['table']) ? $this->options['table'] : $this->getTable();
|
||||||
|
|
||||||
static::$readMaster[$table] = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static::$readMaster[$table] = true;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2942,7 +2944,7 @@ class Query
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset(static::$readMaster[$options['table']])) {
|
if (isset(static::$readMaster['*']) || isset(static::$readMaster[$options['table']])) {
|
||||||
$options['master'] = true;
|
$options['master'] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user