This commit is contained in:
2026-01-11 19:55:00 +08:00
parent 3cb3dcf384
commit db18a2d73a
2 changed files with 2 additions and 31 deletions
+1 -1
View File
@@ -288,6 +288,6 @@ class ActiveQuery extends QueryTrait implements ISqlBuilder
*/ */
public function delete(): bool public function delete(): bool
{ {
return $this->buildCommand($this->builder->delete())->exec(); return (bool)$this->buildCommand($this->builder->delete())->exec();
} }
} }
+1 -30
View File
@@ -229,36 +229,7 @@ class Command extends Component
*/ */
public function delete(): bool public function delete(): bool
{ {
$client = $this->connection->getConnection(); return $this->_prepare();
try {
$startTime = microtime(true);
if (($prepare = $client->prepare($this->sql)) === false) {
throw new Exception('(' . $prepare->errorInfo()[0] . ')' . $prepare->errorInfo()[2]);
}
$execute = $prepare->execute($this->params);
var_dump($execute);
if ($execute === false) {
throw new Exception('(' . $prepare->errorInfo()[0] . ')' . $prepare->errorInfo()[2]);
}
$prepare->closeCursor();
$this->connection->println($startTime, microtime(true), $this->sql, $this->params);
return true;
} catch (Throwable $throwable) {
$this->getLogger()->json_log($throwable);
if ($this->isRefresh($throwable)) {
return $this->_prepare();
}
$errorMsg = $throwable->getMessage() . PHP_EOL . ' Sql: ' . $this->sql . '.' . json_encode($this->params, JSON_UNESCAPED_UNICODE);
return $this->getLogger()->logCategory($errorMsg . PHP_EOL, 'mysql');
} finally {
$this->connection->release($client);
}
} }