DDC-1802 fixed parsing: FunctionDeclaration "NOT" ("LIKE" | "IN" | "BETWEEN")
This commit is contained in:
parent
0a09a28ec9
commit
3ab6ad23ad
@ -416,9 +416,10 @@ class Parser
|
|||||||
/**
|
/**
|
||||||
* Peek beyond the matched closing parenthesis and return the first token after that one.
|
* Peek beyond the matched closing parenthesis and return the first token after that one.
|
||||||
*
|
*
|
||||||
|
* @param boolean $resetPeek Reset peek after finding the closing parenthesis
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
private function _peekBeyondClosingParenthesis()
|
private function _peekBeyondClosingParenthesis($resetPeek = true)
|
||||||
{
|
{
|
||||||
$token = $this->_lexer->peek();
|
$token = $this->_lexer->peek();
|
||||||
$numUnmatched = 1;
|
$numUnmatched = 1;
|
||||||
@ -440,7 +441,9 @@ class Parser
|
|||||||
$token = $this->_lexer->peek();
|
$token = $this->_lexer->peek();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($resetPeek) {
|
||||||
$this->_lexer->resetPeek();
|
$this->_lexer->resetPeek();
|
||||||
|
}
|
||||||
|
|
||||||
return $token;
|
return $token;
|
||||||
}
|
}
|
||||||
@ -2206,7 +2209,13 @@ class Parser
|
|||||||
if ($peek['value'] == '(') {
|
if ($peek['value'] == '(') {
|
||||||
// Peek beyond the matching closing paranthesis ')'
|
// Peek beyond the matching closing paranthesis ')'
|
||||||
$this->_lexer->peek();
|
$this->_lexer->peek();
|
||||||
$token = $this->_peekBeyondClosingParenthesis();
|
$token = $this->_peekBeyondClosingParenthesis(false);
|
||||||
|
|
||||||
|
if ($token['type'] === Lexer::T_NOT) {
|
||||||
|
$token = $this->_lexer->peek();
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->_lexer->resetPeek();
|
||||||
} else {
|
} else {
|
||||||
// Peek beyond the PathExpression (or InputParameter)
|
// Peek beyond the PathExpression (or InputParameter)
|
||||||
$peek = $this->_lexer->peek();
|
$peek = $this->_lexer->peek();
|
||||||
|
@ -854,6 +854,26 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @group DDC-1802
|
||||||
|
*/
|
||||||
|
public function testStringFunctionNotLikeExpression()
|
||||||
|
{
|
||||||
|
$this->assertSqlGeneration(
|
||||||
|
"SELECT u.name FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE LOWER(u.name) NOT LIKE '%foo OR bar%'",
|
||||||
|
"SELECT c0_.name AS name0 FROM cms_users c0_ WHERE LOWER(c0_.name) NOT LIKE '%foo OR bar%'"
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->assertSqlGeneration(
|
||||||
|
"SELECT u.name FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE UPPER(LOWER(u.name)) NOT LIKE UPPER(LOWER(:str))",
|
||||||
|
"SELECT c0_.name AS name0 FROM cms_users c0_ WHERE UPPER(LOWER(c0_.name)) NOT LIKE UPPER(LOWER(?))"
|
||||||
|
);
|
||||||
|
$this->assertSqlGeneration(
|
||||||
|
"SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u LEFT JOIN u.articles a WITH a.topic NOT LIKE u.name",
|
||||||
|
"SELECT c0_.id AS id0, c0_.status AS status1, c0_.username AS username2, c0_.name AS name3 FROM cms_users c0_ LEFT JOIN cms_articles c1_ ON c0_.id = c1_.user_id AND (c1_.topic NOT LIKE c0_.name)"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @group DDC-338
|
* @group DDC-338
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user