=== modified file 'includes/database/mysql/query.inc' --- includes/database/mysql/query.inc Thu Aug 21 21:36:36 2008 +++ includes/database/mysql/query_odku_values.inc Mon Sep 01 01:59:30 2008 @@ -76,18 +76,7 @@ class MergeQuery_mysql extends MergeQuery { public function execute() { - // Set defaults. - if ($this->updateFields) { - $update_fields = $this->updateFields; - } - else { - $update_fields = $this->insertFields; - // If there are no exclude fields, this is a no-op. - foreach ($this->excludeFields as $exclude_field) { - unset($update_fields[$exclude_field]); - } - } - + $insert_fields = $this->insertFields + $this->keyFields; $max_placeholder = 0; @@ -104,14 +93,6 @@ if (!empty($data['arguments'])) { $values += $data['arguments']; } - unset($update_fields[$field]); - } - - // Because we filter $fields the same way here and in __toString(), the - // placeholders will all match up properly. - $max_placeholder = 0; - foreach ($update_fields as $field => $value) { - $values[':db_update_placeholder_' . ($max_placeholder++)] = $value; } $last_insert_id = $this->connection->query((string)$this, $values, $this->queryOptions); @@ -157,8 +138,10 @@ unset($update_fields[$field]); } + // Update fields based on insert supplied values make statement shorter, + // specially when big string literals are involved. foreach ($update_fields as $field => $value) { - $update[] = ($field . '=:db_update_placeholder_' . $max_placeholder++); + $update[] = ($field . '=VALUES(' . $field . ')'); } $query .= implode(', ', $update);