Disable reload on wakeup for cached queries

This commit is contained in:
Deon George 2015-10-08 21:25:36 +11:00
parent 8de1dfc484
commit 3afcaf7e12
2 changed files with 6 additions and 2 deletions

View File

@ -62,12 +62,13 @@ class Kohana_Database_DB2_Result extends Database_Result {
} }
elseif (is_string($this->_as_object)) elseif (is_string($this->_as_object))
{ {
throw new Kohana_Exception('This configuration is not tested for caching');
$o = new $this->_as_object; $o = new $this->_as_object;
// Return an object of given class name // Return an object of given class name
// @todo This doesnt have $this->_loaded = $this->_valid = TRUE; // @todo This doesnt have $this->_loaded = $this->_valid = TRUE;
return $o->values(db2_fetch_assoc($this->_result)); return $o->values(isset($this->_internal_data[$this->_internal_row])
? $this->_internal_data[$this->_internal_row]
: ($this->_internal_data[$this->_internal_row] = db2_fetch_assoc($this->_result)));
} }
else else
{ {

View File

@ -32,6 +32,9 @@ abstract class ORM_DB2 extends ORM {
$this->_table_name = strtoupper($this->_table_name); $this->_table_name = strtoupper($this->_table_name);
parent::_initialize(); parent::_initialize();
// If we are caching queries, we cannot reload on wakeup.
$this->_reload_on_wakeup = ! $this->_db->caching();
} }
} }
?> ?>