From 0f0d3c62e608287cdf77f1a3239371b521ecb40b Mon Sep 17 00:00:00 2001 From: wei <> Date: Sat, 14 Apr 2007 05:02:29 +0000 Subject: Refactor ActiveRecordGateway to use TDataGatewayCommand --- .../Data/ActiveRecord/TActiveRecordManager.php | 56 ---------------------- 1 file changed, 56 deletions(-) (limited to 'framework/Data/ActiveRecord/TActiveRecordManager.php') diff --git a/framework/Data/ActiveRecord/TActiveRecordManager.php b/framework/Data/ActiveRecord/TActiveRecordManager.php index 0179479e..5e463d2d 100644 --- a/framework/Data/ActiveRecord/TActiveRecordManager.php +++ b/framework/Data/ActiveRecord/TActiveRecordManager.php @@ -120,17 +120,6 @@ class TActiveRecordManager extends TComponent return $this->_gateway; } - /** - * @param string|TActiveRecord active record class name or instance - * @return TDbMetaData record specific meta data - */ - public function getMetaData($record) - { - if(is_string($record)) - $record = TActiveRecord::finder($record); - return $this->getRecordGateway()->getMetaData($record); - } - /** * @return TActiveRecordGateway default record gateway. */ @@ -139,51 +128,6 @@ class TActiveRecordManager extends TComponent return new TActiveRecordGateway($this); } - /** - * Get table meta data for particular database and table. - * @param TDbConnection database connection. - * @return TDbMetaDataInspector table meta inspector - */ - public function getTableInspector(TDbConnection $conn) - { - $database = $conn->getConnectionString(); - if(!isset($this->_meta[$database])) - $this->_meta[$database] = $this->createMetaDataInspector($conn); - return $this->_meta[$database]; - } - - /** - * Create an instance of a database meta inspector corresponding to the - * given database vendor specified by the $driver parameter. - * @param TDbConnection database connection - * @return TDbMetaDataInspector table meta inspector - */ - protected function createMetaDataInspector($conn) - { - $conn->setActive(true); //must be connected before retrieving driver name! - $driver = $conn->getDriverName(); - switch(strtolower($driver)) - { - case 'pgsql': - Prado::using('System.Data.ActiveRecord.Vendor.TPgsqlMetaDataInspector'); - return new TPgsqlMetaDataInspector($conn); - case 'mysqli': - case 'mysql': - Prado::using('System.Data.ActiveRecord.Vendor.TMysqlMetaDataInspector'); - return new TMysqlMetaDataInspector($conn); - case 'sqlite': //sqlite 3 - case 'sqlite2': //sqlite 2 - Prado::using('System.Data.ActiveRecord.Vendor.TSqliteMetaDataInspector'); - return new TSqliteMetaDataInspector($conn); - case 'ibm': - Prado::using('System.Data.ActiveRecord.Vendor.TIbmMetaDataInspector'); - return new TIbmMetaDataInspector($conn); - default: - throw new TActiveRecordConfigurationException( - 'ar_invalid_database_driver',$driver); - } - } - /** * This method is invoked before the object is inserted into the database. * The method raises 'OnInsert' event. -- cgit v1.2.3