改名
This commit is contained in:
+18
-17
@@ -73,13 +73,13 @@ class PDO implements StopHeartbeatCheck
|
|||||||
*/
|
*/
|
||||||
public function heartbeat_check(): void
|
public function heartbeat_check(): void
|
||||||
{
|
{
|
||||||
if (env('state','start') == 'exit') {
|
if (env('state', 'start') == 'exit') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ($this->_timer === -1 && Context::inCoroutine()) {
|
if ($this->_timer === -1 && Context::inCoroutine()) {
|
||||||
$this->_timer = Timer::tick(1000, function () {
|
$this->_timer = Timer::tick(1000, function () {
|
||||||
try {
|
try {
|
||||||
if (env('state','start') == 'exit') {
|
if (env('state', 'start') == 'exit') {
|
||||||
Kiri::getDi()->get(Logger::class)->critical('timer end');
|
Kiri::getDi()->get(Logger::class)->critical('timer end');
|
||||||
$this->stopHeartbeatCheck();
|
$this->stopHeartbeatCheck();
|
||||||
}
|
}
|
||||||
@@ -153,9 +153,9 @@ class PDO implements StopHeartbeatCheck
|
|||||||
{
|
{
|
||||||
$pdo = $this->queryPrev($sql, $params);
|
$pdo = $this->queryPrev($sql, $params);
|
||||||
|
|
||||||
defer(fn() => $pdo->closeCursor());
|
$result = $pdo->fetchAll(\PDO::FETCH_ASSOC);
|
||||||
|
$pdo->closeCursor();
|
||||||
return $pdo->fetchAll(\PDO::FETCH_ASSOC);
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -169,9 +169,9 @@ class PDO implements StopHeartbeatCheck
|
|||||||
{
|
{
|
||||||
$pdo = $this->queryPrev($sql, $params);
|
$pdo = $this->queryPrev($sql, $params);
|
||||||
|
|
||||||
defer(fn() => $pdo->closeCursor());
|
$result = $pdo->fetch(\PDO::FETCH_ASSOC);
|
||||||
|
$pdo->closeCursor();
|
||||||
return $pdo->fetch(\PDO::FETCH_ASSOC);
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -185,9 +185,9 @@ class PDO implements StopHeartbeatCheck
|
|||||||
{
|
{
|
||||||
$pdo = $this->queryPrev($sql, $params);
|
$pdo = $this->queryPrev($sql, $params);
|
||||||
|
|
||||||
defer(fn() => $pdo->closeCursor());
|
$result = $pdo->fetchColumn(\PDO::FETCH_ASSOC);
|
||||||
|
$pdo->closeCursor();
|
||||||
return $pdo->fetchColumn(\PDO::FETCH_ASSOC);
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -201,9 +201,9 @@ class PDO implements StopHeartbeatCheck
|
|||||||
{
|
{
|
||||||
$pdo = $this->queryPrev($sql, $params);
|
$pdo = $this->queryPrev($sql, $params);
|
||||||
|
|
||||||
defer(fn() => $pdo->closeCursor());
|
$result = $pdo->rowCount();
|
||||||
|
$pdo->closeCursor();
|
||||||
return $pdo->rowCount();
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -251,14 +251,15 @@ class PDO implements StopHeartbeatCheck
|
|||||||
if (!(($prepare = $this->_pdo()->prepare($sql)) instanceof PDOStatement)) {
|
if (!(($prepare = $this->_pdo()->prepare($sql)) instanceof PDOStatement)) {
|
||||||
throw new Exception($prepare->errorInfo()[2] ?? static::DB_ERROR_MESSAGE);
|
throw new Exception($prepare->errorInfo()[2] ?? static::DB_ERROR_MESSAGE);
|
||||||
}
|
}
|
||||||
defer(fn() => $prepare->closeCursor());
|
|
||||||
if ($prepare->execute($params) === false) {
|
if ($prepare->execute($params) === false) {
|
||||||
throw new Exception($prepare->errorInfo()[2] ?? static::DB_ERROR_MESSAGE);
|
throw new Exception($prepare->errorInfo()[2] ?? static::DB_ERROR_MESSAGE);
|
||||||
}
|
}
|
||||||
|
$result = 1;
|
||||||
if ($isInsert) {
|
if ($isInsert) {
|
||||||
return (int)$this->_pdo()->lastInsertId();
|
$result = (int)$this->_pdo()->lastInsertId();
|
||||||
}
|
}
|
||||||
return 1;
|
$prepare->closeCursor();
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user