summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgodzilla80@gmx.net <>2009-11-08 09:59:34 +0000
committergodzilla80@gmx.net <>2009-11-08 09:59:34 +0000
commitd497d076264c80a934d5837deda9fda727691663 (patch)
tree1d8c9da462f3ac2589d56e3c67b1f1ebea33cd1b
parent3a1b2a22406e1e9f7312e417cdc551e0928700d1 (diff)
Fixed Issue #188 - TDbCache doesn't check if db connection is active.
-rw-r--r--HISTORY1
-rw-r--r--framework/Caching/TDbCache.php11
2 files changed, 7 insertions, 5 deletions
diff --git a/HISTORY b/HISTORY
index 26f82b3a..c35be4d4 100644
--- a/HISTORY
+++ b/HISTORY
@@ -2,6 +2,7 @@ Version 3.1.7 To be released
BUG: Issue#166 - E_NOTICE level error in TDataGatewayCommand (Carl)
BUG: Issue#157 - Enabled does not work properly on TActiveRadioButton/CheckBoxList controls (Bradley, Carl)
EHN: Issue#184 - THttpResponse doesn't support custom Content-Type headers, remove charset part of header if THttpResponse.Charset=false (Yves)
+BUG: Issue#188 - TDbCache doesn't check if db connection is active. (Yves)
BUG: Issue#189 - Page State corrupted when EnableStateValidation=False (Christophe)
BUG: Issue#198 - "Undefined variable: tagName" after error in application configuration. (Christophe)
BUG: Typo in TBoundColumn (Robin)
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)