Commit 8b2ca0d4 authored by beberlei's avatar beberlei

[2.0] DDC-325 - Fix Order of LOCATE to be LOCATE(needle, haystack [, offset])

parent 62712458
...@@ -47,8 +47,8 @@ class LocateFunction extends FunctionNode ...@@ -47,8 +47,8 @@ class LocateFunction extends FunctionNode
{ {
return $sqlWalker->getConnection()->getDatabasePlatform()->getLocateExpression( return $sqlWalker->getConnection()->getDatabasePlatform()->getLocateExpression(
$sqlWalker->walkStringPrimary($this->secondStringPrimary), // its the other way around in platform
$sqlWalker->walkStringPrimary($this->firstStringPrimary), $sqlWalker->walkStringPrimary($this->firstStringPrimary),
$sqlWalker->walkStringPrimary($this->secondStringPrimary),
(($this->simpleArithmeticExpression) (($this->simpleArithmeticExpression)
? $sqlWalker->walkSimpleArithmeticExpression($this->simpleArithmeticExpression) ? $sqlWalker->walkSimpleArithmeticExpression($this->simpleArithmeticExpression)
: false : false
......
...@@ -99,7 +99,7 @@ class QueryDqlFunctionTest extends \Doctrine\Tests\OrmFunctionalTestCase ...@@ -99,7 +99,7 @@ class QueryDqlFunctionTest extends \Doctrine\Tests\OrmFunctionalTestCase
public function testFunctionLocate() 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"; "FROM Doctrine\Tests\Models\Company\CompanyManager m";
$result = $this->_em->createQuery($dql) $result = $this->_em->createQuery($dql)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment