diff options
author | godzilla80@gmx.net <> | 2010-02-14 01:22:57 +0000 |
---|---|---|
committer | godzilla80@gmx.net <> | 2010-02-14 01:22:57 +0000 |
commit | 94e94e0a8566f23d16658a04c55b0bbfdd6689aa (patch) | |
tree | 72ffad82c279080dd9320d45dda26d64ffb4626f /framework/Data/SqlMap/TSqlMapConfig.php | |
parent | 966fd66f217911d079c4bd6a87b09f4a0c5c4736 (diff) |
Merge Branches & Trunk
/trunk:r2680,2692,2707-2736
/branches/3.1:r2682-2686,2694-2702,2705,2738-2762
Diffstat (limited to 'framework/Data/SqlMap/TSqlMapConfig.php')
-rw-r--r-- | framework/Data/SqlMap/TSqlMapConfig.php | 43 |
1 files changed, 27 insertions, 16 deletions
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();
}
/**
|