Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
cd50fc38
Commit
cd50fc38
authored
Aug 04, 2009
by
guilhermeblanco
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[2.0] Implemented EmptyCollectionComparisonExpression. Need to write SQL transformation yet.
parent
462a27ee
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
276 additions
and
96 deletions
+276
-96
Lexer.php
lib/Doctrine/ORM/Query/Lexer.php
+37
-35
Parser.php
lib/Doctrine/ORM/Query/Parser.php
+39
-7
SqlWalker.php
lib/Doctrine/ORM/Query/SqlWalker.php
+184
-54
TreeWalker.php
lib/Doctrine/ORM/Query/TreeWalker.php
+8
-0
TreeWalkerAdapter.php
lib/Doctrine/ORM/Query/TreeWalkerAdapter.php
+8
-0
No files found.
lib/Doctrine/ORM/Query/Lexer.php
View file @
cd50fc38
...
...
@@ -55,41 +55,42 @@ class Lexer
const
T_DESC
=
112
;
const
T_DISTINCT
=
113
;
const
T_DOT
=
114
;
const
T_ESCAPE
=
115
;
const
T_EXISTS
=
116
;
const
T_FROM
=
117
;
const
T_GROUP
=
118
;
const
T_HAVING
=
119
;
const
T_IN
=
120
;
const
T_INDEX
=
121
;
const
T_INNER
=
122
;
const
T_IS
=
123
;
const
T_JOIN
=
124
;
const
T_LEFT
=
125
;
const
T_LIKE
=
126
;
const
T_LIMIT
=
127
;
const
T_MAX
=
128
;
const
T_MIN
=
129
;
const
T_MOD
=
130
;
const
T_NOT
=
131
;
const
T_NULL
=
132
;
const
T_OFFSET
=
133
;
const
T_ON
=
134
;
const
T_OR
=
135
;
const
T_ORDER
=
136
;
const
T_OUTER
=
137
;
const
T_SELECT
=
138
;
const
T_SET
=
139
;
const
T_SIZE
=
140
;
const
T_SOME
=
141
;
const
T_SUM
=
142
;
const
T_UPDATE
=
143
;
const
T_WHERE
=
144
;
const
T_WITH
=
145
;
const
T_TRUE
=
146
;
const
T_FALSE
=
147
;
const
T_MEMBER
=
148
;
const
T_OF
=
149
;
const
T_EMPTY
=
115
;
const
T_ESCAPE
=
116
;
const
T_EXISTS
=
117
;
const
T_FROM
=
118
;
const
T_GROUP
=
119
;
const
T_HAVING
=
120
;
const
T_IN
=
121
;
const
T_INDEX
=
122
;
const
T_INNER
=
123
;
const
T_IS
=
124
;
const
T_JOIN
=
125
;
const
T_LEFT
=
126
;
const
T_LIKE
=
127
;
const
T_LIMIT
=
128
;
const
T_MAX
=
129
;
const
T_MIN
=
130
;
const
T_MOD
=
131
;
const
T_NOT
=
132
;
const
T_NULL
=
133
;
const
T_OFFSET
=
134
;
const
T_ON
=
135
;
const
T_OR
=
136
;
const
T_ORDER
=
137
;
const
T_OUTER
=
138
;
const
T_SELECT
=
139
;
const
T_SET
=
140
;
const
T_SIZE
=
141
;
const
T_SOME
=
142
;
const
T_SUM
=
143
;
const
T_UPDATE
=
144
;
const
T_WHERE
=
145
;
const
T_WITH
=
146
;
const
T_TRUE
=
147
;
const
T_FALSE
=
148
;
const
T_MEMBER
=
149
;
const
T_OF
=
150
;
private
$_keywordsTable
;
...
...
@@ -354,6 +355,7 @@ class Lexer
self
::
T_DESC
=>
"DESC"
,
self
::
T_DISTINCT
=>
"DISTINCT"
,
self
::
T_DOT
=>
"."
,
self
::
T_EMPTY
=>
"EMPTY"
,
self
::
T_ESCAPE
=>
"ESCAPE"
,
self
::
T_EXISTS
=>
"EXISTS"
,
self
::
T_FALSE
=>
"FALSE"
,
...
...
lib/Doctrine/ORM/Query/Parser.php
View file @
cd50fc38
...
...
@@ -1639,7 +1639,7 @@ class Parser
* InExpression | NullComparisonExpression | ExistsExpression |
* EmptyCollectionComparisonExpression | CollectionMemberExpression
*
* @todo Pos
y
2.0 release. Missing EmptyCollectionComparisonExpression implementation
* @todo Pos
t
2.0 release. Missing EmptyCollectionComparisonExpression implementation
*/
public
function
SimpleConditionalExpression
()
{
...
...
@@ -1669,9 +1669,18 @@ class Parser
if
(
$peek
[
'type'
]
===
Lexer
::
T_NOT
)
{
$peek
=
$this
->
_lexer
->
peek
();
}
$this
->
_lexer
->
resetPeek
();
$token
=
$peek
;
// We need to go even further in case of IS (differenciate between NULL and EMPTY)
$lookahead
=
$this
->
_lexer
->
peek
();
// Also peek beyond a NOT if there is one
if
(
$lookahead
[
'type'
]
===
Lexer
::
T_NOT
)
{
$lookahead
=
$this
->
_lexer
->
peek
();
}
$this
->
_lexer
->
resetPeek
();
}
if
(
$pathExprOrInputParam
)
{
...
...
@@ -1689,7 +1698,11 @@ class Parser
return
$this
->
InExpression
();
case
Lexer
::
T_IS
:
return
$this
->
NullComparisonExpression
();
if
(
$lookahead
[
'type'
]
==
Lexer
::
T_NULL
)
{
return
$this
->
NullComparisonExpression
();
}
return
$this
->
EmptyCollectionComparisonExpression
();
case
Lexer
::
T_MEMBER
:
return
$this
->
CollectionMemberExpression
();
...
...
@@ -1703,6 +1716,28 @@ class Parser
}
/**
* EmptyCollectionComparisonExpression ::= CollectionValuedPathExpression "IS" ["NOT"] "EMPTY"
*
* @return \Doctrine\ORM\Query\AST\EmptyCollectionComparisonExpression
*/
public
function
EmptyCollectionComparisonExpression
()
{
$emptyColletionCompExpr
=
new
AST\EmptyCollectionComparisonExpression
(
$this
->
CollectionValuedPathExpression
()
);
$this
->
match
(
Lexer
::
T_IS
);
if
(
$this
->
_lexer
->
isNextToken
(
Lexer
::
T_NOT
))
{
$this
->
match
(
Lexer
::
T_NOT
);
$emptyColletionCompExpr
->
setNot
(
true
);
}
$this
->
match
(
Lexer
::
T_EMPTY
);
return
$emptyColletionCompExpr
;
}
/**
* CollectionMemberExpression ::= EntityExpression ["NOT"] "MEMBER" ["OF"] CollectionValuedPathExpression
*
...
...
@@ -2122,9 +2157,6 @@ class Parser
/**
* ComparisonExpression ::= ArithmeticExpression ComparisonOperator ( QuantifiedExpression | ArithmeticExpression )
*
* @return AST\ComparisonExpression
* @todo Semantical checks whether $leftExpr $operator and $rightExpr are compatible.
*
* @return \Doctrine\ORM\Query\AST\ComparisonExpression
*/
public
function
ComparisonExpression
()
...
...
lib/Doctrine/ORM/Query/SqlWalker.php
View file @
cd50fc38
This diff is collapsed.
Click to expand it.
lib/Doctrine/ORM/Query/TreeWalker.php
View file @
cd50fc38
...
...
@@ -249,6 +249,14 @@ interface TreeWalker
* @return string The SQL.
*/
function
walkCollectionMemberExpression
(
$collMemberExpr
);
/**
* Walks down an EmptyCollectionComparisonExpression AST node, thereby generating the appropriate SQL.
*
* @param EmptyCollectionComparisonExpression
* @return string The SQL.
*/
function
walkEmptyCollectionComparisonExpression
(
$emptyCollCompExpr
);
/**
* Walks down a NullComparisonExpression AST node, thereby generating the appropriate SQL.
...
...
lib/Doctrine/ORM/Query/TreeWalkerAdapter.php
View file @
cd50fc38
...
...
@@ -247,6 +247,14 @@ abstract class TreeWalkerAdapter implements TreeWalker
*/
public
function
walkCollectionMemberExpression
(
$collMemberExpr
)
{}
/**
* Walks down an EmptyCollectionComparisonExpression AST node, thereby generating the appropriate SQL.
*
* @param EmptyCollectionComparisonExpression
* @return string The SQL.
*/
public
function
walkEmptyCollectionComparisonExpression
(
$emptyCollCompExpr
)
{}
/**
* Walks down a NullComparisonExpression AST node, thereby generating the appropriate SQL.
*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment