Skip to content

Commit

Permalink
Fixing issues with query caching in buildQueryWhere(). For now, dont
Browse files Browse the repository at this point in the history
cache if we're using a query builder object.  "Real" fix will require
some very careful thought and testing!
  • Loading branch information
cheesegrits committed Jun 30, 2015
1 parent 4bccf0e commit a4f95ea
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion components/com_fabrik/models/list.php
Expand Up @@ -3204,11 +3204,27 @@ public function buildQueryWhere($incFilters = true, $query = false, $doJoins = t
$sig = !$query ? 'string' : 'query';
$sig .= (int) $incFilters;

if (isset($this->_whereSQL[$sig]))
/**
* $$ hugh - caching is borked when using query builder object, as we're always returning a query
* string, never an object. So code like this:
*
* $query = $db->getQuery(true);
* // some code that does query building stuff here, then ...
* $query = $listModel->buildQueryWhere(true, $query);
* $query = $listModel->buildQueryJoin($query);
*
* ... blows up in buildQueryJoin() if this function returns a cached query string, overwriting
* the $query buider object.
*
* "Real" fix would be to sort it out so we return the object, although I'm not convinced that's
* the even the right fix. But for now only use the cache if we're using string not object.
*/
if ($query === false && isset($this->_whereSQL[$sig]))
{
return $this->_whereSQL[$sig][$incFilters];
}


$filters = $this->getFilterArray();
$params = $this->getParams();

Expand Down

0 comments on commit a4f95ea

Please sign in to comment.