From 42b9ea233241e6071552adee997d0de87f953e1f Mon Sep 17 00:00:00 2001 From: wei <> Date: Sat, 14 Apr 2007 05:03:19 +0000 Subject: Remove Vendor from ActiveRecord. Now uses Data/Common instead --- .../Vendor/TMysqlMetaDataInspector.php | 84 ---------------------- 1 file changed, 84 deletions(-) delete mode 100644 framework/Data/ActiveRecord/Vendor/TMysqlMetaDataInspector.php (limited to 'framework/Data/ActiveRecord/Vendor/TMysqlMetaDataInspector.php') diff --git a/framework/Data/ActiveRecord/Vendor/TMysqlMetaDataInspector.php b/framework/Data/ActiveRecord/Vendor/TMysqlMetaDataInspector.php deleted file mode 100644 index 23c483d1..00000000 --- a/framework/Data/ActiveRecord/Vendor/TMysqlMetaDataInspector.php +++ /dev/null @@ -1,84 +0,0 @@ - - * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2007 PradoSoft - * @license http://www.pradosoft.com/license/ - * @version $Id$ - * @package System.Data.ActiveRecord.Vendor - */ - -Prado::using('System.Data.ActiveRecord.Vendor.TDbMetaDataInspector'); -Prado::using('System.Data.ActiveRecord.Vendor.TMysqlColumnMetaData'); -Prado::using('System.Data.ActiveRecord.Vendor.TMysqlMetaData'); - -/** - * TMysqlMetaDataInspector class. - * - * Gathers table column properties for Mysql database. - * - * @author Wei Zhuo - * @version $Id$ - * @package System.Data.ActiveRecord.Vendor - * @since 3.1 - */ -class TMysqlMetaDataInspector extends TDbMetaDataInspector -{ - /** - * Get the column definitions for given table. - * @param string table name. - * @return array column name value pairs of column meta data. - */ - protected function getColumnDefinitions($table) - { - $sql="SHOW FULL FIELDS FROM {$table}"; - $conn = $this->getDbConnection(); - $conn->setActive(true); - $command = $conn->createCommand($sql); - $command->prepare(); - foreach($command->query() as $col) - $cols[strtolower($col['Field'])] = $this->getColumnMetaData($col); - return $cols; - } - - protected function getColumnMetaData($col) - { - $name = '`'.$col['Field'].'`'; //quote the column names! - $type = $col['Type']; - $notNull = $col['Null']==='NO'; - $autoIncrement=is_int(strpos(strtolower($col['Extra']), 'auto_increment')); - $default = $col['Default']; - $primaryKey = $col['Key']==='PRI'; - return new TMysqlColumnMetaData(strtolower($col['Field']),$name,$type, - $notNull,$autoIncrement,$default,$primaryKey); - } - - /** - * Not implemented, Mysql does not always have foreign key constraints. - */ - protected function getConstraintKeys($table) - { - return array('primary'=>array(), 'foreign'=>array()); - } - - /** - * Create a new instance of meta data. - * @param string table name - * @param array column meta data - * @param array primary key meta data - * @param array foreign key meta data. - * @return TDbMetaData table meta data. - */ - protected function createMetaData($table, $columns, $primary, $foreign) - { - $pks = array(); - foreach($columns as $name=>$column) - if($column->getIsPrimaryKey()) - $pks[] = $name; - return new TMysqlMetaData($table,$columns,$pks); - } -} - -?> \ No newline at end of file -- cgit v1.2.3