From ddc0de38f64e5834ce04f0407a8416172b596655 Mon Sep 17 00:00:00 2001 From: wei <> Date: Sat, 16 Dec 2006 03:56:03 +0000 Subject: removed adodb and framework/DataAccess --- framework/DataAccess/SQLMap/TSqlMapClient.php | 78 --------------------------- 1 file changed, 78 deletions(-) delete mode 100644 framework/DataAccess/SQLMap/TSqlMapClient.php (limited to 'framework/DataAccess/SQLMap/TSqlMapClient.php') diff --git a/framework/DataAccess/SQLMap/TSqlMapClient.php b/framework/DataAccess/SQLMap/TSqlMapClient.php deleted file mode 100644 index 33b4131b..00000000 --- a/framework/DataAccess/SQLMap/TSqlMapClient.php +++ /dev/null @@ -1,78 +0,0 @@ - - * $client = new TSqlMapClient; - * $sqlmap = $client->configure($configFile, true); //load from cache. - * $products = $sqlMap->queryForList('statementName'); - * - * - * To save the TSqlMapper instance to cache for later usage, call - * cacheConfiguration(). - * - * @author Wei Zhuo - * @version $Id$ - * @package System.DataAccess.SQLMap - * @since 3.0 - */ -class TSqlMapClient -{ - private $_mapper; - private $_cache; - - public function configure($configFile, $loadFromCache=false) - { - if(is_null($this->_mapper)) - $this->initMapper($configFile, $loadFromCache); - return $this->_mapper; - } - - public function getInstance() - { - return $this->_mapper; - } - - public function cacheConfiguration() - { - if(!is_null($this->_mapper) && $this->_cache !== false) - { - if(!is_file($this->_cache)) - { - file_put_contents($this->_cache,serialize($this->_mapper)); - return true; - } - } - return false; - } - - protected function initMapper($file=null,$loadFromCache=false) - { - $this->_cache = $this->getCacheFile($file); - if($loadFromCache && $this->_cache !== false && is_file($this->_cache)) - { - $this->_mapper = unserialize(file_get_contents($this->_cache)); - } - else - { - $builder = new TDomSqlMapBuilder(); - $this->_mapper = $builder->configure($file); - } - } - - protected function getCacheFile($file) - { - $path = realpath($file); - if($path !== false) - return substr($path,0, strrpos($path,'.')).'.cache'; - else - return false; - } -} - -?> \ No newline at end of file -- cgit v1.2.3