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
d56cafa0
Commit
d56cafa0
authored
Jul 31, 2014
by
jeroendedauw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make code Ocramius certified
parent
077abc6a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
8 deletions
+15
-8
QueryBuilder.php
lib/Doctrine/DBAL/Query/QueryBuilder.php
+15
-8
No files found.
lib/Doctrine/DBAL/Query/QueryBuilder.php
View file @
d56cafa0
...
@@ -1087,9 +1087,7 @@ class QueryBuilder
...
@@ -1087,9 +1087,7 @@ class QueryBuilder
{
{
$query
=
'SELECT '
.
implode
(
', '
,
$this
->
sqlParts
[
'select'
])
.
' FROM '
;
$query
=
'SELECT '
.
implode
(
', '
,
$this
->
sqlParts
[
'select'
])
.
' FROM '
;
$fromClauses
=
$this
->
getFromClauses
();
$query
.=
implode
(
', '
,
$this
->
getFromClauses
())
$query
.=
implode
(
', '
,
$fromClauses
)
.
(
$this
->
sqlParts
[
'where'
]
!==
null
?
' WHERE '
.
((
string
)
$this
->
sqlParts
[
'where'
])
:
''
)
.
(
$this
->
sqlParts
[
'where'
]
!==
null
?
' WHERE '
.
((
string
)
$this
->
sqlParts
[
'where'
])
:
''
)
.
(
$this
->
sqlParts
[
'groupBy'
]
?
' GROUP BY '
.
implode
(
', '
,
$this
->
sqlParts
[
'groupBy'
])
:
''
)
.
(
$this
->
sqlParts
[
'groupBy'
]
?
' GROUP BY '
.
implode
(
', '
,
$this
->
sqlParts
[
'groupBy'
])
:
''
)
.
(
$this
->
sqlParts
[
'having'
]
!==
null
?
' HAVING '
.
((
string
)
$this
->
sqlParts
[
'having'
])
:
''
)
.
(
$this
->
sqlParts
[
'having'
]
!==
null
?
' HAVING '
.
((
string
)
$this
->
sqlParts
[
'having'
])
:
''
)
...
@@ -1106,6 +1104,9 @@ class QueryBuilder
...
@@ -1106,6 +1104,9 @@ class QueryBuilder
return
$query
;
return
$query
;
}
}
/**
* @return string[]
*/
private
function
getFromClauses
()
private
function
getFromClauses
()
{
{
$fromClauses
=
array
();
$fromClauses
=
array
();
...
@@ -1113,19 +1114,17 @@ class QueryBuilder
...
@@ -1113,19 +1114,17 @@ class QueryBuilder
// Loop through all FROM clauses
// Loop through all FROM clauses
foreach
(
$this
->
sqlParts
[
'from'
]
as
$from
)
{
foreach
(
$this
->
sqlParts
[
'from'
]
as
$from
)
{
if
(
$from
[
'alias'
]
===
null
)
{
if
(
$from
[
'alias'
]
===
null
)
{
$tableSql
=
$from
[
'table'
];
$tableSql
=
$from
[
'table'
];
$tableReference
=
$from
[
'table'
];
$tableReference
=
$from
[
'table'
];
}
}
else
{
else
{
$tableSql
=
$from
[
'table'
]
.
' '
.
$from
[
'alias'
];
$tableSql
=
$from
[
'table'
]
.
' '
.
$from
[
'alias'
];
$tableReference
=
$from
[
'alias'
];
$tableReference
=
$from
[
'alias'
];
}
}
$knownAliases
[
$tableReference
]
=
true
;
$knownAliases
[
$tableReference
]
=
true
;
$fromClauses
[
$tableReference
]
=
$tableSql
$fromClauses
[
$tableReference
]
=
$tableSql
.
$this
->
getSQLForJoins
(
$tableReference
,
$knownAliases
);
.
$this
->
getSQLForJoins
(
$tableReference
,
$knownAliases
);
}
}
$this
->
verifyAllAliasesAreKnown
(
$knownAliases
);
$this
->
verifyAllAliasesAreKnown
(
$knownAliases
);
...
@@ -1133,6 +1132,11 @@ class QueryBuilder
...
@@ -1133,6 +1132,11 @@ class QueryBuilder
return
$fromClauses
;
return
$fromClauses
;
}
}
/**
* @param array $knownAliases
*
* @throws QueryException
*/
private
function
verifyAllAliasesAreKnown
(
array
$knownAliases
)
private
function
verifyAllAliasesAreKnown
(
array
$knownAliases
)
{
{
foreach
(
$this
->
sqlParts
[
'join'
]
as
$fromAlias
=>
$joins
)
{
foreach
(
$this
->
sqlParts
[
'join'
]
as
$fromAlias
=>
$joins
)
{
...
@@ -1142,6 +1146,9 @@ class QueryBuilder
...
@@ -1142,6 +1146,9 @@ class QueryBuilder
}
}
}
}
/**
* @return bool
*/
private
function
isLimitQuery
()
private
function
isLimitQuery
()
{
{
return
$this
->
maxResults
!==
null
||
$this
->
firstResult
!==
null
;
return
$this
->
maxResults
!==
null
||
$this
->
firstResult
!==
null
;
...
...
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