summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgodzilla80@gmx.net <>2009-05-23 07:52:15 +0000
committergodzilla80@gmx.net <>2009-05-23 07:52:15 +0000
commit362aea9c8764437119d09eb6343851db4298a035 (patch)
tree449e390bfb592336ed13e350f6dac38f454b2c4d
parente4587335b8c79bc2dc726da4f39ef43a0034247f (diff)
Fixed Issue#161 - SqlMap add cache dependencies if TApplicationMode Debug/Normal
-rw-r--r--HISTORY1
-rw-r--r--framework/Data/SqlMap/Configuration/TSqlMapXmlConfiguration.php9
-rw-r--r--framework/Data/SqlMap/TSqlMapConfig.php7
-rw-r--r--framework/Data/SqlMap/TSqlMapManager.php14
4 files changed, 29 insertions, 2 deletions
diff --git a/HISTORY b/HISTORY
index ef884514..761a44c2 100644
--- a/HISTORY
+++ b/HISTORY
@@ -19,6 +19,7 @@ BUG: Issue#139 - add schema support to TActiveRecordRelation::findForeignKeys()
BUG: Issue#148 - Bad Oracle Support (E.Letard)
BUG: Issue#150 - Multiple TDropContainers in same namingcontainer give error (Christophe)
Bug: Issue#154 - Bug in TOracleMetaData.php causing SqlMap not work with Oracle database (Christophe)
+BUG: Issue#161 - SqlMap add cache dependencies if TApplicationMode Debug/Normal (Yves)
BUG: URL wildcard patterns didn't work with subfolders
BUG: TDbLogRoute::createDbTable: add AUTO_INCREMENT attribute to log_id column if driver is mysql (Yves)
BUG: Ensure rendering of clientID in TActivePanel (Christophe)
diff --git a/framework/Data/SqlMap/Configuration/TSqlMapXmlConfiguration.php b/framework/Data/SqlMap/Configuration/TSqlMapXmlConfiguration.php
index 5854b21a..462b356f 100644
--- a/framework/Data/SqlMap/Configuration/TSqlMapXmlConfiguration.php
+++ b/framework/Data/SqlMap/Configuration/TSqlMapXmlConfiguration.php
@@ -349,6 +349,15 @@ class TSqlMapXmlMappingConfiguration extends TSqlMapXmlConfigBuilder
$document = $this->loadXmlDocument($filename,$this->_xmlConfig);
$this->_document=$document;
+ static $bCacheDependencies;
+ if($bCacheDependencies === null)
+ $bCacheDependencies = Prado::getApplication()->getMode() !== TApplicationMode::Performance;
+
+ if($bCacheDependencies)
+ $this->_manager->getCacheDependencies()
+ ->getDependencies()
+ ->add(new TFileCacheDependency($filename));
+
foreach($document->xpath('//resultMap') as $node)
$this->loadResultMap($node);
diff --git a/framework/Data/SqlMap/TSqlMapConfig.php b/framework/Data/SqlMap/TSqlMapConfig.php
index cdf6b541..c57ab40e 100644
--- a/framework/Data/SqlMap/TSqlMapConfig.php
+++ b/framework/Data/SqlMap/TSqlMapConfig.php
@@ -49,7 +49,7 @@ class TSqlMapConfig extends TDataSourceConfig
$cache = $this->getApplication()->getCache();
if($cache !== null) {
$cache->delete($this->getCacheKey());
- }
+ }
}
/**
@@ -62,7 +62,10 @@ class TSqlMapConfig extends TDataSourceConfig
{
$cache = $this->getApplication()->getCache();
if($cache !== null) {
- return $cache->set($this->getCacheKey(), $manager);
+ $dependencies = null;
+ if($this->getApplication()->getMode() !== TApplicationMode::Performance)
+ $dependencies = $manager->getCacheDependencies();
+ return $cache->set($this->getCacheKey(), $manager, 0, $dependencies);
}
}
return false;
diff --git a/framework/Data/SqlMap/TSqlMapManager.php b/framework/Data/SqlMap/TSqlMapManager.php
index 290050d1..432c1c5e 100644
--- a/framework/Data/SqlMap/TSqlMapManager.php
+++ b/framework/Data/SqlMap/TSqlMapManager.php
@@ -18,6 +18,7 @@ Prado::using('System.Data.SqlMap.Configuration.TSqlMapStatement');
Prado::using('System.Data.SqlMap.Configuration.*');
Prado::using('System.Data.SqlMap.DataMapper.*');
Prado::using('System.Data.SqlMap.Statements.*');
+Prado::using('System.Caching.TCache');
/**
@@ -50,6 +51,7 @@ class TSqlMapManager extends TComponent
private $_connection;
private $_gateway;
+ private $_cacheDependencies;
/**
* Constructor, create a new SqlMap manager.
@@ -113,6 +115,18 @@ class TSqlMapManager extends TComponent
}
/**
+ * @return TChainedCacheDependency
+ * @since 3.1.5
+ */
+ public function getCacheDependencies()
+ {
+ if($this->_cacheDependencies === null)
+ $this->_cacheDependencies=new TChainedCacheDependency();
+
+ return $this->_cacheDependencies;
+ }
+
+ /**
* Configures the current TSqlMapManager using the given xml configuration file
* defined in {@link ConfigFile setConfigFile()}.
* @return TSqlMapGateway create and configure a new TSqlMapGateway.