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
2973b274
Commit
2973b274
authored
May 27, 2007
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--no commit message
--no commit message
parent
0b819a29
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
21 deletions
+16
-21
Hydrate.php
lib/Doctrine/Hydrate.php
+13
-3
Query.php
lib/Doctrine/Query.php
+3
-18
No files found.
lib/Doctrine/Hydrate.php
View file @
2973b274
...
...
@@ -125,6 +125,8 @@ class Doctrine_Hydrate implements Serializable
* @see Doctrine_Query::* constants
*/
protected
$type
=
self
::
SELECT
;
protected
$_cache
;
protected
$_tableAliases
=
array
();
/**
...
...
@@ -150,6 +152,14 @@ class Doctrine_Hydrate implements Serializable
{
return
$this
->
getQuery
();
}
public
function
setCache
(
Doctrine_Cache_Interface
$cache
)
{
$this
->
_cache
=
$cache
;
}
public
function
getCache
()
{
return
$this
->
_cache
;
}
/**
* serialize
* this method is automatically called when this Doctrine_Hydrate is serialized
...
...
@@ -627,12 +637,12 @@ class Doctrine_Hydrate implements Serializable
*/
public
function
execute
(
$params
=
array
(),
$return
=
Doctrine
::
FETCH_RECORD
)
{
if
(
$this
->
_
options
[
'resultSetCache'
]
)
{
if
(
$this
->
_
cache
)
{
$dql
=
$this
->
getDql
();
// calculate hash for dql query
$hash
=
strlen
(
$dql
)
.
md5
(
$dql
);
$cached
=
$this
->
_
options
[
'resultSetCache'
]
->
fetch
(
$hash
);
$cached
=
$this
->
_
cache
->
fetch
(
$hash
);
if
(
$cached
===
null
)
{
// cache miss
...
...
@@ -640,7 +650,7 @@ class Doctrine_Hydrate implements Serializable
$cached
=
$this
->
getCachedForm
(
$array
);
$this
->
_
options
[
'resultSetCache'
]
->
save
(
$hash
,
$cached
);
$this
->
_
cache
->
save
(
$hash
,
$cached
);
}
else
{
$cached
=
unserialize
(
$cached
);
$this
->
_tableAliases
=
$cached
[
2
];
...
...
lib/Doctrine/Query.php
View file @
2973b274
...
...
@@ -247,7 +247,7 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable
}
// check for cache
if
(
!
$this
->
_options
[
'resultSetCache'
]
&&
!
$this
->
_options
[
'parserCache'
]
)
{
if
(
!
$this
->
_options
[
'resultSetCache'
])
{
$parser
=
$this
->
getParser
(
$queryPartName
);
$sql
=
$parser
->
parse
(
$queryPart
);
...
...
@@ -619,21 +619,10 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable
public
function
getQuery
(
$params
=
array
())
{
// check if parser cache is on
if
(
$this
->
_options
[
'resultSetCache'
]
!==
false
)
{
/**
$dql = $this->getDql();
// calculate hash for dql query
$hash = strlen($dql) . md5($dql);
// check if cache has sql equivalent for given hash
$sql = $this->_options['parserCache']->fetch($hash, true);
if ($sql !== null) {
return $sql;
}
*/
// cache miss, build sql query from dql parts
if
(
$this
->
_cache
)
{
foreach
(
$this
->
_dqlParts
as
$queryPartName
=>
$queryParts
)
{
if
(
is_array
(
$queryParts
)
&&
!
empty
(
$queryParts
))
{
foreach
(
$queryParts
as
$queryPart
)
{
$this
->
getParser
(
$queryPartName
)
->
parse
(
$queryPart
);
}
...
...
@@ -721,10 +710,6 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable
array_shift
(
$this
->
parts
[
'where'
]);
}
// append sql query into cache
if
(
$this
->
_options
[
'parserCache'
]
!==
false
)
{
$this
->
_options
[
'parserCache'
]
->
save
(
$hash
,
$q
);
}
return
$q
;
}
/**
...
...
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