summaryrefslogtreecommitdiff
path: root/includes/database/mysql
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2008-12-26 14:23:38 +0000
committerDries Buytaert <dries@buytaert.net>2008-12-26 14:23:38 +0000
commit0d100b57dcffe54ec7f46d8f577a4c26fcf34202 (patch)
treeffcfb6c4cb5e1f9481479620c87b37a2c7b6ebec /includes/database/mysql
parentfc063806de3ded56d1c3d78a49e8a60de7a7fe1c (diff)
downloadbrdo-0d100b57dcffe54ec7f46d8f577a4c26fcf34202.tar.gz
brdo-0d100b57dcffe54ec7f46d8f577a4c26fcf34202.tar.bz2
- Patch #332002 by Crell et al: MergeQuery should refuse to execute if there are no key fields. With tests.
Diffstat (limited to 'includes/database/mysql')
-rw-r--r--includes/database/mysql/query.inc6
1 files changed, 6 insertions, 0 deletions
diff --git a/includes/database/mysql/query.inc b/includes/database/mysql/query.inc
index d48681316..751137602 100644
--- a/includes/database/mysql/query.inc
+++ b/includes/database/mysql/query.inc
@@ -80,6 +80,12 @@ class InsertQuery_mysql extends InsertQuery {
class MergeQuery_mysql extends MergeQuery {
public function execute() {
+
+ // A merge query without any key field is invalid.
+ if (count($this->keyFields) == 0) {
+ throw new InvalidMergeQueryException("You need to specify key fields before executing a merge query");
+ }
+
// Set defaults.
if ($this->updateFields) {
$update_fields = $this->updateFields;