Changeset 5303

Show
Ignore:
Timestamp:
12/17/08 22:56:14 (7 months ago)
Author:
jwage
Message:

[1.0, 1.1] Fixed issue with limit subquery algorithm queries beind cached when they should not be (closes #1726)

Location:
branches
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • branches/1.0/lib/Doctrine/Query.php

    r5247 r5303  
    11291129                switch (strtolower($this->_conn->getDriverName())) { 
    11301130                    case 'mysql': 
     1131                        $this->useQueryCache(false); 
    11311132                        // mysql doesn't support LIMIT in subqueries 
    11321133                        $list = $this->_conn->execute($subquery, $params)->fetchAll(Doctrine::FETCH_COLUMN); 
  • branches/1.0/lib/Doctrine/Query/Abstract.php

    r5301 r5303  
    960960                } else { 
    961961                    $query = $this->getSqlQuery($params); 
    962                     $serializedQuery = $this->getCachedForm($query); 
    963                     $queryCacheDriver->save($hash, $serializedQuery, $this->getQueryCacheLifeSpan()); 
     962                    // Check again because getSqlQuery() above could have flipped the _queryCache flag 
     963                    // if this query contains the limit sub query algorithm we don't need to cache it 
     964                    if ($this->_queryCache !== false && ($this->_queryCache || $this->_conn->getAttribute(Doctrine::ATTR_QUERY_CACHE))) { 
     965                        $serializedQuery = $this->getCachedForm($query); 
     966                        $queryCacheDriver->save($hash, $serializedQuery, $this->getQueryCacheLifeSpan()); 
     967                    } 
    964968                } 
    965969            } else { 
  • branches/1.1/lib/Doctrine/Query.php

    r5265 r5303  
    12101210            switch (strtolower($this->_conn->getDriverName())) { 
    12111211                case 'mysql': 
     1212                    $this->useQueryCache(false); 
    12121213                    // mysql doesn't support LIMIT in subqueries 
    12131214                    $list = $this->_conn->execute($subquery, $this->_execParams)->fetchAll(Doctrine::FETCH_COLUMN); 
  • branches/1.1/lib/Doctrine/Query/Abstract.php

    r5301 r5303  
    10421042                    // Generate SQL or pick already processed one 
    10431043                    $query = $this->getSqlQuery($params); 
    1044                      
    1045                     // Convert query into a serialized form 
    1046                     $serializedQuery = $this->getCachedForm($query); 
    1047                      
    1048                     // Save cached query 
    1049                     $queryCacheDriver->save($hash, $serializedQuery, $this->getQueryCacheLifeSpan()); 
     1044 
     1045                    // Check again because getSqlQuery() above could have flipped the _queryCache flag 
     1046                    // if this query contains the limit sub query algorithm we don't need to cache it 
     1047                    if ($this->_queryCache !== false && ($this->_queryCache || $this->_conn->getAttribute(Doctrine::ATTR_QUERY_CACHE))) { 
     1048                        // Convert query into a serialized form 
     1049                        $serializedQuery = $this->getCachedForm($query); 
     1050 
     1051                        // Save cached query 
     1052                        $queryCacheDriver->save($hash, $serializedQuery, $this->getQueryCacheLifeSpan()); 
     1053                    } 
    10501054                } 
    10511055            } else {