modify plugin name

This commit is contained in:
2022-06-08 15:13:53 +08:00
parent a5dde8a140
commit eb36a30b26
+4 -8
View File
@@ -137,15 +137,13 @@ class Command extends Component
*/ */
private function _execute(): bool|int private function _execute(): bool|int
{ {
try {
$pdo = $this->db->masterInstance(); $pdo = $this->db->masterInstance();
try {
$result = $pdo->execute($this->sql, $this->params); $result = $pdo->execute($this->sql, $this->params);
$this->db->release($pdo, true);
} catch (\Throwable $exception) { } catch (\Throwable $exception) {
$result = $this->logger->addError($this->sql . '. error: ' . $exception->getMessage(), 'mysql'); $result = $this->logger->addError($this->sql . '. error: ' . $exception->getMessage(), 'mysql');
} finally { } finally {
$this->db->release($pdo, true);
return $result; return $result;
} }
} }
@@ -158,15 +156,13 @@ class Command extends Component
*/ */
private function search(string $type): array|int|bool|null private function search(string $type): array|int|bool|null
{ {
try {
$pdo = $this->db->slaveInstance(); $pdo = $this->db->slaveInstance();
try {
$data = $pdo->{$type}($this->sql, $this->params); $data = $pdo->{$type}($this->sql, $this->params);
$this->db->release($pdo, false);
} catch (\Throwable $throwable) { } catch (\Throwable $throwable) {
$data = $this->logger->addError($this->sql . '. error: ' . $throwable->getMessage(), 'mysql'); $data = $this->logger->addError($this->sql . '. error: ' . $throwable->getMessage(), 'mysql');
} finally { } finally {
$this->db->release($pdo, false);
return $data; return $data;
} }
} }