From 7556bfcb71348778679b921c9df07f46793ec641 Mon Sep 17 00:00:00 2001 From: zYne Date: Thu, 30 Nov 2006 22:40:59 +0000 Subject: [PATCH] Fixed DELETE handling, fixes #236 --- lib/Doctrine/Query.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/Doctrine/Query.php b/lib/Doctrine/Query.php index b46543d20..b55e901a3 100644 --- a/lib/Doctrine/Query.php +++ b/lib/Doctrine/Query.php @@ -445,11 +445,20 @@ class Doctrine_Query extends Doctrine_Hydrate implements Countable { public function isLimitSubqueryUsed() { return $this->limitSubqueryUsed; } - + /** + * getQueryBase + * returns the base of the generated sql query + * On mysql driver special strategy has to be used for DELETE statements + * + * @return string the base of the generated sql query + */ public function getQueryBase() { switch($this->type) { case self::DELETE: - $q = 'DELETE FROM '; + if($this->conn->getName() == 'mysql') + $q = 'DELETE '.end($this->tableAliases).' FROM '; + else + $q = 'DELETE FROM '; break; case self::UPDATE: $q = 'UPDATE ';