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
755f30f6
Commit
755f30f6
authored
May 24, 2007
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--no commit message
--no commit message
parent
df773520
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
25 deletions
+27
-25
Hydrate.php
lib/Doctrine/Hydrate.php
+16
-14
Query.php
lib/Doctrine/Query.php
+11
-11
No files found.
lib/Doctrine/Hydrate.php
View file @
755f30f6
...
...
@@ -66,7 +66,7 @@ class Doctrine_Hydrate
/**
* @var Doctrine_Connection $conn Doctrine_Connection object
*/
protected
$conn
;
protected
$
_
conn
;
/**
* @var Doctrine_View $_view Doctrine_View object, when set this object will use the
* the query given by the view object for object population
...
...
@@ -94,11 +94,6 @@ class Doctrine_Hydrate
* and values as sql aliases
*/
protected
$aggregateMap
=
array
();
/**
* @var Doctrine_Hydrate_Alias $aliasHandler handles the creation and storage of table aliases and
* binds the aliases to component aliases / paths
*/
protected
$aliasHandler
;
/**
* @var array $parts SQL query string parts
*/
...
...
@@ -136,7 +131,7 @@ class Doctrine_Hydrate
if
(
!
(
$connection
instanceof
Doctrine_Connection
))
{
$connection
=
Doctrine_Manager
::
getInstance
()
->
getCurrentConnection
();
}
$this
->
conn
=
$connection
;
$this
->
_
conn
=
$connection
;
}
public
function
generateNewAlias
(
$alias
)
{
...
...
@@ -262,10 +257,16 @@ class Doctrine_Hydrate
}
/**
* copyAliases
* copy aliases from another Hydrate object
*
* @return void
* this method is needed by DQL subqueries which need the aliases
* of the parent query
*
* @param Doctrine_Hydrate $query the query object from which the
* aliases are copied from
* @return Doctrine_Hydrate this object
*/
public
function
copyAliases
(
$query
)
public
function
copyAliases
(
Doctrine_Hydrate
$query
)
{
$this
->
shortAliases
=
$query
->
shortAliases
;
...
...
@@ -273,6 +274,7 @@ class Doctrine_Hydrate
}
/**
* createSubquery
* creates a subquery
*
* @return Doctrine_Hydrate
*/
...
...
@@ -353,7 +355,7 @@ class Doctrine_Hydrate
*/
public
function
getConnection
()
{
return
$this
->
conn
;
return
$this
->
_
conn
;
}
/**
* setView
...
...
@@ -443,7 +445,7 @@ class Doctrine_Hydrate
*/
public
function
execute
(
$params
=
array
(),
$return
=
Doctrine
::
FETCH_RECORD
)
{
$params
=
$this
->
conn
->
convertBooleans
(
array_merge
(
$this
->
params
,
$params
));
$params
=
$this
->
_
conn
->
convertBooleans
(
array_merge
(
$this
->
params
,
$params
));
$params
=
$this
->
convertEnums
(
$params
);
if
(
!
$this
->
_view
)
{
...
...
@@ -453,16 +455,16 @@ class Doctrine_Hydrate
}
if
(
$this
->
isLimitSubqueryUsed
()
&&
$this
->
conn
->
getDBH
()
->
getAttribute
(
Doctrine
::
ATTR_DRIVER_NAME
)
!==
'mysql'
)
{
$this
->
_
conn
->
getDBH
()
->
getAttribute
(
Doctrine
::
ATTR_DRIVER_NAME
)
!==
'mysql'
)
{
$params
=
array_merge
(
$params
,
$params
);
}
if
(
$this
->
type
!==
self
::
SELECT
)
{
return
$this
->
conn
->
exec
(
$query
,
$params
);
return
$this
->
_
conn
->
exec
(
$query
,
$params
);
}
$stmt
=
$this
->
conn
->
execute
(
$query
,
$params
);
$stmt
=
$this
->
_
conn
->
execute
(
$query
,
$params
);
$array
=
(
array
)
$this
->
parseData
(
$stmt
);
if
(
empty
(
$this
->
_aliasMap
))
{
throw
new
Doctrine_Hydrate_Exception
(
"Couldn't execute query. Component alias map was empty."
);
...
...
lib/Doctrine/Query.php
View file @
755f30f6
...
...
@@ -379,7 +379,7 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable
$argStr
=
substr
(
$func
,
(
$pos
+
1
),
-
1
);
$args
=
explode
(
','
,
$argStr
);
$func
=
call_user_func_array
(
array
(
$this
->
conn
->
expression
,
$name
),
$args
);
$func
=
call_user_func_array
(
array
(
$this
->
_
conn
->
expression
,
$name
),
$args
);
if
(
substr
(
$func
,
0
,
1
)
!==
'('
)
{
$pos
=
strpos
(
$func
,
'('
);
...
...
@@ -641,10 +641,10 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable
$subquery
=
$this
->
getLimitSubquery
();
switch
(
strtolower
(
$this
->
conn
->
getName
()))
{
switch
(
strtolower
(
$this
->
_
conn
->
getName
()))
{
case
'mysql'
:
// mysql doesn't support LIMIT in subqueries
$list
=
$this
->
conn
->
execute
(
$subquery
,
$params
)
->
fetchAll
(
PDO
::
FETCH_COLUMN
);
$list
=
$this
->
_
conn
->
execute
(
$subquery
,
$params
)
->
fetchAll
(
PDO
::
FETCH_COLUMN
);
$subquery
=
implode
(
', '
,
$list
);
break
;
case
'pgsql'
:
...
...
@@ -670,7 +670,7 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable
$q
.=
(
!
empty
(
$this
->
parts
[
'orderby'
]))
?
' ORDER BY '
.
implode
(
', '
,
$this
->
parts
[
'orderby'
])
:
''
;
if
(
$modifyLimit
)
{
$q
=
$this
->
conn
->
modifyLimitQuery
(
$q
,
$this
->
parts
[
'limit'
],
$this
->
parts
[
'offset'
]);
$q
=
$this
->
_
conn
->
modifyLimitQuery
(
$q
,
$this
->
parts
[
'limit'
],
$this
->
parts
[
'offset'
]);
}
// return to the previous state
...
...
@@ -710,7 +710,7 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable
// initialize the base of the subquery
$subquery
=
'SELECT DISTINCT '
.
$primaryKey
;
if
(
$this
->
conn
->
getDBH
()
->
getAttribute
(
PDO
::
ATTR_DRIVER_NAME
)
==
'pgsql'
)
{
if
(
$this
->
_
conn
->
getDBH
()
->
getAttribute
(
PDO
::
ATTR_DRIVER_NAME
)
==
'pgsql'
)
{
// pgsql needs the order by fields to be preserved in select clause
foreach
(
$this
->
parts
[
'orderby'
]
as
$part
)
{
...
...
@@ -746,7 +746,7 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable
$subquery
.=
(
!
empty
(
$this
->
parts
[
'orderby'
]))
?
' ORDER BY '
.
implode
(
', '
,
$this
->
parts
[
'orderby'
])
:
''
;
// add driver specific limit clause
$subquery
=
$this
->
conn
->
modifyLimitQuery
(
$subquery
,
$this
->
parts
[
'limit'
],
$this
->
parts
[
'offset'
]);
$subquery
=
$this
->
_
conn
->
modifyLimitQuery
(
$subquery
,
$this
->
parts
[
'limit'
],
$this
->
parts
[
'offset'
]);
$parts
=
Doctrine_Tokenizer
::
quoteExplode
(
$subquery
,
' '
,
"'"
,
"'"
);
...
...
@@ -972,8 +972,8 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable
$localAlias
=
$this
->
getShortAlias
(
$parent
,
$table
->
getTableName
());
$foreignAlias
=
$this
->
getShortAlias
(
$componentAlias
,
$relation
->
getTable
()
->
getTableName
());
$localSql
=
$this
->
conn
->
quoteIdentifier
(
$table
->
getTableName
())
.
' '
.
$localAlias
;
$foreignSql
=
$this
->
conn
->
quoteIdentifier
(
$relation
->
getTable
()
->
getTableName
())
.
' '
.
$foreignAlias
;
$localSql
=
$this
->
_
conn
->
quoteIdentifier
(
$table
->
getTableName
())
.
' '
.
$localAlias
;
$foreignSql
=
$this
->
_
conn
->
quoteIdentifier
(
$relation
->
getTable
()
->
getTableName
())
.
' '
.
$foreignAlias
;
$map
=
$relation
->
getTable
()
->
inheritanceMap
;
...
...
@@ -1063,16 +1063,16 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable
public
function
loadRoot
(
$name
,
$componentAlias
)
{
// get the connection for the component
$this
->
conn
=
Doctrine_Manager
::
getInstance
()
$this
->
_
conn
=
Doctrine_Manager
::
getInstance
()
->
getConnectionForComponent
(
$name
);
$table
=
$this
->
conn
->
getTable
(
$name
);
$table
=
$this
->
_
conn
->
getTable
(
$name
);
$tableName
=
$table
->
getTableName
();
// get the short alias for this table
$tableAlias
=
$this
->
getShortAlias
(
$componentAlias
,
$tableName
);
// quote table name
$queryPart
=
$this
->
conn
->
quoteIdentifier
(
$tableName
);
$queryPart
=
$this
->
_
conn
->
quoteIdentifier
(
$tableName
);
if
(
$this
->
type
===
self
::
SELECT
)
{
$queryPart
.=
' '
.
$tableAlias
;
...
...
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