1
0
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:
Cameron 2019-02-25 18:51:49 -08:00
parent e885088830
commit 614711ff21
2 changed files with 5 additions and 0 deletions

View File

@ -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)
{

View File

@ -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)
{