eee
This commit is contained in:
+1
-1
@@ -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
@@ -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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user