From 8b2ca0d484843445afae372fc2abcf7f77b6f0fb Mon Sep 17 00:00:00 2001 From: beberlei Date: Thu, 11 Feb 2010 23:02:21 +0000 Subject: [PATCH] [2.0] DDC-325 - Fix Order of LOCATE to be LOCATE(needle, haystack [, offset]) --- lib/Doctrine/ORM/Query/AST/Functions/LocateFunction.php | 2 +- tests/Doctrine/Tests/ORM/Functional/QueryDqlFunctionTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Doctrine/ORM/Query/AST/Functions/LocateFunction.php b/lib/Doctrine/ORM/Query/AST/Functions/LocateFunction.php index 323093763..93bf49ffc 100644 --- a/lib/Doctrine/ORM/Query/AST/Functions/LocateFunction.php +++ b/lib/Doctrine/ORM/Query/AST/Functions/LocateFunction.php @@ -47,8 +47,8 @@ class LocateFunction extends FunctionNode { return $sqlWalker->getConnection()->getDatabasePlatform()->getLocateExpression( + $sqlWalker->walkStringPrimary($this->secondStringPrimary), // its the other way around in platform $sqlWalker->walkStringPrimary($this->firstStringPrimary), - $sqlWalker->walkStringPrimary($this->secondStringPrimary), (($this->simpleArithmeticExpression) ? $sqlWalker->walkSimpleArithmeticExpression($this->simpleArithmeticExpression) : false diff --git a/tests/Doctrine/Tests/ORM/Functional/QueryDqlFunctionTest.php b/tests/Doctrine/Tests/ORM/Functional/QueryDqlFunctionTest.php index 9c350b886..d6ea041d0 100644 --- a/tests/Doctrine/Tests/ORM/Functional/QueryDqlFunctionTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/QueryDqlFunctionTest.php @@ -99,7 +99,7 @@ class QueryDqlFunctionTest extends \Doctrine\Tests\OrmFunctionalTestCase public function testFunctionLocate() { - $dql = "SELECT m, LOCATE(LOWER(m.name), 'e') AS loc, LOCATE(LOWER(m.name), 'e', 7) AS loc2 ". + $dql = "SELECT m, LOCATE('e', LOWER(m.name)) AS loc, LOCATE('e', LOWER(m.name), 7) AS loc2 ". "FROM Doctrine\Tests\Models\Company\CompanyManager m"; $result = $this->_em->createQuery($dql)