mirror of
https://github.com/e107inc/e107.git
synced 2025-04-26 15:32:53 +02:00
Database: Prevent gaps in PRIMARY index when using DUPLICATE_KEY_UPDATE with insert() method.
This commit is contained in:
parent
e885088830
commit
614711ff21
@ -856,6 +856,8 @@ class e_db_pdo implements e_db
|
||||
elseif($this->mySQLresult === 2 || $this->mySQLresult === true) // updated
|
||||
{
|
||||
$result = true;
|
||||
// reset auto-increment to prevent gaps.
|
||||
$this->db_Query("ALTER TABLE ".$this->mySQLPrefix.$table." AUTO_INCREMENT=1", NULL, 'db_Insert', $debug, $log_type, $log_remark);
|
||||
}
|
||||
elseif($this->mySQLresult === 0) // updated (no change)
|
||||
{
|
||||
|
@ -1018,6 +1018,9 @@ class e_db_mysql
|
||||
elseif($this->mySQLresult === 2 || $this->mySQLresult === true) // updated
|
||||
{
|
||||
$result = true;
|
||||
// reset auto-increment to prevent gaps.
|
||||
$this->db_Query("ALTER TABLE ".$this->mySQLPrefix.$table." AUTO_INCREMENT=1", NULL, 'db_Insert', $debug, $log_type, $log_remark);
|
||||
|
||||
}
|
||||
elseif($this->mySQLresult === 0) // updated (no change)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user