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
2c3b8bab
Commit
2c3b8bab
authored
Nov 16, 2006
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed limit subquery handling on mysql with prepared statements, fixes #231
parent
6daa1e34
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
14 deletions
+18
-14
Connection.php
lib/Doctrine/Connection.php
+1
-0
Hydrate.php
lib/Doctrine/Hydrate.php
+9
-9
Query.php
lib/Doctrine/Query.php
+8
-5
No files found.
lib/Doctrine/Connection.php
View file @
2c3b8bab
...
...
@@ -127,6 +127,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
* @see Doctrine_Expression
* @see Doctrine_Export
* @see Doctrine_Transaction
* @see Doctrine_Connection::$modules all availible modules
* @param string $name the name of the module to get
* @throws Doctrine_Connection_Exception if trying to get an unknown module
* @return Doctrine_Connection_Module connection module
...
...
lib/Doctrine/Hydrate.php
View file @
2c3b8bab
...
...
@@ -24,14 +24,14 @@ Doctrine::autoload('Doctrine_Access');
* Its purpose is to populate object graphs.
*
*
* @package Doctrine
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @category Object Relational Mapping
* @link www.phpdoctrine.com
* @since 1.0
* @version $Revision$
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
*/
* @package Doctrine
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @category Object Relational Mapping
* @link www.phpdoctrine.com
* @since 1.0
* @version $Revision$
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
*/
abstract
class
Doctrine_Hydrate
extends
Doctrine_Access
{
/**
* @var array $fetchmodes an array containing all fetchmodes
...
...
@@ -339,7 +339,7 @@ abstract class Doctrine_Hydrate extends Doctrine_Access {
array_walk
(
$params
,
array
(
__CLASS__
,
'convertBoolean'
));
if
(
!
$this
->
view
)
$query
=
$this
->
getQuery
(
true
);
$query
=
$this
->
getQuery
(
$params
);
else
$query
=
$this
->
view
->
getSelectSql
();
...
...
lib/Doctrine/Query.php
View file @
2c3b8bab
...
...
@@ -466,9 +466,11 @@ class Doctrine_Query extends Doctrine_Hydrate implements Countable {
/**
* returns the built sql query
*
* @param array $params an array of prepared statement params (needed only in mysql driver
* when limit subquery algorithm is used)
* @return string
*/
public
function
getQuery
(
$
executeSubquery
=
false
)
{
public
function
getQuery
(
$
params
=
array
()
)
{
if
(
empty
(
$this
->
parts
[
"select"
])
||
empty
(
$this
->
parts
[
"from"
]))
return
false
;
...
...
@@ -512,15 +514,16 @@ class Doctrine_Query extends Doctrine_Hydrate implements Countable {
if
(
$needsSubQuery
)
{
$subquery
=
$this
->
getLimitSubquery
();
$dbh
=
$this
->
connection
->
getDBH
();
// mysql doesn't support LIMIT in subqueries
switch
(
$dbh
->
getAttribute
(
PDO
::
ATTR_DRIVER_NAME
))
{
switch
(
strtolower
(
$this
->
connection
->
getName
()
))
{
case
'mysql'
:
$list
=
$dbh
->
query
(
$subquery
)
->
fetchAll
(
PDO
::
FETCH_COLUMN
);
// mysql doesn't support LIMIT in subqueries
$list
=
$this
->
conn
->
execute
(
$subquery
,
$params
)
->
fetchAll
(
PDO
::
FETCH_COLUMN
);
$subquery
=
implode
(
', '
,
$list
);
break
;
case
'pgsql'
:
// pgsql needs special nested LIMIT subquery
$subquery
=
'SELECT doctrine_subquery_alias.'
.
$table
->
getIdentifier
()
.
' FROM ('
.
$subquery
.
') AS doctrine_subquery_alias'
;
break
;
}
...
...
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