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
81d39c50
Commit
81d39c50
authored
Jun 26, 2007
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--no commit message
--no commit message
parent
d70e1041
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
4 deletions
+13
-4
Query.php
lib/Doctrine/Query.php
+11
-2
SubqueryTestCase.php
tests/Query/SubqueryTestCase.php
+2
-2
No files found.
lib/Doctrine/Query.php
View file @
81d39c50
...
@@ -1249,15 +1249,23 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable
...
@@ -1249,15 +1249,23 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable
// initialize temporary variables
// initialize temporary variables
$where
=
$this
->
parts
[
'where'
];
$where
=
$this
->
parts
[
'where'
];
$having
=
$this
->
parts
[
'having'
];
$having
=
$this
->
parts
[
'having'
];
$groupby
=
$this
->
parts
[
'groupby'
];
$map
=
reset
(
$this
->
_aliasMap
);
$map
=
reset
(
$this
->
_aliasMap
);
$componentAlias
=
key
(
$this
->
_aliasMap
);
$componentAlias
=
key
(
$this
->
_aliasMap
);
$table
=
$map
[
'table'
];
$table
=
$map
[
'table'
];
// build the query base
// build the query base
$q
=
'SELECT COUNT(DISTINCT '
.
$this
->
getTableAlias
(
$componentAlias
)
$q
=
'SELECT COUNT(DISTINCT '
.
$this
->
getTableAlias
(
$componentAlias
)
.
'.'
.
$table
->
getIdentifier
()
.
'.'
.
$table
->
getIdentifier
()
.
') FROM '
.
$this
->
buildFromPart
();
.
')'
;
foreach
(
$this
->
parts
[
'select'
]
as
$field
)
{
if
(
strpos
(
$field
,
'('
)
!==
false
)
{
$q
.=
', '
.
$field
;
}
}
$q
.=
' FROM '
.
$this
->
buildFromPart
();
// append column aggregation inheritance (if needed)
// append column aggregation inheritance (if needed)
$string
=
$this
->
applyInheritance
();
$string
=
$this
->
applyInheritance
();
...
@@ -1267,6 +1275,7 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable
...
@@ -1267,6 +1275,7 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable
}
}
// append conditions
// append conditions
$q
.=
(
!
empty
(
$where
))
?
' WHERE '
.
implode
(
' AND '
,
$where
)
:
''
;
$q
.=
(
!
empty
(
$where
))
?
' WHERE '
.
implode
(
' AND '
,
$where
)
:
''
;
$q
.=
(
!
empty
(
$groupby
))
?
' GROUP BY '
.
implode
(
', '
,
$groupby
)
:
''
;
$q
.=
(
!
empty
(
$having
))
?
' HAVING '
.
implode
(
' AND '
,
$having
)
:
''
;
$q
.=
(
!
empty
(
$having
))
?
' HAVING '
.
implode
(
' AND '
,
$having
)
:
''
;
if
(
!
is_array
(
$params
))
{
if
(
!
is_array
(
$params
))
{
...
...
tests/Query/SubqueryTestCase.php
View file @
81d39c50
...
@@ -123,8 +123,8 @@ class Doctrine_Query_Subquery_TestCase extends Doctrine_UnitTestCase
...
@@ -123,8 +123,8 @@ class Doctrine_Query_Subquery_TestCase extends Doctrine_UnitTestCase
try
{
try
{
$q
->
count
();
$q
->
count
();
$this
->
pass
();
}
catch
(
Doctrine_Exception
$e
)
{
}
catch
(
Doctrine_Exception
$e
)
{
$this
->
fail
();
$this
->
fail
();
}
}
}
}
...
...
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