From 9e6fdda71cf70275fcf7e4b09230daa713c18b70 Mon Sep 17 00:00:00 2001 From: wei <> Date: Sat, 20 Jan 2007 23:46:35 +0000 Subject: minor changes to active record meta data inspector --- framework/Caching/TAPCCache.php | 9 ++++++--- .../Data/ActiveRecord/Vendor/TPgsqlMetaDataInspector.php | 14 ++++++++++++-- framework/Data/SqlMap/DataMapper/TSqlMapException.php | 4 ++++ 3 files changed, 22 insertions(+), 5 deletions(-) (limited to 'framework') diff --git a/framework/Caching/TAPCCache.php b/framework/Caching/TAPCCache.php index fb419911..969de4a4 100644 --- a/framework/Caching/TAPCCache.php +++ b/framework/Caching/TAPCCache.php @@ -54,9 +54,12 @@ class TAPCCache extends TCache */ public function init($config) { - if(!extension_loaded('apc')) - throw new TConfigurationException('apccache_extension_required'); - parent::init($config); + if(substr(php_sapi_name(), 0, 3) !== 'cli') //APC is usually disabled in CLI mode. + { + if(!extension_loaded('apc')) + throw new TConfigurationException('apccache_extension_required'); + parent::init($config); + } } /** diff --git a/framework/Data/ActiveRecord/Vendor/TPgsqlMetaDataInspector.php b/framework/Data/ActiveRecord/Vendor/TPgsqlMetaDataInspector.php index bcdfefe3..9d474f14 100644 --- a/framework/Data/ActiveRecord/Vendor/TPgsqlMetaDataInspector.php +++ b/framework/Data/ActiveRecord/Vendor/TPgsqlMetaDataInspector.php @@ -80,6 +80,16 @@ EOD; */ protected function getColumnDefinitions($table) { + if(count($parts= explode('.', $table)) > 1) + { + $tablename = $parts[1]; + $schema = $parts[0]; + } + else + { + $tablename = $parts[0]; + $schema = $this->getDefaultSchema(); + } // This query is made much more complex by the addition of the 'attisserial' field. // The subquery to get that field checks to see if there is an internally dependent // sequence on the field. @@ -116,8 +126,8 @@ EOD; $conn = $this->getDbConnection(); $conn->setActive(true); $command = $conn->createCommand($sql); - $command->bindValue(':table', $table); - $command->bindValue(':schema', $this->getDefaultSchema()); + $command->bindValue(':table', $tablename); + $command->bindValue(':schema', $schema); $cols = array(); foreach($command->query() as $col) $cols[$col['attname']] = $this->getColumnMetaData($col); diff --git a/framework/Data/SqlMap/DataMapper/TSqlMapException.php b/framework/Data/SqlMap/DataMapper/TSqlMapException.php index 76bf7198..d360ad5c 100644 --- a/framework/Data/SqlMap/DataMapper/TSqlMapException.php +++ b/framework/Data/SqlMap/DataMapper/TSqlMapException.php @@ -109,4 +109,8 @@ class TInvalidPropertyException extends TSqlMapException { } +class TSqlMapExecutionException extends TSqlMapException +{ +} + ?> \ No newline at end of file -- cgit v1.2.3