This commit is contained in:
2021-11-10 02:41:39 +08:00
parent ee44cfbca9
commit 6b78d130fb
4 changed files with 11 additions and 25 deletions
+2 -6
View File
@@ -242,12 +242,11 @@ class PDO implements StopHeartbeatCheck
/**
* @param string $sql
* @param $isInsert
* @param array $params
* @return int
* @throws Exception
*/
public function execute(string $sql, $isInsert, array $params = []): int
public function execute(string $sql, array $params = []): int
{
$this->_last = time();
$pdo = $this->_pdo();
@@ -257,10 +256,7 @@ class PDO implements StopHeartbeatCheck
if ($prepare->execute($params) === false) {
throw new Exception($prepare->errorInfo()[2] ?? static::DB_ERROR_MESSAGE);
}
$result = 1;
if ($isInsert) {
$result = (int)$pdo->lastInsertId();
}
$result = (int)$pdo->lastInsertId();
$prepare->closeCursor();
return $result;
}