1
0
mirror of synced 2024-12-05 03:06:05 +03:00

DDC-2827 Added support for AggregateExpressions in NullComparisonExpression.

This commit is contained in:
Guilherme Blanco 2014-04-17 04:39:26 +00:00
parent ceada41b83
commit 841bdd5ca5
3 changed files with 11 additions and 2 deletions

View File

@ -1647,7 +1647,7 @@ QUANTIFIED/BETWEEN/COMPARISON/LIKE/NULL/EXISTS
InstanceOfExpression ::= IdentificationVariable ["NOT"] "INSTANCE" ["OF"] (InstanceOfParameter | "(" InstanceOfParameter {"," InstanceOfParameter}* ")")
InstanceOfParameter ::= AbstractSchemaName | InputParameter
LikeExpression ::= StringExpression ["NOT"] "LIKE" StringPrimary ["ESCAPE" char]
NullComparisonExpression ::= (InputParameter | NullIfExpression | CoalesceExpression | SingleValuedPathExpression | ResultVariable) "IS" ["NOT"] "NULL"
NullComparisonExpression ::= (InputParameter | NullIfExpression | CoalesceExpression | AggregateExpression | FunctionDeclaration | IdentificationVariable | SingleValuedPathExpression | ResultVariable) "IS" ["NOT"] "NULL"
ExistsExpression ::= ["NOT"] "EXISTS" "(" Subselect ")"
ComparisonOperator ::= "=" | "<" | "<=" | "<>" | ">" | ">=" | "!="

View File

@ -3131,7 +3131,7 @@ class Parser
}
/**
* NullComparisonExpression ::= (InputParameter | NullIfExpression | CoalesceExpression | SingleValuedPathExpression | ResultVariable) "IS" ["NOT"] "NULL"
* NullComparisonExpression ::= (InputParameter | NullIfExpression | CoalesceExpression | AggregateExpression | FunctionDeclaration | IdentificationVariable | SingleValuedPathExpression | ResultVariable) "IS" ["NOT"] "NULL"
*
* @return \Doctrine\ORM\Query\AST\NullComparisonExpression
*/
@ -3151,6 +3151,10 @@ class Parser
case $this->lexer->isNextToken(Lexer::T_COALESCE):
$expr = $this->CoalesceExpression();
break;
case $this->isAggregateFunction($this->lexer->lookahead['type']):
$expr = $this->AggregateExpression();
break;
case $this->isFunction():
$expr = $this->FunctionDeclaration();

View File

@ -2062,6 +2062,11 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase
'SELECT u.name FROM Doctrine\Tests\Models\CMS\CmsUser u HAVING u.username IS NULL',
'SELECT c0_.name AS name_0 FROM cms_users c0_ HAVING c0_.username IS NULL'
);
$this->assertSqlGeneration(
'SELECT u.name FROM Doctrine\Tests\Models\CMS\CmsUser u HAVING MAX(u.name) IS NULL',
'SELECT c0_.name AS name_0 FROM cms_users c0_ HAVING MAX(c0_.name) IS NULL'
);
}
/**