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
e69d1cf3
Commit
e69d1cf3
authored
Jul 15, 2016
by
Marco Pivetta
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'fix/#2292-do-not-generate-sql-from-with-no-tables' into 2.5
Close #2292
parents
bc85f142
e937f37a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
2 deletions
+14
-2
QueryBuilder.php
lib/Doctrine/DBAL/Query/QueryBuilder.php
+2
-2
QueryBuilderTest.php
tests/Doctrine/Tests/DBAL/Query/QueryBuilderTest.php
+12
-0
No files found.
lib/Doctrine/DBAL/Query/QueryBuilder.php
View file @
e69d1cf3
...
...
@@ -1107,9 +1107,9 @@ class QueryBuilder
*/
private
function
getSQLForSelect
()
{
$query
=
'SELECT '
.
implode
(
', '
,
$this
->
sqlParts
[
'select'
])
.
' FROM '
;
$query
=
'SELECT '
.
implode
(
', '
,
$this
->
sqlParts
[
'select'
]);
$query
.=
implode
(
', '
,
$this
->
getFromClauses
()
)
$query
.=
(
$this
->
sqlParts
[
'from'
]
?
' FROM '
.
implode
(
', '
,
$this
->
getFromClauses
())
:
''
)
.
(
$this
->
sqlParts
[
'where'
]
!==
null
?
' WHERE '
.
((
string
)
$this
->
sqlParts
[
'where'
])
:
''
)
.
(
$this
->
sqlParts
[
'groupBy'
]
?
' GROUP BY '
.
implode
(
', '
,
$this
->
sqlParts
[
'groupBy'
])
:
''
)
.
(
$this
->
sqlParts
[
'having'
]
!==
null
?
' HAVING '
.
((
string
)
$this
->
sqlParts
[
'having'
])
:
''
)
...
...
tests/Doctrine/Tests/DBAL/Query/QueryBuilderTest.php
View file @
e69d1cf3
...
...
@@ -25,6 +25,18 @@ class QueryBuilderTest extends \Doctrine\Tests\DbalTestCase
->
will
(
$this
->
returnValue
(
$expressionBuilder
));
}
/**
* @group DBAL-2291
*/
public
function
testSimpleSelectWithoutFrom
()
{
$qb
=
new
QueryBuilder
(
$this
->
conn
);
$qb
->
select
(
'some_function()'
);
$this
->
assertEquals
(
'SELECT some_function()'
,
(
string
)
$qb
);
}
public
function
testSimpleSelect
()
{
$qb
=
new
QueryBuilder
(
$this
->
conn
);
...
...
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