This commit is contained in:
2021-08-18 15:06:23 +08:00
parent 46001126e5
commit 4e5bfe4887
2 changed files with 10 additions and 8 deletions
+6 -2
View File
@@ -222,11 +222,12 @@ class PDO implements StopHeartbeatCheck
/**
* @param string $sql
* @param $isInsert
* @param array $params
* @return int
* @throws Exception
*/
public function execute(string $sql, array $params = []): int
public function execute(string $sql, $isInsert, array $params = []): int
{
$this->_last = time();
if (!(($prepare = $this->_pdo()->prepare($sql)) instanceof PDOStatement)) {
@@ -236,7 +237,10 @@ class PDO implements StopHeartbeatCheck
if ($prepare->execute($params) === false) {
throw new Exception($prepare->errorInfo()[2] ?? static::DB_ERROR_MESSAGE);
}
return (int)$this->_pdo()->lastInsertId();
if (!$isInsert) {
return (int)$this->_pdo()->lastInsertId();
}
return 1;
}