From 623447ffea7a49359c773a0bc3a851397885f319 Mon Sep 17 00:00:00 2001 From: wei <> Date: Fri, 28 Jul 2006 12:32:01 +0000 Subject: Add sqlite support for time-tracker. --- framework/3rdParty/SafeHtml/TSafeHtmlParser.php | 3 ++- framework/DataAccess/SQLMap/Statements/TMappedStatement.php | 1 - framework/DataAccess/TDatabaseProvider.php | 11 +++++++---- framework/DataAccess/TSQLMap.php | 9 +++++++-- 4 files changed, 16 insertions(+), 8 deletions(-) (limited to 'framework') diff --git a/framework/3rdParty/SafeHtml/TSafeHtmlParser.php b/framework/3rdParty/SafeHtml/TSafeHtmlParser.php index a51e203c..36b28274 100644 --- a/framework/3rdParty/SafeHtml/TSafeHtmlParser.php +++ b/framework/3rdParty/SafeHtml/TSafeHtmlParser.php @@ -267,7 +267,8 @@ class TSafeHtmlParser * @var array * @access public */ - public $attributes = array('dynsrc', 'id', 'name', ); + public $attributes = array('dynsrc'); + //public $attributes = array('dynsrc', 'id', 'name', ); //id and name are dangerous? /** * List of allowed "namespaced" attributes diff --git a/framework/DataAccess/SQLMap/Statements/TMappedStatement.php b/framework/DataAccess/SQLMap/Statements/TMappedStatement.php index 3dc100dc..ef2a5273 100644 --- a/framework/DataAccess/SQLMap/Statements/TMappedStatement.php +++ b/framework/DataAccess/SQLMap/Statements/TMappedStatement.php @@ -374,7 +374,6 @@ class TMappedStatement extends TComponent implements IMappedStatement while($row = $recordSet->fetchRow()) $object = $this->applyResultMap($row, $result); - //var_dump($this->_groupBy); if(!$this->_groupBy->isEmpty()) { $list = $this->_groupBy->collect(); diff --git a/framework/DataAccess/TDatabaseProvider.php b/framework/DataAccess/TDatabaseProvider.php index 067c7243..88c78505 100644 --- a/framework/DataAccess/TDatabaseProvider.php +++ b/framework/DataAccess/TDatabaseProvider.php @@ -103,16 +103,19 @@ abstract class TDatabaseProvider extends TModule } /** - * If the driver is sqlite, the host must be dot path to the sqlite - * file. E.g. "Application.pages.my_db". The database filename - * should not contain any dots. + * If the driver is sqlite, the host must be dot directory of to + * the sqlite file. E.g. "Application.pages.my_db". The database + * filename must be specified by the Database attribute. * @return string database host name/IP (and port number) in the format * "host[:port]" */ public function getHost() { if(strtolower($this->getDriver()) == "sqlite") - return Prado::getPathOfNamespace($this->_host); + { + $dir = Prado::getPathOfNamespace($this->_host); + return $dir.'/'.$this->getDatabase(); + } else return $this->_host; } diff --git a/framework/DataAccess/TSQLMap.php b/framework/DataAccess/TSQLMap.php index 27973047..956593de 100644 --- a/framework/DataAccess/TSQLMap.php +++ b/framework/DataAccess/TSQLMap.php @@ -11,6 +11,11 @@ class TSQLMap extends TModule */ const CONFIG_FILE_EXT='.xml'; + protected function getCacheKey() + { + return $this->getID().$this->getConfigFile(); + } + /** * Saves the current sqlmap instance to cache. * @return boolean true if sqlmap was cached, false otherwise. @@ -21,7 +26,7 @@ class TSQLMap extends TModule { $cache = $this->getApplication()->getCache(); if(!is_null($cache)) - return $cache->add($this->getID(), $this->_sqlmap); + return $cache->add($this->getCacheKey(), $this->_sqlmap); } return false; } @@ -37,7 +42,7 @@ class TSQLMap extends TModule $cache = $this->getApplication()->getCache(); Prado::using('System.DataAccess.SQLMap.TSqlMapper'); if(!is_null($cache)) - $this->_sqlmap = $cache->get($this->getID()); + $this->_sqlmap = $cache->get($this->getCacheKey()); return $this->_sqlmap instanceof TSqlMapper; } return false; -- cgit v1.2.3