eee
This commit is contained in:
+10
-10
@@ -145,11 +145,14 @@ class Command extends Component
|
|||||||
private function _execute(): bool|int
|
private function _execute(): bool|int
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
[$client, $prepare, $result] = $this->_prepare();
|
[$client, $prepare] = $this->_prepare();
|
||||||
if ($prepare->rowCount() < 1) {
|
$result = $client->lastInsertId();
|
||||||
|
$prepare->closeCursor();
|
||||||
|
$rowCount = $prepare->rowCount();
|
||||||
|
$this->connection->release($client);
|
||||||
|
if ($rowCount < 1) {
|
||||||
return trigger_print_error("更新失败", 'mysql');
|
return trigger_print_error("更新失败", 'mysql');
|
||||||
}
|
}
|
||||||
$this->connection->release($client);
|
|
||||||
return $result == 0 ? true : (int)$result;
|
return $result == 0 ? true : (int)$result;
|
||||||
} catch (Throwable $throwable) {
|
} catch (Throwable $throwable) {
|
||||||
if ($this->isRefresh($throwable)) {
|
if ($this->isRefresh($throwable)) {
|
||||||
@@ -171,10 +174,10 @@ class Command extends Component
|
|||||||
private function _delete(): bool|int
|
private function _delete(): bool|int
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
[$client, $prepare, $result] = $this->_prepare();
|
[$client, $prepare] = $this->_prepare();
|
||||||
|
$prepare->closeCursor();
|
||||||
$this->connection->release($client);
|
$this->connection->release($client);
|
||||||
return $result == 0 ? true : (int)$result;
|
return true;
|
||||||
} catch (Throwable $throwable) {
|
} catch (Throwable $throwable) {
|
||||||
if ($this->isRefresh($throwable)) {
|
if ($this->isRefresh($throwable)) {
|
||||||
return $this->_execute();
|
return $this->_execute();
|
||||||
@@ -200,10 +203,7 @@ class Command extends Component
|
|||||||
if ($prepare->execute($this->params) === false) {
|
if ($prepare->execute($this->params) === false) {
|
||||||
throw new Exception('(' . $prepare->errorInfo()[0] . ')' . $prepare->errorInfo()[2]);
|
throw new Exception('(' . $prepare->errorInfo()[0] . ')' . $prepare->errorInfo()[2]);
|
||||||
}
|
}
|
||||||
$result = $client->lastInsertId();
|
return [$client, $prepare];
|
||||||
$prepare->closeCursor();
|
|
||||||
|
|
||||||
return [$client, $prepare, $result];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user