This commit is contained in:
2023-08-16 00:55:05 +08:00
parent e1c893c4e1
commit 5b3b3b7a6b
2 changed files with 12 additions and 8 deletions
+2 -4
View File
@@ -177,7 +177,7 @@ class Command extends Component
private function _execute(): bool|int
{
try {
$client = $this->connection->getTransactionClient();
$client = $this->connection->getConnection();
if (($prepare = $client->prepare($this->sql)) === false) {
throw new Exception($client->errorInfo()[1]);
}
@@ -194,9 +194,7 @@ class Command extends Component
}
return $this->error($throwable);
} finally {
if (isset($client) && !$client->inTransaction()) {
$this->connection->release($client);
}
$this->connection->release($client ?? null);
}
}