diff options
author | godzilla80@gmx.net <> | 2009-11-08 15:11:14 +0000 |
---|---|---|
committer | godzilla80@gmx.net <> | 2009-11-08 15:11:14 +0000 |
commit | 3b9672007e822483653deaf8f1c117d6ecc58309 (patch) | |
tree | c7ad8dabdc6b7ffb8ba9ff0fee9e5daf6d76c9ef | |
parent | 3bcf04bf5084e049a00855db549ee2a7c34ad9ac (diff) |
- Fixed Issue #171 - <connection> tag in SqlMap config ignored in 3.1.5 and above, introduced by solving Issue#68
- move logic to instantiate TSqlMapManager from "protected function createSqlMapGateway()" to "public function getSqlMapManager()" since it is useful if you dynamicly create mapped statements that should be cached
- explicit return null in loadCachedSqlMapManager()
-rw-r--r-- | HISTORY | 1 | ||||
-rw-r--r-- | framework/Data/SqlMap/TSqlMapConfig.php | 43 |
2 files changed, 28 insertions, 16 deletions
@@ -2,6 +2,7 @@ Version 3.1.7 To be released BUG: Issue#151 - TTextBox fails to display inital line break (Yves) BUG: Issue#157 - Enabled does not work properly on TActiveRadioButton/CheckBoxList controls (Bradley, Carl) BUG: Issue#166 - E_NOTICE level error in TDataGatewayCommand (Carl) +BUG: Issue#171 - <connection> tag in SqlMap config ignored in 3.1.5 and above, introduced by solving Issue#68 (Yves) 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) diff --git a/framework/Data/SqlMap/TSqlMapConfig.php b/framework/Data/SqlMap/TSqlMapConfig.php index c57ab40e..c5f06ab8 100644 --- a/framework/Data/SqlMap/TSqlMapConfig.php +++ b/framework/Data/SqlMap/TSqlMapConfig.php @@ -53,6 +53,31 @@ class TSqlMapConfig extends TDataSourceConfig }
/**
+ * Create and configure the data mapper using sqlmap configuration file.
+ * Or if cache is enabled and manager already cached load from cache.
+ * If cache is enabled, the data mapper instance is cached.
+ *
+ * @return TSqlMapManager SqlMap manager instance
+ * @since 3.1.7
+ */
+ public function getSqlMapManager() {
+ Prado::using('System.Data.SqlMap.TSqlMapManager');
+ if(($manager = $this->loadCachedSqlMapManager())===null)
+ {
+ $manager = new TSqlMapManager($this->getDbConnection());
+ if(strlen($file=$this->getConfigFile()) > 0)
+ {
+ $manager->configureXml($file);
+ $this->cacheSqlMapManager($manager);
+ }
+ }
+ elseif($this->getConnectionID() !== '') {
+ $manager->setDbConnection($this->getDbConnection());
+ }
+ return $manager;
+ }
+
+ /**
* Saves the current SqlMap manager to cache.
* @return boolean true if SqlMap manager was cached, false otherwise.
*/
@@ -87,6 +112,7 @@ class TSqlMapConfig extends TDataSourceConfig return $manager;
}
}
+ return null;
}
/**
@@ -134,26 +160,11 @@ class TSqlMapConfig extends TDataSourceConfig }
/**
- * Configure the data mapper using sqlmap configuration file.
- * If cache is enabled, the data mapper instance is cached.
* @return TSqlMapGateway SqlMap gateway instance.
*/
protected function createSqlMapGateway()
{
- Prado::using('System.Data.SqlMap.TSqlMapManager');
- if(($manager = $this->loadCachedSqlMapManager())===null)
- {
- $manager = new TSqlMapManager($this->getDbConnection());
- if(strlen($file=$this->getConfigFile()) > 0)
- {
- $manager->configureXml($file);
- $this->cacheSqlMapManager($manager);
- }
- }
- else {
- $manager->setDbConnection($this->getDbConnection());
- }
- return $manager->getSqlmapGateway();
+ return $this->getSqlMapManager()->getSqlmapGateway();
}
/**
|