* [perf] fetch last insert id only for insert execution.

This commit is contained in:
liugang
2024-11-20 15:42:49 +08:00
committed by 朱金勇
parent a69c3daf18
commit 015e5a80d4
+2 -1
View File
@@ -1057,8 +1057,9 @@ class baseDAO
$this->app->redis->prepare($table, $method, $sql);
$result = $this->dbh->exec($sql);
/* See: https://www.php.net/manual/en/pdo.lastinsertid.php .*/
$this->_lastInsertID = $this->dbh->lastInsertId();
if($method == 'insert') $this->_lastInsertID = $this->dbh->lastInsertID();
$result ? $this->app->redis->sync() : $this->app->redis->reset();