From ac501a1937faa743d6705f8f28a8f457147cbc0c Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Wed, 22 Sep 2004 10:24:39 +0000 Subject: [PATCH] use replace for mysql only if the primary keys are included --- phpgwapi/inc/class.db.inc.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/phpgwapi/inc/class.db.inc.php b/phpgwapi/inc/class.db.inc.php index b4530dd1e6..0868adbd2c 100644 --- a/phpgwapi/inc/class.db.inc.php +++ b/phpgwapi/inc/class.db.inc.php @@ -1148,8 +1148,13 @@ $sql_append = ' UPDATE DUPLICATES'; break; case 'mysql': - $cmd = 'REPLACE'; - break; + // use replace if primary keys are included + if (count(array_intersect(array_keys($where),$table_def['pk'])) == count($table_def['pk'])) + { + $cmd = 'REPLACE'; + break; + } + // fall through !!! default: $this->select($table,'count(*)',$where,$line,$file); if ($this->next_record() && $this->f(0))