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
dd73f6de
Commit
dd73f6de
authored
Oct 26, 2006
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #205
parent
53bdc31a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
6 deletions
+12
-6
Query.php
lib/Doctrine/Query.php
+10
-4
run.php
tests/run.php
+2
-2
No files found.
lib/Doctrine/Query.php
View file @
dd73f6de
...
...
@@ -488,12 +488,18 @@ class Doctrine_Query extends Doctrine_Hydrate implements Countable {
$dbh
=
$this
->
connection
->
getDBH
();
// mysql doesn't support LIMIT in subqueries
if
(
$dbh
->
getAttribute
(
PDO
::
ATTR_DRIVER_NAME
)
==
'mysql'
)
{
$list
=
$dbh
->
query
(
$subquery
)
->
fetchAll
(
PDO
::
FETCH_NUM
);
switch
(
$dbh
->
getAttribute
(
PDO
::
ATTR_DRIVER_NAME
))
{
case
'mysql'
:
$list
=
$dbh
->
query
(
$subquery
)
->
fetchAll
(
PDO
::
FETCH_COLUMN
);
$subquery
=
implode
(
', '
,
$list
);
break
;
case
'pgsql'
:
$subquery
=
'SELECT doctrine_subquery_alias.'
.
$table
->
getIdentifier
()
.
' FROM ('
.
$subquery
.
') AS doctrine_subquery_alias'
;
break
;
}
$field
=
$table
->
getTableName
()
.
'.'
.
$table
->
getIdentifier
();
array_unshift
(
$this
->
parts
[
'where'
],
$field
.
' IN ('
.
$subquery
.
')'
);
array_unshift
(
$this
->
parts
[
'where'
],
$field
.
' IN ('
.
$subquery
.
')'
);
$modifyLimit
=
false
;
}
}
...
...
@@ -550,7 +556,7 @@ class Doctrine_Query extends Doctrine_Hydrate implements Countable {
$subquery
.=
(
!
empty
(
$this
->
parts
[
'groupby'
]))
?
' GROUP BY '
.
implode
(
', '
,
$this
->
parts
[
'groupby'
])
:
''
;
$subquery
.=
(
!
empty
(
$this
->
parts
[
'having'
]))
?
' HAVING '
.
implode
(
' '
,
$this
->
parts
[
'having'
])
:
''
;
$subquery
.=
(
!
empty
(
$this
->
parts
[
'orderby'
]))
?
' ORDER BY '
.
implode
(
' '
,
$this
->
parts
[
'orderby'
])
:
''
;
// add driver specific limit clause
$subquery
=
$this
->
connection
->
modifyLimitQuery
(
$subquery
,
$this
->
parts
[
'limit'
],
$this
->
parts
[
'offset'
]);
...
...
tests/run.php
View file @
dd73f6de
...
...
@@ -63,7 +63,7 @@ error_reporting(E_ALL);
print
'<pre>'
;
$test
=
new
GroupTest
(
'Doctrine Framework Unit Tests'
);
/**
$test
->
addTestCase
(
new
Doctrine_DataDict_Pgsql_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Relation_TestCase
());
...
...
@@ -147,7 +147,7 @@ $test->addTestCase(new Doctrine_Query_Select_TestCase());
$test
->
addTestCase
(
new
Doctrine_Query_Delete_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Query_Update_TestCase
());
*/
$test
->
addTestCase
(
new
Doctrine_Query_Limit_TestCase
());
...
...
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