2009-03-23 20:39:33 +03:00
|
|
|
<?php
|
|
|
|
/*
|
|
|
|
* To change this template, choose Tools | Templates
|
|
|
|
* and open the template in the editor.
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace Doctrine\ORM\Query\AST\Functions;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* "CONCAT" "(" StringPrimary "," StringPrimary ")"
|
|
|
|
*
|
2009-06-14 21:34:28 +04:00
|
|
|
* @author Roman Borschel <roman@code-factory.org>
|
2009-03-23 20:39:33 +03:00
|
|
|
*/
|
|
|
|
class ConcatFunction extends FunctionNode
|
|
|
|
{
|
|
|
|
private $_firstStringPrimary;
|
|
|
|
private $_secondStringPriamry;
|
|
|
|
|
|
|
|
public function getFirstStringPrimary()
|
|
|
|
{
|
|
|
|
return $this->_firstStringPrimary;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getSecondStringPrimary()
|
|
|
|
{
|
|
|
|
return $this->_secondStringPrimary;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @override
|
|
|
|
*/
|
|
|
|
public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
|
|
|
|
{
|
2009-03-28 20:10:41 +03:00
|
|
|
$platform = $sqlWalker->getConnection()->getDatabasePlatform();
|
|
|
|
return $platform->getConcatExpression(
|
|
|
|
$sqlWalker->walkStringPrimary($this->_firstStringPrimary),
|
|
|
|
$sqlWalker->walkStringPrimary($this->_secondStringPrimary)
|
|
|
|
);
|
2009-03-23 20:39:33 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @override
|
|
|
|
*/
|
|
|
|
public function parse(\Doctrine\ORM\Query\Parser $parser)
|
|
|
|
{
|
|
|
|
$lexer = $parser->getLexer();
|
|
|
|
$parser->match($lexer->lookahead['value']);
|
|
|
|
$parser->match('(');
|
|
|
|
|
2009-06-14 21:34:28 +04:00
|
|
|
$this->_firstStringPrimary = $parser->StringPrimary();
|
2009-03-23 20:39:33 +03:00
|
|
|
$parser->match(',');
|
2009-06-14 21:34:28 +04:00
|
|
|
$this->_secondStringPrimary = $parser->StringPrimary();
|
2009-03-23 20:39:33 +03:00
|
|
|
|
|
|
|
$parser->match(')');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|