1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-02 20:57:26 +02:00

Support for 'IGNORE' duplicate key on INSERT.

This commit is contained in:
Cameron
2018-05-09 11:13:05 -07:00
parent ed36008286
commit c7c3c49daf

View File

@@ -867,6 +867,7 @@ class e_db_mysql
$this->mySQLcurTable = $table; $this->mySQLcurTable = $table;
$REPLACE = false; // kill any PHP notices $REPLACE = false; // kill any PHP notices
$DUPEKEY_UPDATE = false; $DUPEKEY_UPDATE = false;
$IGNORE = '';
if(is_array($arg)) if(is_array($arg))
{ {
@@ -885,7 +886,12 @@ class e_db_mysql
{ {
$DUPEKEY_UPDATE = true; $DUPEKEY_UPDATE = true;
unset($arg['_DUPLICATE_KEY_UPDATE']); unset($arg['_DUPLICATE_KEY_UPDATE']);
}
if(isset($arg['_IGNORE']))
{
$IGNORE = ' IGNORE';
unset($arg['_IGNORE']);
} }
if(!isset($arg['_FIELD_TYPES']) && !isset($arg['data'])) if(!isset($arg['_FIELD_TYPES']) && !isset($arg['data']))
@@ -942,7 +948,7 @@ class e_db_mysql
if($REPLACE === false) if($REPLACE === false)
{ {
$query = "INSERT INTO `".$this->mySQLPrefix."{$table}` ({$keyList}) VALUES ({$valList})"; $query = "INSERT".$IGNORE." INTO `".$this->mySQLPrefix."{$table}` ({$keyList}) VALUES ({$valList})";
if($DUPEKEY_UPDATE === true) if($DUPEKEY_UPDATE === true)
{ {