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

Fixed length, lower, upper and mod AST functions to use platform for generating SQL

This commit is contained in:
Juozas Kaziukenas 2010-06-09 15:40:54 +01:00
parent c1661dd53e
commit 494bfc8966
4 changed files with 13 additions and 12 deletions

View file

@ -41,8 +41,9 @@ class LengthFunction extends FunctionNode
*/ */
public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker) public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
{ {
//TODO: Use platform to get SQL return $sqlWalker->getConnection()->getDatabasePlatform()->getLengthExpression(
return 'LENGTH(' . $sqlWalker->walkStringPrimary($this->stringPrimary) . ')'; $sqlWalker->walkSimpleArithmeticExpression($this->stringPrimary)
);
} }
/** /**

View file

@ -41,8 +41,9 @@ class LowerFunction extends FunctionNode
*/ */
public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker) public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
{ {
//TODO: Use platform to get SQL return $sqlWalker->getConnection()->getDatabasePlatform()->getLowerExpression(
return 'LOWER(' . $sqlWalker->walkStringPrimary($this->stringPrimary) . ')'; $sqlWalker->walkSimpleArithmeticExpression($this->stringPrimary)
);
} }
/** /**

View file

@ -42,12 +42,10 @@ class ModFunction extends FunctionNode
*/ */
public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker) public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
{ {
//TODO: Use platform to get SQL return $sqlWalker->getConnection()->getDatabasePlatform()->getModExpression(
return 'MOD(' $sqlWalker->walkSimpleArithmeticExpression($this->firstSimpleArithmeticExpression),
. $sqlWalker->walkSimpleArithmeticExpression($this->firstSimpleArithmeticExpression) $sqlWalker->walkSimpleArithmeticExpression($this->secondSimpleArithmeticExpression)
. ', ' );
. $sqlWalker->walkSimpleArithmeticExpression($this->secondSimpleArithmeticExpression)
. ')';
} }
/** /**

View file

@ -41,8 +41,9 @@ class UpperFunction extends FunctionNode
*/ */
public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker) public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
{ {
//TODO: Use platform to get SQL return $sqlWalker->getConnection()->getDatabasePlatform()->getUpperExpression(
return 'UPPER(' . $sqlWalker->walkStringPrimary($this->stringPrimary) . ')'; $sqlWalker->walkSimpleArithmeticExpression($this->stringPrimary)
);
} }
/** /**