This commit is contained in:
2023-04-02 23:23:55 +08:00
parent f1faeb038f
commit cd9327f5c2
2 changed files with 284 additions and 278 deletions
+3 -6
View File
@@ -145,7 +145,7 @@ class Connection extends Component
* @return PDO
* @throws Exception
*/
public function getMasterClient(): PDO
public function getMasterClient(): Mysql\PDO
{
return $this->connection->get([
'cds' => $this->cds,
@@ -163,7 +163,7 @@ class Connection extends Component
* @return PDO
* @throws Exception
*/
public function getSlaveClient(): PDO
public function getSlaveClient(): Mysql\PDO
{
return $this->getMasterClient();
}
@@ -185,14 +185,11 @@ class Connection extends Component
* @return PDO
* @throws Exception
*/
public function getPdo(bool $restore = false): PDO
public function getPdo(bool $restore = false): Mysql\PDO
{
if ($restore === true) {
return Context::setContext($this->cds, $this->getMasterClient());
}
if (!Db::inTransactionsActive()) {
return $this->getMasterClient();
}
if (!Context::hasContext($this->cds)) {
return Context::setContext($this->cds, $this->getMasterClient());
} else {