This commit is contained in:
2023-04-03 11:08:11 +08:00
parent 6d646ea2a3
commit 7eb80d607b
3 changed files with 19 additions and 20 deletions
+8 -9
View File
@@ -189,12 +189,12 @@ class Connection extends Component
public function getPdo(bool $restore = false): Mysql\PDO
{
if ($restore === true) {
return Context::setContext($this->cds, $this->getMasterClient());
return Context::set($this->cds, $this->getMasterClient());
}
if (!Context::hasContext($this->cds)) {
return Context::setContext($this->cds, $this->getMasterClient());
if (!Context::exists($this->cds)) {
return Context::set($this->cds, $this->getMasterClient());
} else {
return Context::getContext($this->cds);
return Context::get($this->cds);
}
}
@@ -254,11 +254,10 @@ class Connection extends Component
*/
public function release(Mysql\PDO $PDO)
{
// if ($PDO->inTransaction()) {
// return;
// }
$this->connection->addItem($this->cds, $PDO);
Context::remove($this->cds);
if ($PDO->inTransaction() === false) {
$this->connection->addItem($this->cds, $PDO);
Context::remove($this->cds);
}
}