1
This commit is contained in:
@@ -169,6 +169,7 @@ class Command extends Component
|
||||
$pdo = $this->db->getConnect($this->sql);
|
||||
$result = $pdo->execute($this->sql, $isInsert, $this->params);
|
||||
if ($hasAutoIncrement && $result == 0) {
|
||||
var_dump($hasAutoIncrement, $result);
|
||||
return false;
|
||||
}
|
||||
return $result;
|
||||
|
||||
+3
-2
@@ -250,7 +250,8 @@ class PDO implements StopHeartbeatCheck
|
||||
public function execute(string $sql, $isInsert, array $params = []): int
|
||||
{
|
||||
$this->_last = time();
|
||||
if (!(($prepare = $this->_pdo()->prepare($sql)) instanceof PDOStatement)) {
|
||||
$pdo = $this->_pdo();
|
||||
if (!(($prepare = $pdo->prepare($sql)) instanceof PDOStatement)) {
|
||||
throw new Exception($prepare->errorInfo()[2] ?? static::DB_ERROR_MESSAGE);
|
||||
}
|
||||
if ($prepare->execute($params) === false) {
|
||||
@@ -258,7 +259,7 @@ class PDO implements StopHeartbeatCheck
|
||||
}
|
||||
$result = 1;
|
||||
if ($isInsert) {
|
||||
$result = (int)$this->_pdo()->lastInsertId();
|
||||
$result = (int)$pdo->lastInsertId();
|
||||
}
|
||||
$prepare->closeCursor();
|
||||
return $result;
|
||||
|
||||
Reference in New Issue
Block a user