1
0
mirror of synced 2024-12-14 07:06:04 +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)
{
//TODO: Use platform to get SQL
return 'LENGTH(' . $sqlWalker->walkStringPrimary($this->stringPrimary) . ')';
return $sqlWalker->getConnection()->getDatabasePlatform()->getLengthExpression(
$sqlWalker->walkSimpleArithmeticExpression($this->stringPrimary)
);
}
/**

View File

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

View File

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

View File

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