[2.0] Updated AST nodes to use public properties instead of setter/getter methods.
This commit is contained in:
parent
f087a0058b
commit
33fc28ffbd
64 changed files with 2788 additions and 2774 deletions
|
@ -30,9 +30,14 @@ use Doctrine\DBAL\Types;
|
|||
* point of abstraction of platform-specific behaviors, features and SQL dialects.
|
||||
* They are a passive source of information.
|
||||
*
|
||||
* @since 2.0
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
* @author Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library)
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision: 3938 $
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
* @author Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library)
|
||||
*/
|
||||
abstract class AbstractPlatform
|
||||
{
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
|
||||
namespace Doctrine\ORM;
|
||||
|
||||
use Doctrine\ORM\Query\QueryException;
|
||||
|
||||
/**
|
||||
* Base class for Query and NativeQuery.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,22 @@
|
|||
<?php
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Query\AST;
|
||||
|
@ -9,34 +24,40 @@ namespace Doctrine\ORM\Query\AST;
|
|||
/**
|
||||
* ArithmeticFactor ::= [("+" | "-")] ArithmeticPrimary
|
||||
*
|
||||
* @author robo
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision: 3938 $
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class ArithmeticFactor extends Node
|
||||
{
|
||||
private $_arithmeticPrimary;
|
||||
private $_pSigned;
|
||||
private $_nSigned;
|
||||
/**
|
||||
* @var ArithmeticPrimary
|
||||
*/
|
||||
public $arithmeticPrimary;
|
||||
|
||||
/**
|
||||
* @var null|boolean NULL represents no sign, TRUE means positive and FALSE means negative sign
|
||||
*/
|
||||
public $sign;
|
||||
|
||||
public function __construct($arithmeticPrimary, $pSigned = false, $nSigned = false)
|
||||
public function __construct($arithmeticPrimary, $sign = null)
|
||||
{
|
||||
$this->_arithmeticPrimary = $arithmeticPrimary;
|
||||
$this->_pSigned = $pSigned;
|
||||
$this->_nSigned = $nSigned;
|
||||
}
|
||||
|
||||
public function getArithmeticPrimary()
|
||||
{
|
||||
return $this->_arithmeticPrimary;
|
||||
$this->arithmeticPrimary = $arithmeticPrimary;
|
||||
$this->sign = $sign;
|
||||
}
|
||||
|
||||
public function isPositiveSigned()
|
||||
{
|
||||
return $this->_pSigned;
|
||||
return $this->sign === true;
|
||||
}
|
||||
|
||||
public function isNegativeSigned()
|
||||
{
|
||||
return $this->_nSigned;
|
||||
return $this->sign === false;
|
||||
}
|
||||
|
||||
public function dispatch($sqlWalker)
|
||||
|
|
|
@ -1,7 +1,22 @@
|
|||
<?php
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Query\AST;
|
||||
|
@ -9,20 +24,21 @@ namespace Doctrine\ORM\Query\AST;
|
|||
/**
|
||||
* ArithmeticTerm ::= ArithmeticFactor {("*" | "/") ArithmeticFactor}*
|
||||
*
|
||||
* @author robo
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision: 3938 $
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class ArithmeticTerm extends Node
|
||||
{
|
||||
private $_factors;
|
||||
public $arithmeticFactors;
|
||||
|
||||
public function __construct(array $arithmeticFactors)
|
||||
{
|
||||
$this->_factors = $arithmeticFactors;
|
||||
}
|
||||
|
||||
public function getArithmeticFactors()
|
||||
{
|
||||
return $this->_factors;
|
||||
$this->arithmeticFactors = $arithmeticFactors;
|
||||
}
|
||||
|
||||
public function dispatch($sqlWalker)
|
||||
|
|
|
@ -1,7 +1,22 @@
|
|||
<?php
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Query\AST;
|
||||
|
@ -9,45 +24,26 @@ namespace Doctrine\ORM\Query\AST;
|
|||
/**
|
||||
* Description of BetweenExpression
|
||||
*
|
||||
* @author robo
|
||||
@license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision: 3938 $
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class BetweenExpression extends Node
|
||||
{
|
||||
private $_baseExpression;
|
||||
private $_leftBetweenExpression;
|
||||
private $_rightBetweenExpression;
|
||||
private $_not;
|
||||
public $expression;
|
||||
public $leftBetweenExpression;
|
||||
public $rightBetweenExpression;
|
||||
public $not;
|
||||
|
||||
public function __construct($baseExpr, $leftExpr, $rightExpr)
|
||||
public function __construct($expr, $leftExpr, $rightExpr)
|
||||
{
|
||||
$this->_baseExpression = $baseExpr;
|
||||
$this->_leftBetweenExpression = $leftExpr;
|
||||
$this->_rightBetweenExpression = $rightExpr;
|
||||
}
|
||||
|
||||
public function getBaseExpression()
|
||||
{
|
||||
return $this->_baseExpression;
|
||||
}
|
||||
|
||||
public function getLeftBetweenExpression()
|
||||
{
|
||||
return $this->_leftBetweenExpression;
|
||||
}
|
||||
|
||||
public function getRightBetweenExpression()
|
||||
{
|
||||
return $this->_rightBetweenExpression;
|
||||
}
|
||||
|
||||
public function setNot($bool)
|
||||
{
|
||||
$this->_not = $bool;
|
||||
}
|
||||
|
||||
public function getNot()
|
||||
{
|
||||
return $this->_not;
|
||||
$this->expression = $expr;
|
||||
$this->leftBetweenExpression = $leftExpr;
|
||||
$this->rightBetweenExpression = $rightExpr;
|
||||
}
|
||||
|
||||
public function dispatch($sqlWalker)
|
||||
|
|
|
@ -1,23 +1,47 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Query\AST;
|
||||
|
||||
/**
|
||||
* CollectionMemberExpression ::= EntityExpression ["NOT"] "MEMBER" ["OF"] CollectionValuedPathExpression
|
||||
*
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision: 3938 $
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class CollectionMemberExpression extends Node
|
||||
{
|
||||
public $entityExpression;
|
||||
public $collectionValuedPathExpression;
|
||||
public $isNot;
|
||||
public $not;
|
||||
|
||||
public function __construct($entityExpr, $collValuedPathExpr, $isNot)
|
||||
public function __construct($entityExpr, $collValuedPathExpr)
|
||||
{
|
||||
$this->entityExpression = $entityExpr;
|
||||
$this->collectionValuedPathExpression = $collValuedPathExpr;
|
||||
$this->isNot = $isNot;
|
||||
}
|
||||
|
||||
public function dispatch($walker)
|
||||
|
|
|
@ -29,34 +29,25 @@ namespace Doctrine\ORM\Query\AST;
|
|||
* DatetimeExpression ComparisonOperator (DatetimeExpression | QuantifiedExpression) |
|
||||
* EntityExpression ("=" | "<>") (EntityExpression | QuantifiedExpression)
|
||||
*
|
||||
* @author robo
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision: 3938 $
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class ComparisonExpression extends Node
|
||||
{
|
||||
private $_leftExpr;
|
||||
private $_rightExpr;
|
||||
private $_operator;
|
||||
public $leftExpression;
|
||||
public $rightExpression;
|
||||
public $operator;
|
||||
|
||||
public function __construct($leftExpr, $operator, $rightExpr)
|
||||
{
|
||||
$this->_leftExpr = $leftExpr;
|
||||
$this->_rightExpr = $rightExpr;
|
||||
$this->_operator = $operator;
|
||||
}
|
||||
|
||||
public function getLeftExpression()
|
||||
{
|
||||
return $this->_leftExpr;
|
||||
}
|
||||
|
||||
public function getRightExpression()
|
||||
{
|
||||
return $this->_rightExpr;
|
||||
}
|
||||
|
||||
public function getOperator()
|
||||
{
|
||||
return $this->_operator;
|
||||
$this->leftExpression = $leftExpr;
|
||||
$this->rightExpression = $rightExpr;
|
||||
$this->operator = $operator;
|
||||
}
|
||||
|
||||
public function dispatch($sqlWalker)
|
||||
|
|
|
@ -1,42 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.phpdoctrine.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Query\AST;
|
||||
|
||||
/**
|
||||
* ComparisonOperator = "=" | "<" | "<=" | "<>" | ">" | ">=" | "!="
|
||||
*
|
||||
* @package Doctrine
|
||||
* @subpackage Query
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Janne Vanhala <jpvanhal@cc.hut.fi>
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link http://www.phpdoctrine.org
|
||||
* @since 2.0
|
||||
* @version $Revision$
|
||||
*/
|
||||
class ComparisonOperator extends Node
|
||||
{
|
||||
public function dispatch($sqlWalker)
|
||||
{
|
||||
;
|
||||
}
|
||||
}
|
|
@ -1,7 +1,22 @@
|
|||
<?php
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Query\AST;
|
||||
|
@ -9,20 +24,21 @@ namespace Doctrine\ORM\Query\AST;
|
|||
/**
|
||||
* ConditionalExpression ::= ConditionalTerm {"OR" ConditionalTerm}*
|
||||
*
|
||||
* @author robo
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision: 3938 $
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class ConditionalExpression extends Node
|
||||
{
|
||||
private $_conditionalTerms = array();
|
||||
public $conditionalTerms = array();
|
||||
|
||||
public function __construct(array $conditionalTerms)
|
||||
{
|
||||
$this->_conditionalTerms = $conditionalTerms;
|
||||
}
|
||||
|
||||
public function getConditionalTerms()
|
||||
{
|
||||
return $this->_conditionalTerms;
|
||||
$this->conditionalTerms = $conditionalTerms;
|
||||
}
|
||||
|
||||
public function dispatch($sqlWalker)
|
||||
|
|
|
@ -1,7 +1,22 @@
|
|||
<?php
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Query\AST;
|
||||
|
@ -9,27 +24,22 @@ namespace Doctrine\ORM\Query\AST;
|
|||
/**
|
||||
* ConditionalFactor ::= ["NOT"] ConditionalPrimary
|
||||
*
|
||||
* @author robo
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision: 3938 $
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class ConditionalFactor extends Node
|
||||
{
|
||||
private $_not = false;
|
||||
private $_conditionalPrimary;
|
||||
public $not = false;
|
||||
public $conditionalPrimary;
|
||||
|
||||
public function __construct($conditionalPrimary, $not = false)
|
||||
public function __construct($conditionalPrimary)
|
||||
{
|
||||
$this->_conditionalPrimary = $conditionalPrimary;
|
||||
$this->_not = $not;
|
||||
}
|
||||
|
||||
public function isNot()
|
||||
{
|
||||
return $this->_not;
|
||||
}
|
||||
|
||||
public function getConditionalPrimary()
|
||||
{
|
||||
return $this->_conditionalPrimary;
|
||||
$this->conditionalPrimary = $conditionalPrimary;
|
||||
}
|
||||
|
||||
public function dispatch($sqlWalker)
|
||||
|
|
|
@ -1,7 +1,22 @@
|
|||
<?php
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Query\AST;
|
||||
|
@ -9,41 +24,27 @@ namespace Doctrine\ORM\Query\AST;
|
|||
/**
|
||||
* ConditionalPrimary ::= SimpleConditionalExpression | "(" ConditionalExpression ")"
|
||||
*
|
||||
* @author robo
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision: 3938 $
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class ConditionalPrimary extends Node
|
||||
{
|
||||
private $_simpleConditionalExpression;
|
||||
private $_conditionalExpression;
|
||||
|
||||
public function setSimpleConditionalExpression($simpleConditionalExpr)
|
||||
{
|
||||
$this->_simpleConditionalExpression = $simpleConditionalExpr;
|
||||
}
|
||||
|
||||
public function setConditionalExpression($conditionalExpr)
|
||||
{
|
||||
$this->_conditionalExpression = $conditionalExpr;
|
||||
}
|
||||
|
||||
public function getSimpleConditionalExpression()
|
||||
{
|
||||
return $this->_simpleConditionalExpression;
|
||||
}
|
||||
|
||||
public function getConditionalExpression()
|
||||
{
|
||||
return $this->_conditionalExpression;
|
||||
}
|
||||
public $simpleConditionalExpression;
|
||||
public $conditionalExpression;
|
||||
|
||||
public function isSimpleConditionalExpression()
|
||||
{
|
||||
return (bool) $this->_simpleConditionalExpression;
|
||||
return (bool) $this->simpleConditionalExpression;
|
||||
}
|
||||
|
||||
public function isConditionalExpression()
|
||||
{
|
||||
return (bool) $this->_conditionalExpression;
|
||||
return (bool) $this->conditionalExpression;
|
||||
}
|
||||
|
||||
public function dispatch($sqlWalker)
|
||||
|
|
|
@ -1,7 +1,22 @@
|
|||
<?php
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Query\AST;
|
||||
|
@ -9,20 +24,21 @@ namespace Doctrine\ORM\Query\AST;
|
|||
/**
|
||||
* ConditionalTerm ::= ConditionalFactor {"AND" ConditionalFactor}*
|
||||
*
|
||||
* @author robo
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision: 3938 $
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class ConditionalTerm extends Node
|
||||
{
|
||||
private $_conditionalFactors = array();
|
||||
public $conditionalFactors = array();
|
||||
|
||||
public function __construct(array $conditionalFactors)
|
||||
{
|
||||
$this->_conditionalFactors = $conditionalFactors;
|
||||
}
|
||||
|
||||
public function getConditionalFactors()
|
||||
{
|
||||
return $this->_conditionalFactors;
|
||||
$this->conditionalFactors = $conditionalFactors;
|
||||
}
|
||||
|
||||
public function dispatch($sqlWalker)
|
||||
|
|
|
@ -23,30 +23,23 @@ namespace Doctrine\ORM\Query\AST;
|
|||
|
||||
/**
|
||||
* DeleteClause ::= "DELETE" ["FROM"] AbstractSchemaName [["AS"] AliasIdentificationVariable]
|
||||
*
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision: 3938 $
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class DeleteClause extends Node
|
||||
{
|
||||
private $_abstractSchemaName;
|
||||
private $_aliasIdentificationVariable;
|
||||
public $abstractSchemaName;
|
||||
public $aliasIdentificationVariable;
|
||||
|
||||
public function __construct($abstractSchemaName)
|
||||
{
|
||||
$this->_abstractSchemaName = $abstractSchemaName;
|
||||
}
|
||||
|
||||
public function getAbstractSchemaName()
|
||||
{
|
||||
return $this->_abstractSchemaName;
|
||||
}
|
||||
|
||||
public function getAliasIdentificationVariable()
|
||||
{
|
||||
return $this->_aliasIdentificationVariable;
|
||||
}
|
||||
|
||||
public function setAliasIdentificationVariable($alias)
|
||||
{
|
||||
$this->_aliasIdentificationVariable = $alias;
|
||||
$this->abstractSchemaName = $abstractSchemaName;
|
||||
}
|
||||
|
||||
public function dispatch($sqlWalker)
|
||||
|
|
|
@ -24,37 +24,24 @@ namespace Doctrine\ORM\Query\AST;
|
|||
/**
|
||||
* DeleteStatement = DeleteClause [WhereClause]
|
||||
*
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link http://www.phpdoctrine.org
|
||||
* @since 2.0
|
||||
* @version $Revision$
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision: 3938 $
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class DeleteStatement extends Node
|
||||
{
|
||||
private $_deleteClause;
|
||||
private $_whereClause;
|
||||
public $deleteClause;
|
||||
public $whereClause;
|
||||
|
||||
public function __construct($deleteClause)
|
||||
{
|
||||
$this->_deleteClause = $deleteClause;
|
||||
$this->deleteClause = $deleteClause;
|
||||
}
|
||||
|
||||
public function setWhereClause($whereClause)
|
||||
{
|
||||
$this->_whereClause = $whereClause;
|
||||
}
|
||||
|
||||
public function getDeleteClause()
|
||||
{
|
||||
return $this->_deleteClause;
|
||||
}
|
||||
|
||||
public function getWhereClause()
|
||||
{
|
||||
return $this->_whereClause;
|
||||
}
|
||||
|
||||
public function dispatch($sqlWalker)
|
||||
{
|
||||
return $sqlWalker->walkDeleteStatement($this);
|
||||
|
|
|
@ -1,35 +1,45 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Query\AST;
|
||||
|
||||
/**
|
||||
* EmptyCollectionComparisonExpression ::= CollectionValuedPathExpression "IS" ["NOT"] "EMPTY"
|
||||
*
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision: 3938 $
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class EmptyCollectionComparisonExpression extends Node
|
||||
{
|
||||
private $_expression;
|
||||
private $_not;
|
||||
public $expression;
|
||||
public $not;
|
||||
|
||||
public function __construct($expression)
|
||||
{
|
||||
$this->_expression = $expression;
|
||||
}
|
||||
|
||||
public function getExpression()
|
||||
{
|
||||
return $this->_expression;
|
||||
}
|
||||
|
||||
public function setNot($bool)
|
||||
{
|
||||
$this->_not = $bool;
|
||||
}
|
||||
|
||||
public function isNot()
|
||||
{
|
||||
return $this->_not;
|
||||
$this->expression = $expression;
|
||||
}
|
||||
|
||||
public function dispatch($sqlWalker)
|
||||
|
|
|
@ -1,7 +1,22 @@
|
|||
<?php
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Query\AST;
|
||||
|
@ -9,31 +24,22 @@ namespace Doctrine\ORM\Query\AST;
|
|||
/**
|
||||
* ExistsExpression ::= ["NOT"] "EXISTS" "(" Subselect ")"
|
||||
*
|
||||
* @author robo
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision: 3938 $
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class ExistsExpression extends Node
|
||||
{
|
||||
private $_not = false;
|
||||
private $_subselect;
|
||||
public $not;
|
||||
public $subselect;
|
||||
|
||||
public function __construct($subselect)
|
||||
{
|
||||
$this->_subselect = $subselect;
|
||||
}
|
||||
|
||||
public function setNot($bool)
|
||||
{
|
||||
$this->_not = $bool;
|
||||
}
|
||||
|
||||
public function isNot()
|
||||
{
|
||||
return $this->_not;
|
||||
}
|
||||
|
||||
public function getSubselect()
|
||||
{
|
||||
return $this->_subselect;
|
||||
$this->subselect = $subselect;
|
||||
}
|
||||
|
||||
public function dispatch($sqlWalker)
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.phpdoctrine.org>.
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Query\AST;
|
||||
|
@ -24,27 +24,23 @@ namespace Doctrine\ORM\Query\AST;
|
|||
/**
|
||||
* FromClause ::= "FROM" IdentificationVariableDeclaration {"," IdentificationVariableDeclaration}
|
||||
*
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link http://www.phpdoctrine.org
|
||||
* @since 2.0
|
||||
* @version $Revision$
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision: 3938 $
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class FromClause extends Node
|
||||
{
|
||||
protected $_identificationVariableDeclarations = array();
|
||||
public $identificationVariableDeclarations = array();
|
||||
|
||||
public function __construct(array $identificationVariableDeclarations)
|
||||
{
|
||||
$this->_identificationVariableDeclarations = $identificationVariableDeclarations;
|
||||
$this->identificationVariableDeclarations = $identificationVariableDeclarations;
|
||||
}
|
||||
|
||||
/* Getters */
|
||||
public function getIdentificationVariableDeclarations()
|
||||
{
|
||||
return $this->_identificationVariableDeclarations;
|
||||
}
|
||||
|
||||
public function dispatch($sqlWalker)
|
||||
{
|
||||
return $sqlWalker->walkFromClause($this);
|
||||
|
|
|
@ -1,7 +1,22 @@
|
|||
<?php
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Query\AST\Functions;
|
||||
|
@ -9,24 +24,26 @@ namespace Doctrine\ORM\Query\AST\Functions;
|
|||
/**
|
||||
* "ABS" "(" SimpleArithmeticExpression ")"
|
||||
*
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision: 3938 $
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class AbsFunction extends FunctionNode
|
||||
{
|
||||
private $_simpleArithmeticExpression;
|
||||
|
||||
public function getSimpleArithmeticExpression()
|
||||
{
|
||||
return $this->_simpleArithmeticExpression;
|
||||
}
|
||||
public $simpleArithmeticExpression;
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
|
||||
{
|
||||
//TODO: Use platform to get SQL
|
||||
return 'ABS(' . $sqlWalker->walkSimpleArithmeticExpression($this->_simpleArithmeticExpression) . ')';
|
||||
return 'ABS(' . $sqlWalker->walkSimpleArithmeticExpression(
|
||||
$this->simpleArithmeticExpression
|
||||
) . ')';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -37,7 +54,7 @@ class AbsFunction extends FunctionNode
|
|||
$lexer = $parser->getLexer();
|
||||
$parser->match($lexer->lookahead['value']);
|
||||
$parser->match('(');
|
||||
$this->_simpleArithmeticExpression = $parser->SimpleArithmeticExpression();
|
||||
$this->simpleArithmeticExpression = $parser->SimpleArithmeticExpression();
|
||||
$parser->match(')');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,22 @@
|
|||
<?php
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Query\AST\Functions;
|
||||
|
@ -9,22 +24,18 @@ namespace Doctrine\ORM\Query\AST\Functions;
|
|||
/**
|
||||
* "CONCAT" "(" StringPrimary "," StringPrimary ")"
|
||||
*
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision: 3938 $
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class ConcatFunction extends FunctionNode
|
||||
{
|
||||
private $_firstStringPrimary;
|
||||
private $_secondStringPriamry;
|
||||
|
||||
public function getFirstStringPrimary()
|
||||
{
|
||||
return $this->_firstStringPrimary;
|
||||
}
|
||||
|
||||
public function getSecondStringPrimary()
|
||||
{
|
||||
return $this->_secondStringPrimary;
|
||||
}
|
||||
public $firstStringPrimary;
|
||||
public $secondStringPriamry;
|
||||
|
||||
/**
|
||||
* @override
|
||||
|
@ -33,8 +44,8 @@ class ConcatFunction extends FunctionNode
|
|||
{
|
||||
$platform = $sqlWalker->getConnection()->getDatabasePlatform();
|
||||
return $platform->getConcatExpression(
|
||||
$sqlWalker->walkStringPrimary($this->_firstStringPrimary),
|
||||
$sqlWalker->walkStringPrimary($this->_secondStringPrimary)
|
||||
$sqlWalker->walkStringPrimary($this->firstStringPrimary),
|
||||
$sqlWalker->walkStringPrimary($this->secondStringPrimary)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -47,9 +58,9 @@ class ConcatFunction extends FunctionNode
|
|||
$parser->match($lexer->lookahead['value']);
|
||||
$parser->match('(');
|
||||
|
||||
$this->_firstStringPrimary = $parser->StringPrimary();
|
||||
$this->firstStringPrimary = $parser->StringPrimary();
|
||||
$parser->match(',');
|
||||
$this->_secondStringPrimary = $parser->StringPrimary();
|
||||
$this->secondStringPrimary = $parser->StringPrimary();
|
||||
|
||||
$parser->match(')');
|
||||
}
|
||||
|
|
|
@ -1,11 +1,36 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Query\AST\Functions;
|
||||
|
||||
/**
|
||||
* "CURRENT_DATE"
|
||||
*
|
||||
* @author robo
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision: 3938 $
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class CurrentDateFunction extends FunctionNode
|
||||
{
|
||||
|
|
|
@ -1,7 +1,22 @@
|
|||
<?php
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Query\AST\Functions;
|
||||
|
@ -9,7 +24,13 @@ namespace Doctrine\ORM\Query\AST\Functions;
|
|||
/**
|
||||
* "CURRENT_TIME"
|
||||
*
|
||||
* @author robo
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision: 3938 $
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class CurrentTimeFunction extends FunctionNode
|
||||
{
|
||||
|
|
|
@ -24,22 +24,23 @@ namespace Doctrine\ORM\Query\AST\Functions;
|
|||
use Doctrine\ORM\Query\AST\Node;
|
||||
|
||||
/**
|
||||
* Description of Function
|
||||
* Abtract Function Node.
|
||||
*
|
||||
* @author robo
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision: 3938 $
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
abstract class FunctionNode extends Node
|
||||
{
|
||||
private $_name;
|
||||
public $name;
|
||||
|
||||
public function __construct($name)
|
||||
{
|
||||
$this->_name = $name;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return $this->_name;
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
abstract public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker);
|
||||
|
|
|
@ -1,7 +1,22 @@
|
|||
<?php
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Query\AST\Functions;
|
||||
|
@ -9,16 +24,17 @@ namespace Doctrine\ORM\Query\AST\Functions;
|
|||
/**
|
||||
* "LENGTH" "(" StringPrimary ")"
|
||||
*
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision: 3938 $
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class LengthFunction extends FunctionNode
|
||||
{
|
||||
private $_stringPrimary;
|
||||
|
||||
public function getStringPrimary()
|
||||
{
|
||||
return $this->_stringPrimary;
|
||||
}
|
||||
public $stringPrimary;
|
||||
|
||||
/**
|
||||
* @override
|
||||
|
@ -26,7 +42,7 @@ 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 'LENGTH(' . $sqlWalker->walkStringPrimary($this->stringPrimary) . ')';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -35,9 +51,12 @@ class LengthFunction extends FunctionNode
|
|||
public function parse(\Doctrine\ORM\Query\Parser $parser)
|
||||
{
|
||||
$lexer = $parser->getLexer();
|
||||
|
||||
$parser->match($lexer->lookahead['value']);
|
||||
$parser->match('(');
|
||||
$this->_stringPrimary = $parser->StringPrimary();
|
||||
|
||||
$this->stringPrimary = $parser->StringPrimary();
|
||||
|
||||
$parser->match(')');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,22 @@
|
|||
<?php
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Query\AST\Functions;
|
||||
|
@ -9,28 +24,19 @@ namespace Doctrine\ORM\Query\AST\Functions;
|
|||
/**
|
||||
* "LOCATE" "(" StringPrimary "," StringPrimary ["," SimpleArithmeticExpression]")"
|
||||
*
|
||||
* @author robo
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision: 3938 $
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class LocateFunction extends FunctionNode
|
||||
{
|
||||
private $_firstStringPrimary;
|
||||
private $_secondStringPrimary;
|
||||
private $_simpleArithmeticExpression;
|
||||
|
||||
public function getFirstStringPrimary()
|
||||
{
|
||||
return $this->_firstStringPrimary;
|
||||
}
|
||||
|
||||
public function getSecondStringPrimary()
|
||||
{
|
||||
return $this->_secondStringPrimary;
|
||||
}
|
||||
|
||||
public function getSimpleArithmeticExpression()
|
||||
{
|
||||
return $this->_simpleArithmeticExpression;
|
||||
}
|
||||
public $firstStringPrimary;
|
||||
public $secondStringPrimary;
|
||||
public $simpleArithmeticExpression;
|
||||
|
||||
/**
|
||||
* @override
|
||||
|
@ -38,15 +44,12 @@ class LocateFunction extends FunctionNode
|
|||
public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
|
||||
{
|
||||
//TODO: Use platform to get SQL
|
||||
$sql = 'LOCATE(' .
|
||||
$sqlWalker->walkStringPrimary($this->_firstStringPrimary)
|
||||
. ', ' .
|
||||
$sqlWalker->walkStringPrimary($this->_secondStringPrimary);
|
||||
|
||||
if ($this->_simpleArithmeticExpression) {
|
||||
$sql .= ', ' . $sqlWalker->walkSimpleArithmeticExpression($this->_simpleArithmeticExpression);
|
||||
}
|
||||
return $sql . ')';
|
||||
return 'LOCATE(' . $sqlWalker->walkStringPrimary($this->firstStringPrimary) . ', '
|
||||
. $sqlWalker->walkStringPrimary($this->secondStringPrimary)
|
||||
. (($this->simpleArithmeticExpression)
|
||||
? ', ' . $sqlWalker->walkSimpleArithmeticExpression($this->simpleArithmeticExpression)
|
||||
: ''
|
||||
) . ')';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -55,15 +58,22 @@ class LocateFunction extends FunctionNode
|
|||
public function parse(\Doctrine\ORM\Query\Parser $parser)
|
||||
{
|
||||
$lexer = $parser->getLexer();
|
||||
|
||||
$parser->match($lexer->lookahead['value']);
|
||||
$parser->match('(');
|
||||
$this->_firstStringPrimary = $parser->StringPrimary();
|
||||
|
||||
$this->firstStringPrimary = $parser->StringPrimary();
|
||||
|
||||
$parser->match(',');
|
||||
$this->_secondStringPrimary = $parser->StringPrimary();
|
||||
|
||||
$this->secondStringPrimary = $parser->StringPrimary();
|
||||
|
||||
if ($lexer->isNextToken(',')) {
|
||||
$parser->match(',');
|
||||
$this->_simpleArithmeticExpression = $parser->SimpleArithmeticExpression();
|
||||
|
||||
$this->simpleArithmeticExpression = $parser->SimpleArithmeticExpression();
|
||||
}
|
||||
|
||||
$parser->match(')');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,22 @@
|
|||
<?php
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Query\AST\Functions;
|
||||
|
@ -9,16 +24,17 @@ namespace Doctrine\ORM\Query\AST\Functions;
|
|||
/**
|
||||
* "LOWER" "(" StringPrimary ")"
|
||||
*
|
||||
* @author robo
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision: 3938 $
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class LowerFunction extends FunctionNode
|
||||
{
|
||||
private $_stringPrimary;
|
||||
|
||||
public function getStringPrimary()
|
||||
{
|
||||
return $this->_stringPrimary;
|
||||
}
|
||||
public $stringPrimary;
|
||||
|
||||
/**
|
||||
* @override
|
||||
|
@ -26,7 +42,7 @@ 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 'LOWER(' . $sqlWalker->walkStringPrimary($this->stringPrimary) . ')';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -35,9 +51,12 @@ class LowerFunction extends FunctionNode
|
|||
public function parse(\Doctrine\ORM\Query\Parser $parser)
|
||||
{
|
||||
$lexer = $parser->getLexer();
|
||||
|
||||
$parser->match($lexer->lookahead['value']);
|
||||
$parser->match('(');
|
||||
$this->_stringPrimary = $parser->StringPrimary();
|
||||
|
||||
$this->stringPrimary = $parser->StringPrimary();
|
||||
|
||||
$parser->match(')');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,22 @@
|
|||
<?php
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Query\AST\Functions;
|
||||
|
@ -9,22 +24,18 @@ namespace Doctrine\ORM\Query\AST\Functions;
|
|||
/**
|
||||
* "MOD" "(" SimpleArithmeticExpression "," SimpleArithmeticExpression ")"
|
||||
*
|
||||
* @author robo
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision: 3938 $
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class ModFunction extends FunctionNode
|
||||
{
|
||||
private $_firstSimpleArithmeticExpression;
|
||||
private $_secondSimpleArithmeticExpression;
|
||||
|
||||
public function getFirstSimpleArithmeticExpression()
|
||||
{
|
||||
return $this->_firstSimpleArithmeticExpression;
|
||||
}
|
||||
|
||||
public function getSecondSimpleArithmeticExpression()
|
||||
{
|
||||
return $this->_secondSimpleArithmeticExpression;
|
||||
}
|
||||
public $firstSimpleArithmeticExpression;
|
||||
public $secondSimpleArithmeticExpression;
|
||||
|
||||
/**
|
||||
* @override
|
||||
|
@ -32,11 +43,11 @@ class ModFunction extends FunctionNode
|
|||
public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
|
||||
{
|
||||
//TODO: Use platform to get SQL
|
||||
return 'SQRT(' .
|
||||
$sqlWalker->walkSimpleArithmeticExpression($this->_firstSimpleArithmeticExpression)
|
||||
. ', ' .
|
||||
$sqlWalker->walkSimpleArithmeticExpression($this->_secondSimpleArithmeticExpression)
|
||||
. ')';
|
||||
return 'SQRT('
|
||||
. $sqlWalker->walkSimpleArithmeticExpression($this->_firstSimpleArithmeticExpression)
|
||||
. ', '
|
||||
. $sqlWalker->walkSimpleArithmeticExpression($this->_secondSimpleArithmeticExpression)
|
||||
. ')';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -45,11 +56,16 @@ class ModFunction extends FunctionNode
|
|||
public function parse(\Doctrine\ORM\Query\Parser $parser)
|
||||
{
|
||||
$lexer = $parser->getLexer();
|
||||
|
||||
$parser->match($lexer->lookahead['value']);
|
||||
$parser->match('(');
|
||||
$this->_firstSimpleArithmeticExpression = $parser->SimpleArithmeticExpression();
|
||||
|
||||
$this->firstSimpleArithmeticExpression = $parser->SimpleArithmeticExpression();
|
||||
|
||||
$parser->match(',');
|
||||
$this->_secondSimpleArithmeticExpression = $parser->SimpleArithmeticExpression();
|
||||
|
||||
$this->secondSimpleArithmeticExpression = $parser->SimpleArithmeticExpression();
|
||||
|
||||
$parser->match(')');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,30 +24,26 @@ namespace Doctrine\ORM\Query\AST\Functions;
|
|||
/**
|
||||
* "SIZE" "(" CollectionValuedPathExpression ")"
|
||||
*
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision: 3938 $
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class SizeFunction extends FunctionNode
|
||||
{
|
||||
private $_collectionPathExpression;
|
||||
|
||||
public function getCollectionPathExpression()
|
||||
{
|
||||
return $this->_collectionPathExpression;
|
||||
}
|
||||
|
||||
public function setCollectionPathExpression($collPathExpr)
|
||||
{
|
||||
$this->_collectionPathExpression = $collPathExpr;
|
||||
}
|
||||
public $collectionPathExpression;
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
|
||||
{
|
||||
$dqlAlias = $this->_collectionPathExpression->getIdentificationVariable();
|
||||
$dqlAlias = $this->collectionPathExpression->identificationVariable;
|
||||
$qComp = $sqlWalker->getQueryComponent($dqlAlias);
|
||||
$parts = $this->_collectionPathExpression->getParts();
|
||||
$parts = $this->collectionPathExpression->parts;
|
||||
|
||||
$assoc = $qComp['metadata']->associationMappings[$parts[0]];
|
||||
|
||||
|
@ -80,9 +76,12 @@ class SizeFunction extends FunctionNode
|
|||
public function parse(\Doctrine\ORM\Query\Parser $parser)
|
||||
{
|
||||
$lexer = $parser->getLexer();
|
||||
|
||||
$parser->match($lexer->lookahead['value']);
|
||||
$parser->match('(');
|
||||
$this->_collectionPathExpression = $parser->CollectionValuedPathExpression();
|
||||
|
||||
$this->collectionPathExpression = $parser->CollectionValuedPathExpression();
|
||||
|
||||
$parser->match(')');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,22 @@
|
|||
<?php
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Query\AST\Functions;
|
||||
|
@ -9,16 +24,17 @@ namespace Doctrine\ORM\Query\AST\Functions;
|
|||
/**
|
||||
* "SQRT" "(" SimpleArithmeticExpression ")"
|
||||
*
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision: 3938 $
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class SqrtFunction extends FunctionNode
|
||||
{
|
||||
private $_simpleArithmeticExpression;
|
||||
|
||||
public function getSimpleArithmeticExpression()
|
||||
{
|
||||
return $this->_simpleArithmeticExpression;
|
||||
}
|
||||
public $simpleArithmeticExpression;
|
||||
|
||||
/**
|
||||
* @override
|
||||
|
@ -26,7 +42,7 @@ class SqrtFunction extends FunctionNode
|
|||
public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
|
||||
{
|
||||
//TODO: Use platform to get SQL
|
||||
return 'SQRT(' . $sqlWalker->walkSimpleArithmeticExpression($this->_simpleArithmeticExpression) . ')';
|
||||
return 'SQRT(' . $sqlWalker->walkSimpleArithmeticExpression($this->simpleArithmeticExpression) . ')';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -35,9 +51,12 @@ class SqrtFunction extends FunctionNode
|
|||
public function parse(\Doctrine\ORM\Query\Parser $parser)
|
||||
{
|
||||
$lexer = $parser->getLexer();
|
||||
|
||||
$parser->match($lexer->lookahead['value']);
|
||||
$parser->match('(');
|
||||
$this->_simpleArithmeticExpression = $parser->SimpleArithmeticExpression();
|
||||
|
||||
$this->simpleArithmeticExpression = $parser->SimpleArithmeticExpression();
|
||||
|
||||
$parser->match(')');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,22 @@
|
|||
<?php
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Query\AST\Functions;
|
||||
|
@ -9,28 +24,19 @@ namespace Doctrine\ORM\Query\AST\Functions;
|
|||
/**
|
||||
* "SUBSTRING" "(" StringPrimary "," SimpleArithmeticExpression "," SimpleArithmeticExpression ")"
|
||||
*
|
||||
* @author robo
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision: 3938 $
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class SubstringFunction extends FunctionNode
|
||||
{
|
||||
private $_stringPrimary;
|
||||
private $_firstSimpleArithmeticExpression;
|
||||
private $_secondSimpleArithmeticExpression;
|
||||
|
||||
public function geStringPrimary()
|
||||
{
|
||||
return $this->_stringPrimary;
|
||||
}
|
||||
|
||||
public function getSecondSimpleArithmeticExpression()
|
||||
{
|
||||
return $this->_secondSimpleArithmeticExpression;
|
||||
}
|
||||
|
||||
public function getFirstSimpleArithmeticExpression()
|
||||
{
|
||||
return $this->_firstSimpleArithmeticExpression;
|
||||
}
|
||||
public $stringPrimary;
|
||||
public $firstSimpleArithmeticExpression;
|
||||
public $secondSimpleArithmeticExpression;
|
||||
|
||||
/**
|
||||
* @override
|
||||
|
@ -38,14 +44,13 @@ class SubstringFunction extends FunctionNode
|
|||
public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
|
||||
{
|
||||
//TODO: Use platform to get SQL
|
||||
$sql = 'SUBSTRING(' .
|
||||
$sqlWalker->walkStringPrimary($this->_stringPrimary)
|
||||
. ', ' .
|
||||
$sqlWalker->walkSimpleArithmeticExpression($this->_firstSimpleArithmeticExpression)
|
||||
. ', ' .
|
||||
$sqlWalker->walkSimpleArithmeticExpression($this->_secondSimpleArithmeticExpression)
|
||||
. ')';
|
||||
return $sql;
|
||||
return 'SUBSTRING('
|
||||
. $sqlWalker->walkStringPrimary($this->stringPrimary)
|
||||
. ', '
|
||||
. $sqlWalker->walkSimpleArithmeticExpression($this->firstSimpleArithmeticExpression)
|
||||
. ', '
|
||||
. $sqlWalker->walkSimpleArithmeticExpression($this->secondSimpleArithmeticExpression)
|
||||
. ')';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -54,14 +59,18 @@ class SubstringFunction extends FunctionNode
|
|||
public function parse(\Doctrine\ORM\Query\Parser $parser)
|
||||
{
|
||||
$lexer = $parser->getLexer();
|
||||
|
||||
$parser->match($lexer->lookahead['value']);
|
||||
$parser->match('(');
|
||||
|
||||
$this->_stringPrimary = $parser->StringPrimary();
|
||||
$this->stringPrimary = $parser->StringPrimary();
|
||||
|
||||
$parser->match(',');
|
||||
$this->_firstSimpleArithmeticExpression = $parser->SimpleArithmeticExpression();
|
||||
|
||||
$this->firstSimpleArithmeticExpression = $parser->SimpleArithmeticExpression();
|
||||
$parser->match(',');
|
||||
$this->_secondSimpleArithmeticExpression = $parser->SimpleArithmeticExpression();
|
||||
|
||||
$this->secondSimpleArithmeticExpression = $parser->SimpleArithmeticExpression();
|
||||
|
||||
$parser->match(')');
|
||||
}
|
||||
|
|
|
@ -1,7 +1,22 @@
|
|||
<?php
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Query\AST\Functions;
|
||||
|
@ -11,60 +26,21 @@ use Doctrine\ORM\Query\Lexer;
|
|||
/**
|
||||
* "TRIM" "(" [["LEADING" | "TRAILING" | "BOTH"] [char] "FROM"] StringPrimary ")"
|
||||
*
|
||||
* @author robo
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision: 3938 $
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class TrimFunction extends FunctionNode
|
||||
{
|
||||
private $_leading;
|
||||
private $_trailing;
|
||||
private $_both;
|
||||
private $_trimChar;
|
||||
private $_stringPrimary;
|
||||
|
||||
public function getStringPrimary()
|
||||
{
|
||||
return $this->_stringPrimary;
|
||||
}
|
||||
|
||||
public function isLeading()
|
||||
{
|
||||
return $this->_leading;
|
||||
}
|
||||
|
||||
public function setLeading($bool)
|
||||
{
|
||||
$this->_leading = $bool;
|
||||
}
|
||||
|
||||
public function isTrailing()
|
||||
{
|
||||
return $this->_trailing;
|
||||
}
|
||||
|
||||
public function setTrailing($bool)
|
||||
{
|
||||
$this->_trailing = $bool;
|
||||
}
|
||||
|
||||
public function isBoth()
|
||||
{
|
||||
return $this->_both;
|
||||
}
|
||||
|
||||
public function setBoth($bool)
|
||||
{
|
||||
$this->_both = $bool;
|
||||
}
|
||||
|
||||
public function getTrimChar()
|
||||
{
|
||||
return $this->_trimChar;
|
||||
}
|
||||
|
||||
public function setTrimChar($trimChar)
|
||||
{
|
||||
$this->_trimChar = $trimChar;
|
||||
}
|
||||
public $leading;
|
||||
public $trailing;
|
||||
public $both;
|
||||
public $trimChar;
|
||||
public $stringPrimary;
|
||||
|
||||
/**
|
||||
* @override
|
||||
|
@ -72,13 +48,20 @@ class TrimFunction extends FunctionNode
|
|||
public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
|
||||
{
|
||||
$sql = 'TRIM(';
|
||||
if ($this->_leading) $sql .= 'LEADING ';
|
||||
else if ($this->_trailing) $sql .= 'TRAILING ';
|
||||
else if ($this->_both) $sql .= 'BOTH ';
|
||||
if ($this->_trimChar) $sql .= $sqlWalker->getConnection()->quote($this->_trimChar) . ' ';
|
||||
$sql .= 'FROM ' . $sqlWalker->walkStringPrimary($this->_stringPrimary);
|
||||
$sql .= ')';
|
||||
return $sql;
|
||||
|
||||
if ($this->leading) {
|
||||
$sql .= 'LEADING ';
|
||||
} else if ($this->trailing) {
|
||||
$sql .= 'TRAILING ';
|
||||
} else if ($this->both) {
|
||||
$sql .= 'BOTH ';
|
||||
}
|
||||
|
||||
if ($this->trimChar) {
|
||||
$sql .= $sqlWalker->getConnection()->quote($this->trimChar) . ' ';
|
||||
}
|
||||
|
||||
return $sql . 'FROM ' . $sqlWalker->walkStringPrimary($this->stringPrimary) . ')';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -87,30 +70,31 @@ class TrimFunction extends FunctionNode
|
|||
public function parse(\Doctrine\ORM\Query\Parser $parser)
|
||||
{
|
||||
$lexer = $parser->getLexer();
|
||||
|
||||
$parser->match($lexer->lookahead['value']);
|
||||
$parser->match('(');
|
||||
|
||||
if (strcasecmp('leading', $lexer->lookahead['value']) === 0) {
|
||||
$parser->match($lexer->lookahead['value']);
|
||||
$this->_leading = true;
|
||||
$this->leading = true;
|
||||
} else if (strcasecmp('trailing', $lexer->lookahead['value']) === 0) {
|
||||
$parser->match($lexer->lookahead['value']);
|
||||
$this->_trailing = true;
|
||||
$this->trailing = true;
|
||||
} else if (strcasecmp('both', $lexer->lookahead['value']) === 0) {
|
||||
$parser->match($lexer->lookahead['value']);
|
||||
$this->_both = true;
|
||||
$this->both = true;
|
||||
}
|
||||
|
||||
if ($lexer->isNextToken(Lexer::T_STRING)) {
|
||||
$parser->match(Lexer::T_STRING);
|
||||
$this->_trimChar = $lexer->token['value'];
|
||||
$this->trimChar = $lexer->token['value'];
|
||||
}
|
||||
|
||||
if ($this->_leading || $this->_trailing || $this->_both || $this->_trimChar) {
|
||||
if ($this->leading || $this->trailing || $this->both || $this->trimChar) {
|
||||
$parser->match(Lexer::T_FROM);
|
||||
}
|
||||
|
||||
$this->_stringPrimary = $parser->StringPrimary();
|
||||
$this->stringPrimary = $parser->StringPrimary();
|
||||
|
||||
$parser->match(')');
|
||||
}
|
||||
|
|
|
@ -1,7 +1,22 @@
|
|||
<?php
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Query\AST\Functions;
|
||||
|
@ -9,16 +24,17 @@ namespace Doctrine\ORM\Query\AST\Functions;
|
|||
/**
|
||||
* "UPPER" "(" StringPrimary ")"
|
||||
*
|
||||
* @author robo
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision: 3938 $
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class UpperFunction extends FunctionNode
|
||||
{
|
||||
private $_stringPrimary;
|
||||
|
||||
public function getStringPrimary()
|
||||
{
|
||||
return $this->_stringPrimary;
|
||||
}
|
||||
public $stringPrimary;
|
||||
|
||||
/**
|
||||
* @override
|
||||
|
@ -26,7 +42,7 @@ 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 'UPPER(' . $sqlWalker->walkStringPrimary($this->stringPrimary) . ')';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -35,9 +51,12 @@ class UpperFunction extends FunctionNode
|
|||
public function parse(\Doctrine\ORM\Query\Parser $parser)
|
||||
{
|
||||
$lexer = $parser->getLexer();
|
||||
|
||||
$parser->match($lexer->lookahead['value']);
|
||||
$parser->match('(');
|
||||
$this->_stringPrimary = $parser->StringPrimary();
|
||||
|
||||
$this->stringPrimary = $parser->StringPrimary();
|
||||
|
||||
$parser->match(')');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,22 @@
|
|||
<?php
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Query\AST;
|
||||
|
@ -9,20 +24,21 @@ namespace Doctrine\ORM\Query\AST;
|
|||
/**
|
||||
* Description of GroupByClause
|
||||
*
|
||||
* @author robo
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision: 3938 $
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class GroupByClause extends Node
|
||||
{
|
||||
private $_groupByItems = array();
|
||||
public $groupByItems = array();
|
||||
|
||||
public function __construct(array $groupByItems)
|
||||
{
|
||||
$this->_groupByItems = $groupByItems;
|
||||
}
|
||||
|
||||
public function getGroupByItems()
|
||||
{
|
||||
return $this->_groupByItems;
|
||||
$this->groupByItems = $groupByItems;
|
||||
}
|
||||
|
||||
public function dispatch($sqlWalker)
|
||||
|
|
|
@ -1,7 +1,22 @@
|
|||
<?php
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Query\AST;
|
||||
|
@ -9,20 +24,21 @@ namespace Doctrine\ORM\Query\AST;
|
|||
/**
|
||||
* Description of HavingClause
|
||||
*
|
||||
* @author robo
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision: 3938 $
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class HavingClause extends Node
|
||||
{
|
||||
private $_conditionalExpression;
|
||||
public $conditionalExpression;
|
||||
|
||||
public function __construct($conditionalExpression)
|
||||
{
|
||||
$this->_conditionalExpression = $conditionalExpression;
|
||||
}
|
||||
|
||||
public function getConditionalExpression()
|
||||
{
|
||||
return $this->_conditionalExpression;
|
||||
$this->conditionalExpression = $conditionalExpression;
|
||||
}
|
||||
|
||||
public function dispatch($sqlWalker)
|
||||
|
|
|
@ -24,45 +24,27 @@ namespace Doctrine\ORM\Query\AST;
|
|||
/**
|
||||
* IdentificationVariableDeclaration ::= RangeVariableDeclaration [IndexBy] {JoinVariableDeclaration}*
|
||||
*
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link http://www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision$
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision: 3938 $
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class IdentificationVariableDeclaration extends Node
|
||||
{
|
||||
protected $_rangeVariableDeclaration = null;
|
||||
|
||||
protected $_indexBy = null;
|
||||
|
||||
protected $_joinVariableDeclarations = array();
|
||||
public $rangeVariableDeclaration = null;
|
||||
public $indexBy = null;
|
||||
public $joinVariableDeclarations = array();
|
||||
|
||||
public function __construct($rangeVariableDecl, $indexBy, array $joinVariableDecls)
|
||||
{
|
||||
$this->_rangeVariableDeclaration = $rangeVariableDecl;
|
||||
$this->_indexBy = $indexBy;
|
||||
$this->_joinVariableDeclarations = $joinVariableDecls;
|
||||
$this->rangeVariableDeclaration = $rangeVariableDecl;
|
||||
$this->indexBy = $indexBy;
|
||||
$this->joinVariableDeclarations = $joinVariableDecls;
|
||||
}
|
||||
|
||||
/* Getters */
|
||||
public function getRangeVariableDeclaration()
|
||||
{
|
||||
return $this->_rangeVariableDeclaration;
|
||||
}
|
||||
|
||||
|
||||
public function getIndexBy()
|
||||
{
|
||||
return $this->_indexBy;
|
||||
}
|
||||
|
||||
|
||||
public function getJoinVariableDeclarations()
|
||||
{
|
||||
return $this->_joinVariableDeclarations;
|
||||
}
|
||||
|
||||
public function dispatch($sqlWalker)
|
||||
{
|
||||
return $sqlWalker->walkIdentificationVariableDeclaration($this);
|
||||
|
|
|
@ -1,7 +1,22 @@
|
|||
<?php
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Query\AST;
|
||||
|
@ -9,53 +24,24 @@ namespace Doctrine\ORM\Query\AST;
|
|||
/**
|
||||
* InExpression ::= StateFieldPathExpression ["NOT"] "IN" "(" (Literal {"," Literal}* | Subselect) ")"
|
||||
*
|
||||
* @author robo
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision: 3938 $
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class InExpression extends Node
|
||||
{
|
||||
private $_pathExpression;
|
||||
private $_not = false;
|
||||
private $_literals = array();
|
||||
private $_subselect;
|
||||
public $not;
|
||||
public $pathExpression;
|
||||
public $literals = array();
|
||||
public $subselect;
|
||||
|
||||
public function __construct($pathExpression)
|
||||
{
|
||||
$this->_pathExpression = $pathExpression;
|
||||
}
|
||||
|
||||
public function setLiterals(array $literals)
|
||||
{
|
||||
$this->_literals = $literals;
|
||||
}
|
||||
|
||||
public function getLiterals()
|
||||
{
|
||||
return $this->_literals;
|
||||
}
|
||||
|
||||
public function setSubselect($subselect)
|
||||
{
|
||||
$this->_subselect = $subselect;
|
||||
}
|
||||
|
||||
public function getSubselect()
|
||||
{
|
||||
return $this->_subselect;
|
||||
}
|
||||
|
||||
public function setNot($bool)
|
||||
{
|
||||
$this->_not = $bool;
|
||||
}
|
||||
|
||||
public function isNot()
|
||||
{
|
||||
return $this->_not;
|
||||
}
|
||||
|
||||
public function getPathExpression()
|
||||
{
|
||||
return $this->_pathExpression;
|
||||
$this->pathExpression = $pathExpression;
|
||||
}
|
||||
|
||||
public function dispatch($sqlWalker)
|
||||
|
|
|
@ -24,27 +24,23 @@ namespace Doctrine\ORM\Query\AST;
|
|||
/**
|
||||
* IndexBy ::= "INDEX" "BY" SimpleStateFieldPathExpression
|
||||
*
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link http://www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision$
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision: 3938 $
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class IndexBy extends Node
|
||||
{
|
||||
protected $_simpleStateFieldPathExpression = null;
|
||||
public $simpleStateFieldPathExpression = null;
|
||||
|
||||
public function __construct($simpleStateFieldPathExpression)
|
||||
{
|
||||
$this->_simpleStateFieldPathExpression = $simpleStateFieldPathExpression;
|
||||
$this->simpleStateFieldPathExpression = $simpleStateFieldPathExpression;
|
||||
}
|
||||
|
||||
/* Getters */
|
||||
public function getSimpleStateFieldPathExpression()
|
||||
{
|
||||
return $this->_simpleStateFieldPathExpression;
|
||||
}
|
||||
|
||||
public function dispatch($sqlWalker)
|
||||
{
|
||||
return $sqlWalker->walkIndexBy($this);
|
||||
|
|
|
@ -1,7 +1,22 @@
|
|||
<?php
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Query\AST;
|
||||
|
@ -9,13 +24,18 @@ namespace Doctrine\ORM\Query\AST;
|
|||
/**
|
||||
* Description of InputParameter
|
||||
*
|
||||
* @author robo
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision: 3938 $
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class InputParameter extends Node
|
||||
{
|
||||
private $_isNamed;
|
||||
private $_position;
|
||||
private $_name;
|
||||
public $isNamed;
|
||||
public $name;
|
||||
|
||||
public function __construct($value)
|
||||
{
|
||||
|
@ -24,32 +44,8 @@ class InputParameter extends Node
|
|||
}
|
||||
|
||||
$param = substr($value, 1);
|
||||
$this->_isNamed = ! is_numeric($param);
|
||||
if ($this->_isNamed) {
|
||||
$this->_name = $param;
|
||||
} else {
|
||||
$this->_position = $param;
|
||||
}
|
||||
}
|
||||
|
||||
public function isNamed()
|
||||
{
|
||||
return $this->_isNamed;
|
||||
}
|
||||
|
||||
public function isPositional()
|
||||
{
|
||||
return ! $this->_isNamed;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return $this->_name;
|
||||
}
|
||||
|
||||
public function getPosition()
|
||||
{
|
||||
return $this->_position;
|
||||
$this->isNamed = ! is_numeric($param);
|
||||
$this->name = $param;
|
||||
}
|
||||
|
||||
public function dispatch($sqlWalker)
|
||||
|
|
|
@ -25,11 +25,13 @@ namespace Doctrine\ORM\Query\AST;
|
|||
* Join ::= ["LEFT" ["OUTER"] | "INNER"] "JOIN" JoinAssociationPathExpression
|
||||
* ["AS"] AliasIdentificationVariable [("ON" | "WITH") ConditionalExpression]
|
||||
*
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link http://www.phpdoctrine.org
|
||||
* @since 2.0
|
||||
* @version $Revision$
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision: 3938 $
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class Join extends Node
|
||||
{
|
||||
|
@ -39,57 +41,19 @@ class Join extends Node
|
|||
const JOIN_WHERE_ON = 1;
|
||||
const JOIN_WHERE_WITH = 2;
|
||||
|
||||
protected $_joinType = self::JOIN_TYPE_INNER;
|
||||
protected $_joinAssociationPathExpression = null;
|
||||
protected $_aliasIdentificationVariable = null;
|
||||
protected $_whereType = self::JOIN_WHERE_WITH;
|
||||
protected $_conditionalExpression = null;
|
||||
public $joinType = self::JOIN_TYPE_INNER;
|
||||
public $joinAssociationPathExpression = null;
|
||||
public $aliasIdentificationVariable = null;
|
||||
public $whereType = self::JOIN_WHERE_WITH;
|
||||
public $conditionalExpression = null;
|
||||
|
||||
public function __construct($joinType, $joinAssocPathExpr, $aliasIdentVar)
|
||||
{
|
||||
$this->_joinType = $joinType;
|
||||
$this->_joinAssociationPathExpression = $joinAssocPathExpr;
|
||||
$this->_aliasIdentificationVariable = $aliasIdentVar;
|
||||
$this->joinType = $joinType;
|
||||
$this->joinAssociationPathExpression = $joinAssocPathExpr;
|
||||
$this->aliasIdentificationVariable = $aliasIdentVar;
|
||||
}
|
||||
|
||||
/* Setters */
|
||||
|
||||
public function setWhereType($whereType)
|
||||
{
|
||||
$this->_whereType = $whereType;
|
||||
}
|
||||
|
||||
public function setConditionalExpression($conditionalExpression)
|
||||
{
|
||||
$this->_conditionalExpression = $conditionalExpression;
|
||||
}
|
||||
|
||||
/* Getters */
|
||||
public function getJoinType()
|
||||
{
|
||||
return $this->_joinType;
|
||||
}
|
||||
|
||||
public function getJoinAssociationPathExpression()
|
||||
{
|
||||
return $this->_joinAssociationPathExpression;
|
||||
}
|
||||
|
||||
public function getAliasIdentificationVariable()
|
||||
{
|
||||
return $this->_aliasIdentificationVariable;
|
||||
}
|
||||
|
||||
public function getWhereType()
|
||||
{
|
||||
return $this->_whereType;
|
||||
}
|
||||
|
||||
public function getConditionalExpression()
|
||||
{
|
||||
return $this->_conditionalExpression;
|
||||
}
|
||||
|
||||
public function dispatch($sqlWalker)
|
||||
{
|
||||
return $sqlWalker->walkJoin($this);
|
||||
|
|
|
@ -1,32 +1,46 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Query\AST;
|
||||
|
||||
/**
|
||||
* JoinAssociationPathExpression ::= IdentificationVariable "." (SingleValuedAssociationField | CollectionValuedAssociationField)
|
||||
*
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Roman Borschel
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision: 3938 $
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class JoinAssociationPathExpression extends Node
|
||||
{
|
||||
private $_identificationVariable;
|
||||
private $_assocField;
|
||||
public $identificationVariable;
|
||||
public $associationField;
|
||||
|
||||
public function __construct($identificationVariable, $assocField)
|
||||
public function __construct($identificationVariable, $associationField)
|
||||
{
|
||||
$this->_identificationVariable = $identificationVariable;
|
||||
$this->_assocField = $assocField;
|
||||
}
|
||||
|
||||
public function getIdentificationVariable()
|
||||
{
|
||||
return $this->_identificationVariable;
|
||||
}
|
||||
|
||||
public function getAssociationField()
|
||||
{
|
||||
return $this->_assocField;
|
||||
$this->identificationVariable = $identificationVariable;
|
||||
$this->associationField = $associationField;
|
||||
}
|
||||
|
||||
public function dispatch($sqlWalker)
|
||||
|
|
|
@ -24,34 +24,25 @@ namespace Doctrine\ORM\Query\AST;
|
|||
/**
|
||||
* JoinVariableDeclaration ::= Join [IndexBy]
|
||||
*
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link http://www.phpdoctrine.org
|
||||
* @since 2.0
|
||||
* @version $Revision$
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision: 3938 $
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class JoinVariableDeclaration extends Node
|
||||
{
|
||||
protected $_join = null;
|
||||
protected $_indexBy = null;
|
||||
public $join = null;
|
||||
public $indexBy = null;
|
||||
|
||||
public function __construct($join, $indexBy)
|
||||
{
|
||||
$this->_join = $join;
|
||||
$this->_indexBy = $indexBy;
|
||||
$this->join = $join;
|
||||
$this->indexBy = $indexBy;
|
||||
}
|
||||
|
||||
/* Getters */
|
||||
public function getJoin()
|
||||
{
|
||||
return $this->_join;
|
||||
}
|
||||
|
||||
public function getIndexBy()
|
||||
{
|
||||
return $this->_indexBy;
|
||||
}
|
||||
|
||||
public function dispatch($sqlWalker)
|
||||
{
|
||||
return $sqlWalker->walkJoinVariableDeclaration($this);
|
||||
|
|
|
@ -1,7 +1,22 @@
|
|||
<?php
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Query\AST;
|
||||
|
@ -9,41 +24,26 @@ namespace Doctrine\ORM\Query\AST;
|
|||
/**
|
||||
* LikeExpression ::= StringExpression ["NOT"] "LIKE" string ["ESCAPE" char]
|
||||
*
|
||||
* @author robo
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision: 3938 $
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class LikeExpression extends Node
|
||||
{
|
||||
private $_stringExpr;
|
||||
private $_isNot;
|
||||
private $_stringPattern;
|
||||
private $_escapeChar;
|
||||
public $not;
|
||||
public $stringExpression;
|
||||
public $stringPattern;
|
||||
public $escapeChar;
|
||||
|
||||
public function __construct($stringExpr, $stringPattern, $isNot = false, $escapeChar = null)
|
||||
public function __construct($stringExpression, $stringPattern, $escapeChar = null)
|
||||
{
|
||||
$this->_stringExpr = $stringExpr;
|
||||
$this->_stringPattern = $stringPattern;
|
||||
$this->_isNot = $isNot;
|
||||
$this->_escapeChar = $escapeChar;
|
||||
}
|
||||
|
||||
public function isNot()
|
||||
{
|
||||
return $this->_isNot;
|
||||
}
|
||||
|
||||
public function getStringExpression()
|
||||
{
|
||||
return $this->_stringExpr;
|
||||
}
|
||||
|
||||
public function getStringPattern()
|
||||
{
|
||||
return $this->_stringPattern;
|
||||
}
|
||||
|
||||
public function getEscapeChar()
|
||||
{
|
||||
return $this->_escapeChar;
|
||||
$this->stringExpression = $stringExpression;
|
||||
$this->stringPattern = $stringPattern;
|
||||
$this->escapeChar = $escapeChar;
|
||||
}
|
||||
|
||||
public function dispatch($sqlWalker)
|
||||
|
|
|
@ -24,13 +24,13 @@ namespace Doctrine\ORM\Query\AST;
|
|||
/**
|
||||
* Abstract class of an AST node
|
||||
*
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Janne Vanhala <jpvanhal@cc.hut.fi>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link http://www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision$
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision: 3938 $
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
abstract class Node
|
||||
{
|
||||
|
|
|
@ -1,7 +1,22 @@
|
|||
<?php
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Query\AST;
|
||||
|
@ -9,31 +24,22 @@ namespace Doctrine\ORM\Query\AST;
|
|||
/**
|
||||
* NullComparisonExpression ::= (SingleValuedPathExpression | InputParameter) "IS" ["NOT"] "NULL"
|
||||
*
|
||||
* @author robo
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision: 3938 $
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class NullComparisonExpression extends Node
|
||||
{
|
||||
private $_expression;
|
||||
private $_not;
|
||||
|
||||
public $not;
|
||||
public $expression;
|
||||
|
||||
public function __construct($expression)
|
||||
{
|
||||
$this->_expression = $expression;
|
||||
}
|
||||
|
||||
public function getExpression()
|
||||
{
|
||||
return $this->_expression;
|
||||
}
|
||||
|
||||
public function setNot($bool)
|
||||
{
|
||||
$this->_not = $bool;
|
||||
}
|
||||
|
||||
public function isNot()
|
||||
{
|
||||
return $this->_not;
|
||||
$this->expression = $expression;
|
||||
}
|
||||
|
||||
public function dispatch($sqlWalker)
|
||||
|
|
|
@ -1,7 +1,22 @@
|
|||
<?php
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Query\AST;
|
||||
|
@ -9,20 +24,21 @@ namespace Doctrine\ORM\Query\AST;
|
|||
/**
|
||||
* OrderByClause ::= "ORDER" "BY" OrderByItem {"," OrderByItem}*
|
||||
*
|
||||
* @author robo
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision: 3938 $
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class OrderByClause extends Node
|
||||
{
|
||||
private $_orderByItems = array();
|
||||
public $orderByItems = array();
|
||||
|
||||
public function __construct(array $orderByItems)
|
||||
{
|
||||
$this->_orderByItems = $orderByItems;
|
||||
}
|
||||
|
||||
public function getOrderByItems()
|
||||
{
|
||||
return $this->_orderByItems;
|
||||
$this->orderByItems = $orderByItems;
|
||||
}
|
||||
|
||||
public function dispatch($sqlWalker)
|
||||
|
|
|
@ -22,48 +22,34 @@
|
|||
namespace Doctrine\ORM\Query\AST;
|
||||
|
||||
/**
|
||||
* AST node for the following grammar rule:
|
||||
*
|
||||
* OrderByItem ::= (ResultVariable | StateFieldPathExpression) ["ASC" | "DESC"]
|
||||
*
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
* @since 2.0
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision: 3938 $
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class OrderByItem extends Node
|
||||
{
|
||||
private $_expr;
|
||||
private $_asc;
|
||||
private $_desc;
|
||||
|
||||
public function __construct($expr)
|
||||
public $expression;
|
||||
public $type;
|
||||
|
||||
public function __construct($expression)
|
||||
{
|
||||
$this->_expr = $expr;
|
||||
}
|
||||
|
||||
public function getExpression()
|
||||
{
|
||||
return $this->_expr;
|
||||
}
|
||||
|
||||
public function setAsc($bool)
|
||||
{
|
||||
$this->_asc = $bool;
|
||||
$this->expression = $expression;
|
||||
}
|
||||
|
||||
public function isAsc()
|
||||
{
|
||||
return $this->_asc;
|
||||
}
|
||||
|
||||
public function setDesc($bool)
|
||||
{
|
||||
$this->_desc = $bool;
|
||||
return strtoupper($this->type) == 'ASC';
|
||||
}
|
||||
|
||||
public function isDesc()
|
||||
{
|
||||
return $this->_desc;
|
||||
return strtoupper($this->type) == 'DESC';
|
||||
}
|
||||
|
||||
public function dispatch($sqlWalker)
|
||||
|
|
|
@ -1,28 +1,43 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Query\AST;
|
||||
|
||||
/**
|
||||
* AST node for the following path expressions:
|
||||
*
|
||||
* AssociationPathExpression ::= CollectionValuedPathExpression | SingleValuedAssociationPathExpression
|
||||
*
|
||||
* SingleValuedPathExpression ::= StateFieldPathExpression | SingleValuedAssociationPathExpression
|
||||
*
|
||||
* StateFieldPathExpression ::= SimpleStateFieldPathExpression | SimpleStateFieldAssociationPathExpression
|
||||
*
|
||||
* SingleValuedAssociationPathExpression ::= IdentificationVariable "." {SingleValuedAssociationField "."}* SingleValuedAssociationField
|
||||
*
|
||||
* CollectionValuedPathExpression ::= IdentificationVariable "." {SingleValuedAssociationField "."}* CollectionValuedAssociationField
|
||||
*
|
||||
* StateField ::= {EmbeddedClassStateField "."}* SimpleStateField
|
||||
*
|
||||
* SimpleStateFieldPathExpression ::= IdentificationVariable "." StateField
|
||||
*
|
||||
* SimpleStateFieldAssociationPathExpression ::= SingleValuedAssociationPathExpression "." StateField
|
||||
*
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
* @since 2.0
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision: 3938 $
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class PathExpression extends Node
|
||||
{
|
||||
|
@ -30,54 +45,21 @@ class PathExpression extends Node
|
|||
const TYPE_SINGLE_VALUED_ASSOCIATION = 4;
|
||||
const TYPE_STATE_FIELD = 8;
|
||||
|
||||
private $_type;
|
||||
private $_expectedType;
|
||||
private $_identificationVariable;
|
||||
private $_parts;
|
||||
public $type;
|
||||
public $expectedType;
|
||||
public $identificationVariable;
|
||||
public $parts;
|
||||
|
||||
public function __construct($expectedType, $identificationVariable, array $parts)
|
||||
{
|
||||
$this->_expectedType = $expectedType;
|
||||
$this->_identificationVariable = $identificationVariable;
|
||||
$this->_parts = $parts;
|
||||
}
|
||||
|
||||
public function getIdentificationVariable()
|
||||
{
|
||||
return $this->_identificationVariable;
|
||||
}
|
||||
|
||||
public function getParts()
|
||||
{
|
||||
return $this->_parts;
|
||||
}
|
||||
|
||||
public function setExpectedType($type)
|
||||
{
|
||||
$this->_expectedType;
|
||||
}
|
||||
|
||||
public function getExpectedType()
|
||||
{
|
||||
return $this->_expectedType;
|
||||
}
|
||||
|
||||
/**
|
||||
* INTERNAL
|
||||
*/
|
||||
public function setType($type)
|
||||
{
|
||||
$this->_type = $type;
|
||||
}
|
||||
|
||||
public function getType()
|
||||
{
|
||||
return $this->_type;
|
||||
$this->expectedType = $expectedType;
|
||||
$this->identificationVariable = $identificationVariable;
|
||||
$this->parts = $parts;
|
||||
}
|
||||
|
||||
public function dispatch($walker)
|
||||
{
|
||||
switch ($this->_type) {
|
||||
switch ($this->type) {
|
||||
case self::TYPE_STATE_FIELD:
|
||||
return $walker->walkStateFieldPathExpression($this);
|
||||
case self::TYPE_SINGLE_VALUED_ASSOCIATION:
|
||||
|
|
|
@ -1,7 +1,22 @@
|
|||
<?php
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Query\AST;
|
||||
|
@ -9,18 +24,22 @@ namespace Doctrine\ORM\Query\AST;
|
|||
/**
|
||||
* QuantifiedExpression ::= ("ALL" | "ANY" | "SOME") "(" Subselect ")"
|
||||
*
|
||||
* @author robo
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision: 3938 $
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class QuantifiedExpression extends Node
|
||||
{
|
||||
private $_all;
|
||||
private $_any;
|
||||
private $_some;
|
||||
private $_subselect;
|
||||
public $type;
|
||||
public $subselect;
|
||||
|
||||
public function __construct($subselect)
|
||||
{
|
||||
$this->_subselect = $subselect;
|
||||
$this->subselect = $subselect;
|
||||
}
|
||||
|
||||
public function getSubselect()
|
||||
|
@ -30,32 +49,17 @@ class QuantifiedExpression extends Node
|
|||
|
||||
public function isAll()
|
||||
{
|
||||
return $this->_all;
|
||||
return strtoupper($this->type) == 'ALL';
|
||||
}
|
||||
|
||||
public function isAny()
|
||||
{
|
||||
return $this->_any;
|
||||
return strtoupper($this->type) == 'ANY';
|
||||
}
|
||||
|
||||
public function isSome()
|
||||
{
|
||||
return $this->_some;
|
||||
}
|
||||
|
||||
public function setAll($bool)
|
||||
{
|
||||
$this->_all = $bool;
|
||||
}
|
||||
|
||||
public function setAny($bool)
|
||||
{
|
||||
$this->_any = $bool;
|
||||
}
|
||||
|
||||
public function setSome($bool)
|
||||
{
|
||||
$this->_some = $bool;
|
||||
return strtoupper($this->type) == 'SOME';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -24,41 +24,27 @@ namespace Doctrine\ORM\Query\AST;
|
|||
/**
|
||||
* RangeVariableDeclaration ::= AbstractSchemaName ["AS"] AliasIdentificationVariable
|
||||
*
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link http://www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision$
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision: 3938 $
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class RangeVariableDeclaration extends Node
|
||||
{
|
||||
private $_classMetadata;
|
||||
private $_abstractSchemaName;
|
||||
private $_aliasIdentificationVariable;
|
||||
public $classMetadata;
|
||||
public $abstractSchemaName;
|
||||
public $aliasIdentificationVariable;
|
||||
|
||||
public function __construct($classMetadata, $aliasIdentificationVar)
|
||||
{
|
||||
$this->_classMetadata = $classMetadata;
|
||||
$this->_abstractSchemaName = $classMetadata->name;
|
||||
$this->_aliasIdentificationVariable = $aliasIdentificationVar;
|
||||
$this->classMetadata = $classMetadata;
|
||||
$this->abstractSchemaName = $classMetadata->name;
|
||||
$this->aliasIdentificationVariable = $aliasIdentificationVar;
|
||||
}
|
||||
|
||||
/* Getters */
|
||||
public function getAbstractSchemaName()
|
||||
{
|
||||
return $this->_abstractSchemaName;
|
||||
}
|
||||
|
||||
public function getAliasIdentificationVariable()
|
||||
{
|
||||
return $this->_aliasIdentificationVariable;
|
||||
}
|
||||
|
||||
public function getClassMetadata()
|
||||
{
|
||||
return $this->_classMetadata;
|
||||
}
|
||||
|
||||
public function dispatch($walker)
|
||||
{
|
||||
return $walker->walkRangeVariableDeclaration($this);
|
||||
|
|
|
@ -24,52 +24,25 @@ namespace Doctrine\ORM\Query\AST;
|
|||
/**
|
||||
* SelectClause = "SELECT" ["DISTINCT"] SelectExpression {"," SelectExpression}
|
||||
*
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link http://www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision$
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision: 3938 $
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class SelectClause extends Node
|
||||
{
|
||||
protected $_isDistinct;
|
||||
|
||||
protected $_selectExpressions = array();
|
||||
public $isDistinct;
|
||||
public $selectExpressions = array();
|
||||
|
||||
public function __construct(array $selectExpressions, $isDistinct)
|
||||
{
|
||||
$this->_isDistinct = $isDistinct;
|
||||
$this->_selectExpressions = $selectExpressions;
|
||||
$this->isDistinct = $isDistinct;
|
||||
$this->selectExpressions = $selectExpressions;
|
||||
}
|
||||
|
||||
/* Getters */
|
||||
public function isDistinct()
|
||||
{
|
||||
return $this->_isDistinct;
|
||||
}
|
||||
|
||||
public function getSelectExpressions()
|
||||
{
|
||||
return $this->_selectExpressions;
|
||||
}
|
||||
|
||||
/* REMOVE ME LATER. COPIED METHODS FROM SPLIT OF PRODUCTION INTO "AST" AND "PARSER" */
|
||||
public function buildSql()
|
||||
{
|
||||
return 'SELECT ' . (($this->_isDistinct) ? 'DISTINCT ' : '')
|
||||
. implode(', ', $this->_mapSelectExpressions());
|
||||
}
|
||||
|
||||
protected function _mapSelectExpressions()
|
||||
{
|
||||
return array_map(array(&$this, '_mapSelectExpression'), $this->_selectExpressions);
|
||||
}
|
||||
|
||||
protected function _mapSelectExpression($value)
|
||||
{
|
||||
return is_object($value) ? $value->buildSql() : $value;
|
||||
}
|
||||
|
||||
public function dispatch($sqlWalker)
|
||||
{
|
||||
return $sqlWalker->walkSelectClause($this);
|
||||
|
|
|
@ -25,34 +25,25 @@ namespace Doctrine\ORM\Query\AST;
|
|||
* SelectExpression ::= IdentificationVariable ["." "*"] | StateFieldPathExpression |
|
||||
* (AggregateExpression | "(" Subselect ")") [["AS"] FieldAliasIdentificationVariable]
|
||||
*
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link http://www.phpdoctrine.org
|
||||
* @since 2.0
|
||||
* @version $Revision$
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision: 3938 $
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class SelectExpression extends Node
|
||||
{
|
||||
protected $_expression;
|
||||
protected $_fieldIdentificationVariable;
|
||||
public $expression;
|
||||
public $fieldIdentificationVariable;
|
||||
|
||||
public function __construct($expression, $fieldIdentificationVariable)
|
||||
{
|
||||
$this->_expression = $expression;
|
||||
$this->_fieldIdentificationVariable = $fieldIdentificationVariable;
|
||||
$this->expression = $expression;
|
||||
$this->fieldIdentificationVariable = $fieldIdentificationVariable;
|
||||
}
|
||||
|
||||
/* Getters */
|
||||
public function getExpression()
|
||||
{
|
||||
return $this->_expression;
|
||||
}
|
||||
|
||||
public function getFieldIdentificationVariable()
|
||||
{
|
||||
return $this->_fieldIdentificationVariable;
|
||||
}
|
||||
|
||||
public function dispatch($sqlWalker)
|
||||
{
|
||||
return $sqlWalker->walkSelectExpression($this);
|
||||
|
|
|
@ -24,62 +24,28 @@ namespace Doctrine\ORM\Query\AST;
|
|||
/**
|
||||
* SelectStatement = SelectClause FromClause [WhereClause] [GroupByClause] [HavingClause] [OrderByClause]
|
||||
*
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link http://www.phpdoctrine.org
|
||||
* @since 2.0
|
||||
* @version $Revision$
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision: 3938 $
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class SelectStatement extends Node
|
||||
{
|
||||
protected $_selectClause;
|
||||
protected $_fromClause;
|
||||
protected $_whereClause;
|
||||
protected $_groupByClause;
|
||||
protected $_havingClause;
|
||||
protected $_orderByClause;
|
||||
public $selectClause;
|
||||
public $fromClause;
|
||||
public $whereClause;
|
||||
public $groupByClause;
|
||||
public $havingClause;
|
||||
public $orderByClause;
|
||||
|
||||
public function __construct($selectClause, $fromClause, $whereClause, $groupByClause,
|
||||
$havingClause, $orderByClause) {
|
||||
$this->_selectClause = $selectClause;
|
||||
$this->_fromClause = $fromClause;
|
||||
$this->_whereClause = $whereClause;
|
||||
$this->_groupByClause = $groupByClause;
|
||||
$this->_havingClause = $havingClause;
|
||||
$this->_orderByClause = $orderByClause;
|
||||
public function __construct($selectClause, $fromClause) {
|
||||
$this->selectClause = $selectClause;
|
||||
$this->fromClause = $fromClause;
|
||||
}
|
||||
|
||||
/* Getters */
|
||||
public function getSelectClause()
|
||||
{
|
||||
return $this->_selectClause;
|
||||
}
|
||||
|
||||
public function getFromClause()
|
||||
{
|
||||
return $this->_fromClause;
|
||||
}
|
||||
|
||||
public function getWhereClause()
|
||||
{
|
||||
return $this->_whereClause;
|
||||
}
|
||||
|
||||
public function getGroupByClause()
|
||||
{
|
||||
return $this->_groupByClause;
|
||||
}
|
||||
|
||||
public function getHavingClause()
|
||||
{
|
||||
return $this->_havingClause;
|
||||
}
|
||||
|
||||
public function getOrderByClause()
|
||||
{
|
||||
return $this->_orderByClause;
|
||||
}
|
||||
|
||||
public function dispatch($sqlWalker)
|
||||
{
|
||||
return $sqlWalker->walkSelectStatement($this);
|
||||
|
|
|
@ -1,7 +1,22 @@
|
|||
<?php
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Query\AST;
|
||||
|
@ -9,20 +24,21 @@ namespace Doctrine\ORM\Query\AST;
|
|||
/**
|
||||
* SimpleArithmeticExpression ::= ArithmeticTerm {("+" | "-") ArithmeticTerm}*
|
||||
*
|
||||
* @author robo
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision: 3938 $
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class SimpleArithmeticExpression extends Node
|
||||
{
|
||||
private $_terms;
|
||||
public $arithmeticTerms = array();
|
||||
|
||||
public function __construct(array $arithmeticTerms)
|
||||
{
|
||||
$this->_terms = $arithmeticTerms;
|
||||
}
|
||||
|
||||
public function getArithmeticTerms()
|
||||
{
|
||||
return $this->_terms;
|
||||
$this->arithmeticTerms = $arithmeticTerms;
|
||||
}
|
||||
|
||||
public function dispatch($sqlWalker)
|
||||
|
|
|
@ -24,38 +24,25 @@ namespace Doctrine\ORM\Query\AST;
|
|||
/**
|
||||
* SimpleSelectClause ::= "SELECT" ["DISTINCT"] SimpleSelectExpression
|
||||
*
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link http://www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision$
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision: 3938 $
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class SimpleSelectClause extends Node
|
||||
{
|
||||
private $_isDistinct = false;
|
||||
private $_simpleSelectExpression;
|
||||
public $isDistinct = false;
|
||||
public $simpleSelectExpression;
|
||||
|
||||
public function __construct($simpleSelectExpression)
|
||||
public function __construct($simpleSelectExpression, $isDistinct)
|
||||
{
|
||||
$this->_simpleSelectExpression = $simpleSelectExpression;
|
||||
$this->simpleSelectExpression = $simpleSelectExpression;
|
||||
$this->isDistinct = $isDistinct;
|
||||
}
|
||||
|
||||
/* Getters */
|
||||
public function isDistinct()
|
||||
{
|
||||
return $this->_isDistinct;
|
||||
}
|
||||
|
||||
public function setDistinct($bool)
|
||||
{
|
||||
$this->_isDistinct = $bool;
|
||||
}
|
||||
|
||||
public function getSimpleSelectExpression()
|
||||
{
|
||||
return $this->_simpleSelectExpression;
|
||||
}
|
||||
|
||||
public function dispatch($sqlWalker)
|
||||
{
|
||||
return $sqlWalker->walkSimpleSelectClause($this);
|
||||
|
|
|
@ -23,39 +23,26 @@ namespace Doctrine\ORM\Query\AST;
|
|||
|
||||
/**
|
||||
* SimpleSelectExpression ::= StateFieldPathExpression | IdentificationVariable
|
||||
* | (AggregateExpression [["AS"] FieldAliasIdentificationVariable])
|
||||
* | (AggregateExpression [["AS"] FieldAliasIdentificationVariable])
|
||||
*
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link http://www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision$
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision: 3938 $
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class SimpleSelectExpression extends Node
|
||||
{
|
||||
private $_expression;
|
||||
private $_fieldIdentificationVariable;
|
||||
public $expression;
|
||||
public $fieldIdentificationVariable;
|
||||
|
||||
public function __construct($expression)
|
||||
{
|
||||
$this->_expression = $expression;
|
||||
$this->expression = $expression;
|
||||
}
|
||||
|
||||
public function getExpression()
|
||||
{
|
||||
return $this->_expression;
|
||||
}
|
||||
|
||||
public function getFieldIdentificationVariable()
|
||||
{
|
||||
return $this->_fieldIdentificationVariable;
|
||||
}
|
||||
|
||||
public function setFieldIdentificationVariable($fieldAlias)
|
||||
{
|
||||
$this->_fieldIdentificationVariable = $fieldAlias;
|
||||
}
|
||||
|
||||
public function dispatch($sqlWalker)
|
||||
{
|
||||
return $sqlWalker->walkSimpleSelectExpression($this);
|
||||
|
|
|
@ -24,78 +24,29 @@ namespace Doctrine\ORM\Query\AST;
|
|||
/**
|
||||
* Subselect ::= SimpleSelectClause SubselectFromClause [WhereClause] [GroupByClause] [HavingClause] [OrderByClause]
|
||||
*
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link http://www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision$
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision: 3938 $
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class Subselect extends Node
|
||||
{
|
||||
private $_simpleSelectClause;
|
||||
private $_subselectFromClause;
|
||||
private $_whereClause;
|
||||
private $_groupByClause;
|
||||
private $_havingClause;
|
||||
private $_orderByClause;
|
||||
public $simpleSelectClause;
|
||||
public $subselectFromClause;
|
||||
public $whereClause;
|
||||
public $groupByClause;
|
||||
public $havingClause;
|
||||
public $orderByClause;
|
||||
|
||||
public function __construct($simpleSelectClause, $subselectFromClause)
|
||||
{
|
||||
$this->_simpleSelectClause = $simpleSelectClause;
|
||||
$this->_subselectFromClause = $subselectFromClause;
|
||||
$this->simpleSelectClause = $simpleSelectClause;
|
||||
$this->subselectFromClause = $subselectFromClause;
|
||||
}
|
||||
|
||||
/* Getters */
|
||||
public function getSimpleSelectClause()
|
||||
{
|
||||
return $this->_simpleSelectClause;
|
||||
}
|
||||
|
||||
public function getSubselectFromClause()
|
||||
{
|
||||
return $this->_subselectFromClause;
|
||||
}
|
||||
|
||||
public function getWhereClause()
|
||||
{
|
||||
return $this->_whereClause;
|
||||
}
|
||||
|
||||
public function setWhereClause($whereClause)
|
||||
{
|
||||
$this->_whereClause = $whereClause;
|
||||
}
|
||||
|
||||
public function getGroupByClause()
|
||||
{
|
||||
return $this->_groupByClause;
|
||||
}
|
||||
|
||||
public function setGroupByClause($groupByClause)
|
||||
{
|
||||
$this->_groupByClause = $groupByClause;
|
||||
}
|
||||
|
||||
public function getHavingClause()
|
||||
{
|
||||
return $this->_havingClause;
|
||||
}
|
||||
|
||||
public function setHavingClause($havingClause)
|
||||
{
|
||||
$this->_havingClause = $havingClause;
|
||||
}
|
||||
|
||||
public function getOrderByClause()
|
||||
{
|
||||
return $this->_orderByClause;
|
||||
}
|
||||
|
||||
public function setOrderByClause($orderByClause)
|
||||
{
|
||||
$this->_orderByClause = $orderByClause;
|
||||
}
|
||||
|
||||
public function dispatch($sqlWalker)
|
||||
{
|
||||
return $sqlWalker->walkSubselect($this);
|
||||
|
|
|
@ -24,27 +24,23 @@ namespace Doctrine\ORM\Query\AST;
|
|||
/**
|
||||
* SubselectFromClause ::= "FROM" SubselectIdentificationVariableDeclaration {"," SubselectIdentificationVariableDeclaration}*
|
||||
*
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link http://www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision$
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision: 3938 $
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class SubselectFromClause extends Node
|
||||
{
|
||||
private $_identificationVariableDeclarations = array();
|
||||
public $identificationVariableDeclarations = array();
|
||||
|
||||
public function __construct(array $identificationVariableDeclarations)
|
||||
{
|
||||
$this->_identificationVariableDeclarations = $identificationVariableDeclarations;
|
||||
$this->identificationVariableDeclarations = $identificationVariableDeclarations;
|
||||
}
|
||||
|
||||
/* Getters */
|
||||
public function getSubselectIdentificationVariableDeclarations()
|
||||
{
|
||||
return $this->_identificationVariableDeclarations;
|
||||
}
|
||||
|
||||
public function dispatch($sqlWalker)
|
||||
{
|
||||
return $sqlWalker->walkSubselectFromClause($this);
|
||||
|
|
|
@ -1,44 +1,47 @@
|
|||
<?php
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Query\AST;
|
||||
|
||||
/**
|
||||
* UpdateClause ::= "UPDATE" AbstractSchemaName [["AS"] AliasIdentificationVariable] "SET" UpdateItem {"," UpdateItem}*
|
||||
*
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision: 3938 $
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class UpdateClause extends Node
|
||||
{
|
||||
private $_abstractSchemaName;
|
||||
private $_aliasIdentificationVariable;
|
||||
private $_updateItems = array();
|
||||
public $abstractSchemaName;
|
||||
public $aliasIdentificationVariable;
|
||||
public $updateItems = array();
|
||||
|
||||
public function __construct($abstractSchemaName, array $updateItems)
|
||||
{
|
||||
$this->_abstractSchemaName = $abstractSchemaName;
|
||||
$this->_updateItems = $updateItems;
|
||||
}
|
||||
|
||||
public function getAbstractSchemaName()
|
||||
{
|
||||
return $this->_abstractSchemaName;
|
||||
}
|
||||
|
||||
public function getAliasIdentificationVariable()
|
||||
{
|
||||
return $this->_aliasIdentificationVariable;
|
||||
}
|
||||
|
||||
public function setAliasIdentificationVariable($alias)
|
||||
{
|
||||
$this->_aliasIdentificationVariable = $alias;
|
||||
}
|
||||
|
||||
public function getUpdateItems()
|
||||
{
|
||||
return $this->_updateItems;
|
||||
$this->abstractSchemaName = $abstractSchemaName;
|
||||
$this->updateItems = $updateItems;
|
||||
}
|
||||
|
||||
public function dispatch($sqlWalker)
|
||||
|
|
|
@ -26,39 +26,24 @@ namespace Doctrine\ORM\Query\AST;
|
|||
* NewValue ::= SimpleArithmeticExpression | StringPrimary | DatetimePrimary | BooleanPrimary |
|
||||
* EnumPrimary | SimpleEntityExpression | "NULL"
|
||||
*
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
* @since 2.0
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision: 3938 $
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class UpdateItem extends Node
|
||||
{
|
||||
private $_identificationVariable;
|
||||
private $_field;
|
||||
private $_newValue;
|
||||
public $identificationVariable;
|
||||
public $field;
|
||||
public $newValue;
|
||||
|
||||
public function __construct($field, $newValue)
|
||||
{
|
||||
$this->_field = $field;
|
||||
$this->_newValue = $newValue;
|
||||
}
|
||||
|
||||
public function setIdentificationVariable($identVar)
|
||||
{
|
||||
$this->_identificationVariable = $identVar;
|
||||
}
|
||||
|
||||
public function getIdentificationVariable()
|
||||
{
|
||||
return $this->_identificationVariable;
|
||||
}
|
||||
|
||||
public function getField()
|
||||
{
|
||||
return $this->_field;
|
||||
}
|
||||
|
||||
public function getNewValue()
|
||||
{
|
||||
return $this->_newValue;
|
||||
$this->field = $field;
|
||||
$this->newValue = $newValue;
|
||||
}
|
||||
|
||||
public function dispatch($sqlWalker)
|
||||
|
|
|
@ -24,35 +24,22 @@ namespace Doctrine\ORM\Query\AST;
|
|||
/**
|
||||
* UpdateStatement = UpdateClause [WhereClause]
|
||||
*
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link http://www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision$
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision: 3938 $
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class UpdateStatement extends Node
|
||||
{
|
||||
private $_updateClause;
|
||||
private $_whereClause;
|
||||
public $updateClause;
|
||||
public $whereClause;
|
||||
|
||||
public function __construct($updateClause)
|
||||
{
|
||||
$this->_updateClause = $updateClause;
|
||||
}
|
||||
|
||||
public function setWhereClause($whereClause)
|
||||
{
|
||||
$this->_whereClause = $whereClause;
|
||||
}
|
||||
|
||||
public function getUpdateClause()
|
||||
{
|
||||
return $this->_updateClause;
|
||||
}
|
||||
|
||||
public function getWhereClause()
|
||||
{
|
||||
return $this->_whereClause;
|
||||
$this->updateClause = $updateClause;
|
||||
}
|
||||
|
||||
public function dispatch($sqlWalker)
|
||||
|
|
|
@ -1,28 +1,44 @@
|
|||
<?php
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Query\AST;
|
||||
|
||||
/**
|
||||
* Description of WhereClause
|
||||
* WhereClause ::= "WHERE" ConditionalExpression
|
||||
*
|
||||
* @author robo
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision: 3938 $
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class WhereClause extends Node
|
||||
{
|
||||
private $_conditionalExpression;
|
||||
public $conditionalExpression;
|
||||
|
||||
public function __construct($conditionalExpression)
|
||||
{
|
||||
$this->_conditionalExpression = $conditionalExpression;
|
||||
}
|
||||
|
||||
public function getConditionalExpression()
|
||||
{
|
||||
return $this->_conditionalExpression;
|
||||
$this->conditionalExpression = $conditionalExpression;
|
||||
}
|
||||
|
||||
public function dispatch($sqlWalker)
|
||||
|
|
|
@ -53,9 +53,9 @@ class MultiTableDeleteExecutor extends AbstractSqlExecutor
|
|||
$conn = $em->getConnection();
|
||||
|
||||
$primaryClass = $sqlWalker->getEntityManager()->getClassMetadata(
|
||||
$AST->getDeleteClause()->getAbstractSchemaName()
|
||||
$AST->deleteClause->abstractSchemaName
|
||||
);
|
||||
$primaryDqlAlias = $AST->getDeleteClause()->getAliasIdentificationVariable();
|
||||
$primaryDqlAlias = $AST->deleteClause->aliasIdentificationVariable;
|
||||
$rootClass = $em->getClassMetadata($primaryClass->rootEntityName);
|
||||
|
||||
$tempTable = $rootClass->getTemporaryIdTableName();
|
||||
|
@ -71,8 +71,8 @@ class MultiTableDeleteExecutor extends AbstractSqlExecutor
|
|||
$this->_insertSql .= $sqlWalker->walkFromClause($fromClause);
|
||||
|
||||
// Append WHERE clause, if there is one.
|
||||
if ($AST->getWhereClause()) {
|
||||
$this->_insertSql .= $sqlWalker->walkWhereClause($AST->getWhereClause());
|
||||
if ($AST->whereClause) {
|
||||
$this->_insertSql .= $sqlWalker->walkWhereClause($AST->whereClause);
|
||||
}
|
||||
|
||||
// 2. Create ID subselect statement used in DELETE .... WHERE ... IN (subselect)
|
||||
|
|
|
@ -53,13 +53,12 @@ class MultiTableUpdateExecutor extends AbstractSqlExecutor
|
|||
{
|
||||
$em = $sqlWalker->getEntityManager();
|
||||
$conn = $em->getConnection();
|
||||
$updateClause = $AST->updateClause;
|
||||
|
||||
$primaryClass = $sqlWalker->getEntityManager()->getClassMetadata(
|
||||
$AST->getUpdateClause()->getAbstractSchemaName()
|
||||
);
|
||||
$primaryClass = $sqlWalker->getEntityManager()->getClassMetadata($updateClause->abstractSchemaName);
|
||||
$rootClass = $em->getClassMetadata($primaryClass->rootEntityName);
|
||||
|
||||
$updateItems = $AST->getUpdateClause()->getUpdateItems();
|
||||
$updateItems = $updateClause->updateItems;
|
||||
|
||||
$tempTable = $rootClass->getTemporaryIdTableName();
|
||||
$idColumnNames = $rootClass->getIdentifierColumnNames();
|
||||
|
@ -68,8 +67,8 @@ class MultiTableUpdateExecutor extends AbstractSqlExecutor
|
|||
// 1. Create an INSERT INTO temptable ... SELECT identifiers WHERE $AST->getWhereClause()
|
||||
$this->_insertSql = 'INSERT INTO ' . $tempTable . ' (' . $idColumnList . ')'
|
||||
. ' SELECT t0.' . implode(', t0.', $idColumnNames);
|
||||
$sqlWalker->setSqlTableAlias($primaryClass->primaryTable['name'] . $AST->getUpdateClause()->getAliasIdentificationVariable(), 't0');
|
||||
$rangeDecl = new AST\RangeVariableDeclaration($primaryClass, $AST->getUpdateClause()->getAliasIdentificationVariable());
|
||||
$sqlWalker->setSqlTableAlias($primaryClass->primaryTable['name'] . $updateClause->aliasIdentificationVariable, 't0');
|
||||
$rangeDecl = new AST\RangeVariableDeclaration($primaryClass, $updateClause->aliasIdentificationVariable);
|
||||
$fromClause = new AST\FromClause(array(new AST\IdentificationVariableDeclaration($rangeDecl, null, array())));
|
||||
$this->_insertSql .= $sqlWalker->walkFromClause($fromClause);
|
||||
|
||||
|
@ -79,6 +78,7 @@ class MultiTableUpdateExecutor extends AbstractSqlExecutor
|
|||
// 3. Create and store UPDATE statements
|
||||
$classNames = array_merge($primaryClass->parentClasses, array($primaryClass->name), $primaryClass->subClasses);
|
||||
$i = -1;
|
||||
|
||||
foreach (array_reverse($classNames) as $className) {
|
||||
$affected = false;
|
||||
$class = $em->getClassMetadata($className);
|
||||
|
@ -86,19 +86,22 @@ class MultiTableUpdateExecutor extends AbstractSqlExecutor
|
|||
$updateSql = 'UPDATE ' . $conn->quoteIdentifier($tableName) . ' SET ';
|
||||
|
||||
foreach ($updateItems as $updateItem) {
|
||||
$field = $updateItem->getField();
|
||||
$field = $updateItem->field;
|
||||
if (isset($class->fieldMappings[$field]) && ! isset($class->fieldMappings[$field]['inherited'])) {
|
||||
$newValue = $updateItem->getNewValue();
|
||||
$newValue = $updateItem->newValue;
|
||||
|
||||
if ( ! $affected) {
|
||||
$affected = true;
|
||||
++$i;
|
||||
} else {
|
||||
$updateSql .= ', ';
|
||||
}
|
||||
|
||||
$updateSql .= $sqlWalker->walkUpdateItem($updateItem);
|
||||
|
||||
//FIXME: parameters can be more deeply nested. traverse the tree.
|
||||
if ($newValue instanceof AST\InputParameter) {
|
||||
$paramKey = $newValue->isNamed() ? $newValue->getName() : $newValue->getPosition();
|
||||
$paramKey = $newValue->name;
|
||||
$this->_sqlParameters[$i][] = $sqlWalker->getQuery()->getParameter($paramKey);
|
||||
++$this->_numParametersInUpdateClause;
|
||||
}
|
||||
|
@ -111,8 +114,8 @@ class MultiTableUpdateExecutor extends AbstractSqlExecutor
|
|||
}
|
||||
|
||||
// Append WHERE clause to insertSql, if there is one.
|
||||
if ($AST->getWhereClause()) {
|
||||
$this->_insertSql .= $sqlWalker->walkWhereClause($AST->getWhereClause());
|
||||
if ($AST->whereClause) {
|
||||
$this->_insertSql .= $sqlWalker->walkWhereClause($AST->whereClause);
|
||||
}
|
||||
|
||||
// 4. Store DDL for temporary identifier table.
|
||||
|
|
|
@ -30,13 +30,14 @@ use Doctrine\Common\DoctrineException,
|
|||
* An LL(*) parser for the context-free grammar of the Doctrine Query Language.
|
||||
* Parses a DQL query, reports any errors in it, and generates an AST.
|
||||
*
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Janne Vanhala <jpvanhal@cc.hut.fi>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link http://www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision$
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision: 3938 $
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
* @author Janne Vanhala <jpvanhal@cc.hut.fi>
|
||||
*/
|
||||
class Parser
|
||||
{
|
||||
|
@ -482,16 +483,16 @@ class Parser
|
|||
*/
|
||||
private function _validatePathExpression(AST\PathExpression $pathExpression, $nestingLevel = null, $token = null)
|
||||
{
|
||||
$identificationVariable = $pathExpression->getIdentificationVariable();
|
||||
$identVariable = $pathExpression->identificationVariable;
|
||||
$nestingLevel = ($nestingLevel !== null) ?: $this->_nestingLevel;
|
||||
$token = ($token) ?: $this->_lexer->lookahead;
|
||||
|
||||
$this->_validateIdentificationVariable($identificationVariable, $nestingLevel, $token);
|
||||
$this->_validateIdentificationVariable($identVariable, $nestingLevel, $token);
|
||||
|
||||
$class = $this->_queryComponents[$identificationVariable]['metadata'];
|
||||
$class = $this->_queryComponents[$identVariable]['metadata'];
|
||||
$stateField = $collectionField = null;
|
||||
|
||||
foreach ($pathExpression->getParts() as $field) {
|
||||
foreach ($pathExpression->parts as $field) {
|
||||
// Check if it is not in a state field
|
||||
if ($stateField !== null) {
|
||||
$this->semanticalError(
|
||||
|
@ -535,7 +536,7 @@ class Parser
|
|||
}
|
||||
|
||||
// Validate if PathExpression is one of the expected types
|
||||
$expectedType = $pathExpression->getExpectedType();
|
||||
$expectedType = $pathExpression->expectedType;
|
||||
|
||||
if ( ! ($expectedType & $expressionType)) {
|
||||
// We need to recognize which was expected type(s)
|
||||
|
@ -569,7 +570,7 @@ class Parser
|
|||
}
|
||||
|
||||
// We need to force the type in PathExpression
|
||||
$pathExpression->setType($expressionType);
|
||||
$pathExpression->type = $expressionType;
|
||||
|
||||
return $expressionType;
|
||||
}
|
||||
|
@ -578,33 +579,33 @@ class Parser
|
|||
* Validates that the given <tt>IdentificationVariable</tt> is a semantically correct.
|
||||
* It must exist in query components list.
|
||||
*
|
||||
* @param string $idVariable
|
||||
* @param string $identVariable
|
||||
* @param integer $nestingLevel
|
||||
* @param array $token
|
||||
* @return array Query Component
|
||||
*/
|
||||
private function _validateIdentificationVariable($idVariable, $nestingLevel = null, $token = null)
|
||||
private function _validateIdentificationVariable($identVariable, $nestingLevel = null, $token = null)
|
||||
{
|
||||
$nestingLevel = ($nestingLevel !== null) ?: $this->_nestingLevel;
|
||||
$token = ($token) ?: $this->_lexer->lookahead;
|
||||
|
||||
if ( ! isset($this->_queryComponents[$idVariable])) {
|
||||
if ( ! isset($this->_queryComponents[$identVariable])) {
|
||||
echo '[Query Components: ' . var_export($this->_queryComponents, true) . ']';
|
||||
|
||||
$this->semanticalError(
|
||||
"Could not find '$idVariable' in query components", $token
|
||||
"Could not find '$identVariable' in query components", $token
|
||||
);
|
||||
}
|
||||
|
||||
// Validate if identification variable nesting level is lower or equal than the current one
|
||||
if ($this->_queryComponents[$idVariable]['nestingLevel'] > $nestingLevel) {
|
||||
if ($this->_queryComponents[$identVariable]['nestingLevel'] > $nestingLevel) {
|
||||
$this->semanticalError(
|
||||
"Query component '$idVariable' is not in the same nesting level of its declaration",
|
||||
"Query component '$identVariable' is not in the same nesting level of its declaration",
|
||||
$token
|
||||
);
|
||||
}
|
||||
|
||||
return $this->_queryComponents[$idVariable];
|
||||
return $this->_queryComponents[$identVariable];
|
||||
}
|
||||
|
||||
|
||||
|
@ -647,27 +648,24 @@ class Parser
|
|||
// since we do not have any IdentificationVariable yet
|
||||
$this->_beginDeferredPathExpressionStack();
|
||||
|
||||
$selectClause = $this->SelectClause();
|
||||
$fromClause = $this->FromClause();
|
||||
$selectStatement = new AST\SelectStatement($this->SelectClause(), $this->FromClause());
|
||||
|
||||
// Activate semantical checks after this point. Process all deferred checks in pipeline
|
||||
$this->_processDeferredPathExpressionStack();
|
||||
|
||||
$whereClause = $this->_lexer->isNextToken(Lexer::T_WHERE)
|
||||
$selectStatement->whereClause = $this->_lexer->isNextToken(Lexer::T_WHERE)
|
||||
? $this->WhereClause() : null;
|
||||
|
||||
$groupByClause = $this->_lexer->isNextToken(Lexer::T_GROUP)
|
||||
$selectStatement->groupByClause = $this->_lexer->isNextToken(Lexer::T_GROUP)
|
||||
? $this->GroupByClause() : null;
|
||||
|
||||
$havingClause = $this->_lexer->isNextToken(Lexer::T_HAVING)
|
||||
$selectStatement->havingClause = $this->_lexer->isNextToken(Lexer::T_HAVING)
|
||||
? $this->HavingClause() : null;
|
||||
|
||||
$orderByClause = $this->_lexer->isNextToken(Lexer::T_ORDER)
|
||||
$selectStatement->orderByClause = $this->_lexer->isNextToken(Lexer::T_ORDER)
|
||||
? $this->OrderByClause() : null;
|
||||
|
||||
return new AST\SelectStatement(
|
||||
$selectClause, $fromClause, $whereClause, $groupByClause, $havingClause, $orderByClause
|
||||
);
|
||||
return $selectStatement;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -678,9 +676,8 @@ class Parser
|
|||
public function UpdateStatement()
|
||||
{
|
||||
$updateStatement = new AST\UpdateStatement($this->UpdateClause());
|
||||
$updateStatement->setWhereClause(
|
||||
$this->_lexer->isNextToken(Lexer::T_WHERE) ? $this->WhereClause() : null
|
||||
);
|
||||
$updateStatement->whereClause = $this->_lexer->isNextToken(Lexer::T_WHERE)
|
||||
? $this->WhereClause() : null;
|
||||
|
||||
return $updateStatement;
|
||||
}
|
||||
|
@ -693,9 +690,8 @@ class Parser
|
|||
public function DeleteStatement()
|
||||
{
|
||||
$deleteStatement = new AST\DeleteStatement($this->DeleteClause());
|
||||
$deleteStatement->setWhereClause(
|
||||
$this->_lexer->isNextToken(Lexer::T_WHERE) ? $this->WhereClause() : null
|
||||
);
|
||||
$deleteStatement->whereClause = $this->_lexer->isNextToken(Lexer::T_WHERE)
|
||||
? $this->WhereClause() : null;
|
||||
|
||||
return $deleteStatement;
|
||||
}
|
||||
|
@ -758,22 +754,22 @@ class Parser
|
|||
public function JoinAssociationPathExpression()
|
||||
{
|
||||
$token = $this->_lexer->lookahead;
|
||||
$identificationVariable = $this->IdentificationVariable();
|
||||
$identVariable = $this->IdentificationVariable();
|
||||
$this->match('.');
|
||||
$this->match(Lexer::T_IDENTIFIER);
|
||||
$field = $this->_lexer->token['value'];
|
||||
|
||||
// Validating IdentificationVariable (it was already defined previously)
|
||||
$this->_validateIdentificationVariable($identificationVariable, null, $token);
|
||||
$this->_validateIdentificationVariable($identVariable, null, $token);
|
||||
|
||||
// Validating association field (*-to-one or *-to-many)
|
||||
$class = $this->_queryComponents[$identificationVariable]['metadata'];
|
||||
$class = $this->_queryComponents[$identVariable]['metadata'];
|
||||
|
||||
if ( ! isset($class->associationMappings[$field])) {
|
||||
$this->semanticalError('Class ' . $class->name . ' has no field named ' . $field);
|
||||
}
|
||||
|
||||
return new AST\JoinAssociationPathExpression($identificationVariable, $field);
|
||||
return new AST\JoinAssociationPathExpression($identVariable, $field);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -788,7 +784,7 @@ class Parser
|
|||
public function PathExpression($expectedType)
|
||||
{
|
||||
$token = $this->_lexer->lookahead;
|
||||
$identificationVariable = $this->IdentificationVariable();
|
||||
$identVariable = $this->IdentificationVariable();
|
||||
$parts = array();
|
||||
|
||||
do {
|
||||
|
@ -799,7 +795,7 @@ class Parser
|
|||
} while ($this->_lexer->isNextToken('.'));
|
||||
|
||||
// Creating AST node
|
||||
$pathExpr = new AST\PathExpression($expectedType, $identificationVariable, $parts);
|
||||
$pathExpr = new AST\PathExpression($expectedType, $identVariable, $parts);
|
||||
|
||||
// Defer PathExpression validation if requested to be defered
|
||||
if ( ! empty($this->_deferredPathExpressionStacks)) {
|
||||
|
@ -884,7 +880,7 @@ class Parser
|
|||
public function SimpleStateFieldPathExpression()
|
||||
{
|
||||
$pathExpression = $this->PathExpression(AST\PathExpression::TYPE_STATE_FIELD);
|
||||
$parts = $pathExpression->getParts();
|
||||
$parts = $pathExpression->parts;
|
||||
|
||||
if (count($parts) > 1) {
|
||||
$this->semanticalError(
|
||||
|
@ -932,18 +928,15 @@ class Parser
|
|||
*/
|
||||
public function SimpleSelectClause()
|
||||
{
|
||||
$distinct = false;
|
||||
$isDistinct = false;
|
||||
$this->match(Lexer::T_SELECT);
|
||||
|
||||
if ($this->_lexer->isNextToken(Lexer::T_DISTINCT)) {
|
||||
$this->match(Lexer::T_DISTINCT);
|
||||
$distinct = true;
|
||||
$isDistinct = true;
|
||||
}
|
||||
|
||||
$simpleSelectClause = new AST\SimpleSelectClause($this->SimpleSelectExpression());
|
||||
$simpleSelectClause->setDistinct($distinct);
|
||||
|
||||
return $simpleSelectClause;
|
||||
return new AST\SimpleSelectClause($this->SimpleSelectExpression(), $isDistinct);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -992,7 +985,7 @@ class Parser
|
|||
}
|
||||
|
||||
$updateClause = new AST\UpdateClause($abstractSchemaName, $updateItems);
|
||||
$updateClause->setAliasIdentificationVariable($aliasIdentificationVariable);
|
||||
$updateClause->aliasIdentificationVariable = $aliasIdentificationVariable;
|
||||
|
||||
return $updateClause;
|
||||
}
|
||||
|
@ -1022,11 +1015,11 @@ class Parser
|
|||
$token = $this->_lexer->lookahead;
|
||||
$aliasIdentificationVariable = $this->AliasIdentificationVariable();
|
||||
} else {
|
||||
$aliasIdentificationVariable = $deleteClause->getAbstractSchemaName();
|
||||
$aliasIdentificationVariable = $deleteClause->abstractSchemaName;
|
||||
}
|
||||
|
||||
$deleteClause->setAliasIdentificationVariable($aliasIdentificationVariable);
|
||||
$class = $this->_em->getClassMetadata($deleteClause->getAbstractSchemaName());
|
||||
$deleteClause->aliasIdentificationVariable = $aliasIdentificationVariable;
|
||||
$class = $this->_em->getClassMetadata($deleteClause->abstractSchemaName);
|
||||
|
||||
// Building queryComponent
|
||||
$queryComponent = array(
|
||||
|
@ -1156,25 +1149,23 @@ class Parser
|
|||
$this->_nestingLevel++;
|
||||
|
||||
$this->_beginDeferredPathExpressionStack();
|
||||
|
||||
$subselect = new AST\Subselect($this->SimpleSelectClause(), $this->SubselectFromClause());
|
||||
|
||||
$this->_processDeferredPathExpressionStack();
|
||||
|
||||
$subselect->setWhereClause(
|
||||
$this->_lexer->isNextToken(Lexer::T_WHERE) ? $this->WhereClause() : null
|
||||
);
|
||||
|
||||
$subselect->setGroupByClause(
|
||||
$this->_lexer->isNextToken(Lexer::T_GROUP) ? $this->GroupByClause() : null
|
||||
);
|
||||
|
||||
$subselect->setHavingClause(
|
||||
$this->_lexer->isNextToken(Lexer::T_HAVING) ? $this->HavingClause() : null
|
||||
);
|
||||
|
||||
$subselect->setOrderByClause(
|
||||
$this->_lexer->isNextToken(Lexer::T_ORDER) ? $this->OrderByClause() : null
|
||||
);
|
||||
|
||||
$subselect->whereClause = $this->_lexer->isNextToken(Lexer::T_WHERE)
|
||||
? $this->WhereClause() : null;
|
||||
|
||||
$subselect->groupByClause = $this->_lexer->isNextToken(Lexer::T_GROUP)
|
||||
? $this->GroupByClause() : null;
|
||||
|
||||
$subselect->havingClause = $this->_lexer->isNextToken(Lexer::T_HAVING)
|
||||
? $this->HavingClause() : null;
|
||||
|
||||
$subselect->orderByClause = $this->_lexer->isNextToken(Lexer::T_ORDER)
|
||||
? $this->OrderByClause() : null;
|
||||
|
||||
// Decrease query nesting level
|
||||
$this->_nestingLevel--;
|
||||
|
||||
|
@ -1190,10 +1181,10 @@ class Parser
|
|||
public function UpdateItem()
|
||||
{
|
||||
$token = $this->_lexer->lookahead;
|
||||
$identificationVariable = $this->IdentificationVariable();
|
||||
$identVariable = $this->IdentificationVariable();
|
||||
|
||||
// Validate if IdentificationVariable is defined
|
||||
$queryComponent = $this->_validateIdentificationVariable($identificationVariable, null, $token);
|
||||
$queryComponent = $this->_validateIdentificationVariable($identVariable, null, $token);
|
||||
|
||||
$this->match('.');
|
||||
$this->match(Lexer::T_IDENTIFIER);
|
||||
|
@ -1213,7 +1204,7 @@ class Parser
|
|||
$newValue = $this->NewValue();
|
||||
|
||||
$updateItem = new AST\UpdateItem($field, $newValue);
|
||||
$updateItem->setIdentificationVariable($identificationVariable);
|
||||
$updateItem->identificationVariable = $identVariable;
|
||||
|
||||
return $updateItem;
|
||||
}
|
||||
|
@ -1230,12 +1221,12 @@ class Parser
|
|||
|
||||
if ($glimpse['value'] != '.') {
|
||||
$token = $this->_lexer->lookahead;
|
||||
$identificationVariable = $this->IdentificationVariable();
|
||||
$identVariable = $this->IdentificationVariable();
|
||||
|
||||
// Validate if IdentificationVariable is defined
|
||||
$this->_validateIdentificationVariable($identificationVariable, null, $token);
|
||||
$this->_validateIdentificationVariable($identVariable, null, $token);
|
||||
|
||||
return $identificationVariable;
|
||||
return $identVariable;
|
||||
}
|
||||
|
||||
return $this->SingleValuedPathExpression();
|
||||
|
@ -1251,15 +1242,17 @@ class Parser
|
|||
*/
|
||||
public function OrderByItem()
|
||||
{
|
||||
$type = 'ASC';
|
||||
|
||||
// We need to check if we are in a ResultVariable or StateFieldPathExpression
|
||||
$glimpse = $this->_lexer->glimpse();
|
||||
|
||||
if ($glimpse['value'] != '.') {
|
||||
$token = $this->_lexer->lookahead;
|
||||
$expr = $this->ResultVariable();
|
||||
$resultVariable = $this->ResultVariable();
|
||||
|
||||
// Check if ResultVariable is defined in query components
|
||||
$queryComponent = $this->_validateIdentificationVariable($expr, null, $token);
|
||||
$queryComponent = $this->_validateIdentificationVariable($resultVariable, null, $token);
|
||||
|
||||
// Outer defininition used in inner subselect is not enough.
|
||||
// ResultVariable exists in queryComponents, check nesting level
|
||||
|
@ -1276,17 +1269,12 @@ class Parser
|
|||
|
||||
if ($this->_lexer->isNextToken(Lexer::T_ASC)) {
|
||||
$this->match(Lexer::T_ASC);
|
||||
$item->setAsc(true);
|
||||
return $item;
|
||||
}
|
||||
|
||||
if ($this->_lexer->isNextToken(Lexer::T_DESC)) {
|
||||
} else if ($this->_lexer->isNextToken(Lexer::T_DESC)) {
|
||||
$this->match(Lexer::T_DESC);
|
||||
$item->setDesc(true);
|
||||
return $item;
|
||||
$type = 'DESC';
|
||||
}
|
||||
|
||||
$item->setAsc(true);
|
||||
$item->type = $type;
|
||||
return $item;
|
||||
}
|
||||
|
||||
|
@ -1350,10 +1338,10 @@ class Parser
|
|||
$peek = $this->_lexer->glimpse();
|
||||
|
||||
if ($peek['value'] == '.') {
|
||||
$subselectIdVarDecl = new AST\SubselectIdentificationVariableDeclaration;
|
||||
$subselectIdVarDecl->setAssociationPathExpression($this->AssociationPathExpression());
|
||||
$subselectIdVarDecl = new AST\SubselectIdentificationVariableDeclaration();
|
||||
$subselectIdVarDecl->associationPathExpression = $this->AssociationPathExpression();
|
||||
$this->match(Lexer::T_AS);
|
||||
$subselectIdVarDecl->setAliasIdentificationVariable($this->AliasIdentificationVariable());
|
||||
$subselectIdVarDecl->aliasIdentificationVariable = $this->AliasIdentificationVariable();
|
||||
|
||||
return $subselectIdVarDecl;
|
||||
}
|
||||
|
@ -1445,8 +1433,8 @@ class Parser
|
|||
$aliasIdentificationVariable = $this->AliasIdentificationVariable();
|
||||
|
||||
// Verify that the association exists.
|
||||
$parentClass = $this->_queryComponents[$joinPathExpression->getIdentificationVariable()]['metadata'];
|
||||
$assocField = $joinPathExpression->getAssociationField();
|
||||
$parentClass = $this->_queryComponents[$joinPathExpression->identificationVariable]['metadata'];
|
||||
$assocField = $joinPathExpression->associationField;
|
||||
|
||||
if ( ! $parentClass->hasAssociation($assocField)) {
|
||||
$this->semanticalError(
|
||||
|
@ -1459,7 +1447,7 @@ class Parser
|
|||
// Building queryComponent
|
||||
$joinQueryComponent = array(
|
||||
'metadata' => $this->_em->getClassMetadata($targetClassName),
|
||||
'parent' => $joinPathExpression->getIdentificationVariable(),
|
||||
'parent' => $joinPathExpression->identificationVariable,
|
||||
'relation' => $parentClass->getAssociationMapping($assocField),
|
||||
'map' => null,
|
||||
'nestingLevel' => $this->_nestingLevel,
|
||||
|
@ -1474,12 +1462,12 @@ class Parser
|
|||
if ($this->_lexer->isNextToken(Lexer::T_ON) || $this->_lexer->isNextToken(Lexer::T_WITH)) {
|
||||
if ($this->_lexer->isNextToken(Lexer::T_ON)) {
|
||||
$this->match(Lexer::T_ON);
|
||||
$join->setWhereType(AST\Join::JOIN_WHERE_ON);
|
||||
$join->whereType = AST\Join::JOIN_WHERE_ON;
|
||||
} else {
|
||||
$this->match(Lexer::T_WITH);
|
||||
}
|
||||
|
||||
$join->setConditionalExpression($this->ConditionalExpression());
|
||||
$join->conditionalExpression = $this->ConditionalExpression();
|
||||
}
|
||||
|
||||
return $join;
|
||||
|
@ -1497,8 +1485,8 @@ class Parser
|
|||
$pathExp = $this->SimpleStateFieldPathExpression();
|
||||
|
||||
// Add the INDEX BY info to the query component
|
||||
$parts = $pathExp->getParts();
|
||||
$this->_queryComponents[$pathExp->getIdentificationVariable()]['map'] = $parts[0];
|
||||
$parts = $pathExp->parts;
|
||||
$this->_queryComponents[$pathExp->identificationVariable]['map'] = $parts[0];
|
||||
|
||||
return $pathExp;
|
||||
}
|
||||
|
@ -1593,7 +1581,7 @@ class Parser
|
|||
if ($this->_lexer->isNextToken(Lexer::T_IDENTIFIER)) {
|
||||
$token = $this->_lexer->lookahead;
|
||||
$resultVariable = $this->ResultVariable();
|
||||
$expr->setFieldIdentificationVariable($resultVariable);
|
||||
$expr->fieldIdentificationVariable = $resultVariable;
|
||||
|
||||
// Include ResultVariable in query components.
|
||||
$this->_queryComponents[$resultVariable] = array(
|
||||
|
@ -1657,7 +1645,10 @@ class Parser
|
|||
$not = true;
|
||||
}
|
||||
|
||||
return new AST\ConditionalFactor($this->ConditionalPrimary(), $not);
|
||||
$condFactor = new AST\ConditionalFactor($this->ConditionalPrimary());
|
||||
$condFactor->not = $not;
|
||||
|
||||
return $condFactor;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1691,14 +1682,14 @@ class Parser
|
|||
|
||||
// Check if unmatched parenthesis is > 0, then we found a matching arithmetic operator
|
||||
if ($numUnmatched > 0) {
|
||||
$condPrimary->setSimpleConditionalExpression($this->SimpleConditionalExpression());
|
||||
$condPrimary->simpleConditionalExpression = $this->SimpleConditionalExpression();
|
||||
} else {
|
||||
$this->match('(');
|
||||
$condPrimary->setConditionalExpression($this->ConditionalExpression());
|
||||
$condPrimary->conditionalExpression = $this->ConditionalExpression();
|
||||
$this->match(')');
|
||||
}
|
||||
} else {
|
||||
$condPrimary->setSimpleConditionalExpression($this->SimpleConditionalExpression());
|
||||
$condPrimary->simpleConditionalExpression = $this->SimpleConditionalExpression();
|
||||
}
|
||||
|
||||
return $condPrimary;
|
||||
|
@ -1799,7 +1790,7 @@ class Parser
|
|||
|
||||
if ($this->_lexer->isNextToken(Lexer::T_NOT)) {
|
||||
$this->match(Lexer::T_NOT);
|
||||
$emptyColletionCompExpr->setNot(true);
|
||||
$emptyColletionCompExpr->not = true;
|
||||
}
|
||||
|
||||
$this->match(Lexer::T_EMPTY);
|
||||
|
@ -1817,12 +1808,12 @@ class Parser
|
|||
*/
|
||||
public function CollectionMemberExpression()
|
||||
{
|
||||
$isNot = false;
|
||||
$not = false;
|
||||
|
||||
$entityExpr = $this->EntityExpression();
|
||||
|
||||
if ($this->_lexer->isNextToken(Lexer::T_NOT)) {
|
||||
$isNot = true;
|
||||
$not = true;
|
||||
$this->match(Lexer::T_NOT);
|
||||
}
|
||||
|
||||
|
@ -1832,9 +1823,12 @@ class Parser
|
|||
$this->match(Lexer::T_OF);
|
||||
}
|
||||
|
||||
return new AST\CollectionMemberExpression(
|
||||
$entityExpr, $this->CollectionValuedPathExpression(), $isNot
|
||||
$collMemberExpr = new AST\CollectionMemberExpression(
|
||||
$entityExpr, $this->CollectionValuedPathExpression()
|
||||
);
|
||||
$collMemberExpr->not = $not;
|
||||
|
||||
return $collMemberExpr;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1967,17 +1961,17 @@ class Parser
|
|||
*/
|
||||
public function ArithmeticFactor()
|
||||
{
|
||||
$pSign = $nSign = false;
|
||||
$sign = null;
|
||||
|
||||
if ($this->_lexer->lookahead['value'] == '+') {
|
||||
$this->match('+');
|
||||
$pSign = true;
|
||||
$sign = true;
|
||||
} else if ($this->_lexer->lookahead['value'] == '-') {
|
||||
$this->match('-');
|
||||
$nSign = true;
|
||||
$sign = false;
|
||||
}
|
||||
|
||||
return new AST\ArithmeticFactor($this->ArithmeticPrimary(), $pSign, $nSign);
|
||||
return new AST\ArithmeticFactor($this->ArithmeticPrimary(), $sign);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2171,29 +2165,26 @@ class Parser
|
|||
*/
|
||||
public function QuantifiedExpression()
|
||||
{
|
||||
$all = $any = $some = false;
|
||||
$type = '';
|
||||
|
||||
if ($this->_lexer->isNextToken(Lexer::T_ALL)) {
|
||||
$this->match(Lexer::T_ALL);
|
||||
$all = true;
|
||||
$type = 'ALL';
|
||||
} else if ($this->_lexer->isNextToken(Lexer::T_ANY)) {
|
||||
$this->match(Lexer::T_ANY);
|
||||
$any = true;
|
||||
$type = 'ANY';
|
||||
} else if ($this->_lexer->isNextToken(Lexer::T_SOME)) {
|
||||
$this->match(Lexer::T_SOME);
|
||||
$some = true;
|
||||
$type = 'SOME';
|
||||
} else {
|
||||
$this->syntaxError('ALL, ANY or SOME');
|
||||
}
|
||||
|
||||
$this->match('(');
|
||||
$qExpr = new AST\QuantifiedExpression($this->Subselect());
|
||||
$qExpr->type = $type;
|
||||
$this->match(')');
|
||||
|
||||
$qExpr->setAll($all);
|
||||
$qExpr->setAny($any);
|
||||
$qExpr->setSome($some);
|
||||
|
||||
return $qExpr;
|
||||
}
|
||||
|
||||
|
@ -2218,7 +2209,7 @@ class Parser
|
|||
$arithExpr3 = $this->ArithmeticExpression();
|
||||
|
||||
$betweenExpr = new AST\BetweenExpression($arithExpr1, $arithExpr2, $arithExpr3);
|
||||
$betweenExpr->setNot($not);
|
||||
$betweenExpr->not = $not;
|
||||
|
||||
return $betweenExpr;
|
||||
}
|
||||
|
@ -2255,14 +2246,14 @@ class Parser
|
|||
|
||||
if ($this->_lexer->isNextToken(Lexer::T_NOT)) {
|
||||
$this->match(Lexer::T_NOT);
|
||||
$inExpression->setNot(true);
|
||||
$inExpression->not = true;
|
||||
}
|
||||
|
||||
$this->match(Lexer::T_IN);
|
||||
$this->match('(');
|
||||
|
||||
if ($this->_lexer->isNextToken(Lexer::T_SELECT)) {
|
||||
$inExpression->setSubselect($this->Subselect());
|
||||
$inExpression->subselect = $this->Subselect();
|
||||
} else {
|
||||
$literals = array();
|
||||
$literals[] = $this->InParameter();
|
||||
|
@ -2272,7 +2263,7 @@ class Parser
|
|||
$literals[] = $this->InParameter();
|
||||
}
|
||||
|
||||
$inExpression->setLiterals($literals);
|
||||
$inExpression->literals = $literals;
|
||||
}
|
||||
|
||||
$this->match(')');
|
||||
|
@ -2288,11 +2279,11 @@ class Parser
|
|||
public function LikeExpression()
|
||||
{
|
||||
$stringExpr = $this->StringExpression();
|
||||
$isNot = false;
|
||||
$not = false;
|
||||
|
||||
if ($this->_lexer->lookahead['type'] === Lexer::T_NOT) {
|
||||
$this->match(Lexer::T_NOT);
|
||||
$isNot = true;
|
||||
$not = true;
|
||||
}
|
||||
|
||||
$this->match(Lexer::T_LIKE);
|
||||
|
@ -2313,7 +2304,10 @@ class Parser
|
|||
$escapeChar = $this->_lexer->token['value'];
|
||||
}
|
||||
|
||||
return new AST\LikeExpression($stringExpr, $stringPattern, $isNot, $escapeChar);
|
||||
$likeExpr = new AST\LikeExpression($stringExpr, $stringPattern, $escapeChar);
|
||||
$likeExpr->not = $not;
|
||||
|
||||
return $likeExpr;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2335,7 +2329,7 @@ class Parser
|
|||
|
||||
if ($this->_lexer->isNextToken(Lexer::T_NOT)) {
|
||||
$this->match(Lexer::T_NOT);
|
||||
$nullCompExpr->setNot(true);
|
||||
$nullCompExpr->not = true;
|
||||
}
|
||||
|
||||
$this->match(Lexer::T_NULL);
|
||||
|
@ -2360,8 +2354,8 @@ class Parser
|
|||
$this->match(Lexer::T_EXISTS);
|
||||
$this->match('(');
|
||||
$existsExpression = new AST\ExistsExpression($this->Subselect());
|
||||
$existsExpression->not = $not;
|
||||
$this->match(')');
|
||||
$existsExpression->setNot($not);
|
||||
|
||||
return $existsExpression;
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue