From c7c3c49daf58616683039fe06a29ad513ab475fe Mon Sep 17 00:00:00 2001 From: Cameron Date: Wed, 9 May 2018 11:13:05 -0700 Subject: [PATCH] Support for 'IGNORE' duplicate key on INSERT. --- e107_handlers/mysql_class.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/e107_handlers/mysql_class.php b/e107_handlers/mysql_class.php index 13177476b..5ac5a74bf 100644 --- a/e107_handlers/mysql_class.php +++ b/e107_handlers/mysql_class.php @@ -867,6 +867,7 @@ class e_db_mysql $this->mySQLcurTable = $table; $REPLACE = false; // kill any PHP notices $DUPEKEY_UPDATE = false; + $IGNORE = ''; if(is_array($arg)) { @@ -885,7 +886,12 @@ class e_db_mysql { $DUPEKEY_UPDATE = true; unset($arg['_DUPLICATE_KEY_UPDATE']); + } + if(isset($arg['_IGNORE'])) + { + $IGNORE = ' IGNORE'; + unset($arg['_IGNORE']); } if(!isset($arg['_FIELD_TYPES']) && !isset($arg['data'])) @@ -942,7 +948,7 @@ class e_db_mysql 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) {