1
0
mirror of synced 2024-12-15 15:46:02 +03:00
doctrine2/lib/Doctrine/ORM/Query/AST/Functions/SqrtFunction.php
2009-06-14 17:34:28 +00:00

45 lines
1.0 KiB
PHP

<?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
namespace Doctrine\ORM\Query\AST\Functions;
/**
* "SQRT" "(" SimpleArithmeticExpression ")"
*
* @author Roman Borschel <roman@code-factory.org>
*/
class SqrtFunction extends FunctionNode
{
private $_simpleArithmeticExpression;
public function getSimpleArithmeticExpression()
{
return $this->_simpleArithmeticExpression;
}
/**
* @override
*/
public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
{
//TODO: Use platform to get SQL
return 'SQRT(' . $sqlWalker->walkSimpleArithmeticExpression($this->_simpleArithmeticExpression) . ')';
}
/**
* @override
*/
public function parse(\Doctrine\ORM\Query\Parser $parser)
{
$lexer = $parser->getLexer();
$parser->match($lexer->lookahead['value']);
$parser->match('(');
$this->_simpleArithmeticExpression = $parser->SimpleArithmeticExpression();
$parser->match(')');
}
}