1
0
Fork 0
mirror of synced 2025-04-03 13:23:37 +03:00

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

This commit is contained in:
beberlei 2010-02-11 23:02:21 +00:00
parent 6271245831
commit 8b2ca0d484
2 changed files with 2 additions and 2 deletions

View file

@ -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

View file

@ -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)