From 94e94e0a8566f23d16658a04c55b0bbfdd6689aa Mon Sep 17 00:00:00 2001 From: "godzilla80@gmx.net" <> Date: Sun, 14 Feb 2010 01:22:57 +0000 Subject: Merge Branches & Trunk /trunk:r2680,2692,2707-2736 /branches/3.1:r2682-2686,2694-2702,2705,2738-2762 --- framework/Caching/TDbCache.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'framework/Caching') diff --git a/framework/Caching/TDbCache.php b/framework/Caching/TDbCache.php index 8ea8eae9..0e013c79 100644 --- a/framework/Caching/TDbCache.php +++ b/framework/Caching/TDbCache.php @@ -183,7 +183,6 @@ class TDbCache extends TCache { if($this->_cacheInitialized && !$force) return; $db=$this->getDbConnection(); - $db->setActive(true); try { $key = 'TDbCache:' . $this->_cacheTable . ':created'; @@ -328,6 +327,8 @@ class TDbCache extends TCache { if($this->_db===null) $this->_db=$this->createDbConnection(); + + $this->_db->setActive(true); return $this->_db; } @@ -464,7 +465,7 @@ class TDbCache extends TCache if(!$this->_cacheInitialized) $this->initializeCache(); try { $sql='SELECT value FROM '.$this->_cacheTable.' WHERE itemkey=\''.$key.'\' AND (expire=0 OR expire>'.time().') ORDER BY expire DESC'; - $command=$this->_db->createCommand($sql); + $command=$this->getDbConnection()->createCommand($sql); return $command->queryScalar(); } catch(Exception $e) @@ -505,7 +506,7 @@ class TDbCache extends TCache $sql="INSERT INTO {$this->_cacheTable} (itemkey,value,expire) VALUES(:key,:value,$expire)"; try { - $command=$this->_db->createCommand($sql); + $command=$this->getDbConnection()->createCommand($sql); $command->bindValue(':key',$key,PDO::PARAM_STR); $command->bindValue(':value',$value,PDO::PARAM_LOB); $command->execute(); @@ -537,7 +538,7 @@ class TDbCache extends TCache if(!$this->_cacheInitialized) $this->initializeCache(); try { - $command=$this->_db->createCommand("DELETE FROM {$this->_cacheTable} WHERE itemkey=:key"); + $command=$this->getDbConnection()->createCommand("DELETE FROM {$this->_cacheTable} WHERE itemkey=:key"); $command->bindValue(':key',$key,PDO::PARAM_STR); $command->execute(); return true; @@ -559,7 +560,7 @@ class TDbCache extends TCache if(!$this->_cacheInitialized) $this->initializeCache(); try { - $command = $this->_db->createCommand("DELETE FROM {$this->_cacheTable}"); + $command = $this->getDbConnection()->createCommand("DELETE FROM {$this->_cacheTable}"); $command->execute(); } catch(Exception $e) -- cgit v1.2.3