mirror of
https://github.com/e107inc/e107.git
synced 2025-08-05 06:07:32 +02:00
Database: Prevent gaps in PRIMARY index when using DUPLICATE_KEY_UPDATE with insert() method.
This commit is contained in:
@@ -856,6 +856,8 @@ class e_db_pdo implements e_db
|
|||||||
elseif($this->mySQLresult === 2 || $this->mySQLresult === true) // updated
|
elseif($this->mySQLresult === 2 || $this->mySQLresult === true) // updated
|
||||||
{
|
{
|
||||||
$result = true;
|
$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)
|
elseif($this->mySQLresult === 0) // updated (no change)
|
||||||
{
|
{
|
||||||
|
@@ -1018,6 +1018,9 @@ class e_db_mysql
|
|||||||
elseif($this->mySQLresult === 2 || $this->mySQLresult === true) // updated
|
elseif($this->mySQLresult === 2 || $this->mySQLresult === true) // updated
|
||||||
{
|
{
|
||||||
$result = true;
|
$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)
|
elseif($this->mySQLresult === 0) // updated (no change)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user