3 * TMysqlTableColumn class file.
5 * @author Wei Zhuo <weizhuo[at]gmail[dot]com>
6 * @link http://www.pradosoft.com/
7 * @copyright Copyright © 2005-2014 PradoSoft
8 * @license http://www.pradosoft.com/license/
9 * @package System.Data.Common.Mysql
13 * Load common TDbTableCommon class.
15 Prado::using('System.Data.Common.TDbTableColumn');
18 * Describes the column metadata of the schema for a Mysql database table.
20 * @author Wei Zhuo <weizho[at]gmail[dot]com>
21 * @package System.Data.Common.Mysql
24 class TMysqlTableColumn extends TDbTableColumn
26 private static $types = array(
27 'integer' => array('bit', 'tinyint', 'smallint', 'mediumint', 'int', 'integer', 'bigint'),
28 'boolean' => array('boolean', 'bool'),
29 'float' => array('float', 'double', 'double precision', 'decimal', 'dec', 'numeric', 'fixed')
33 * Overrides parent implementation, returns PHP type from the db type.
34 * @return boolean derived PHP primitive type from the column db type.
36 public function getPHPType()
38 $dbtype = trim(str_replace(array('unsigned', 'zerofill'),array('','',),strtolower($this->getDbType())));
39 if($dbtype==='tinyint' && $this->getColumnSize()===1)
41 foreach(self::$types as $type => $dbtypes)
43 if(in_array($dbtype, $dbtypes))
50 * @return boolean true if column will auto-increment when the column value is inserted as null.
52 public function getAutoIncrement()
54 return $this->getInfo('AutoIncrement', false);
58 * @return boolean true if auto increment is true.
60 public function hasSequence()
62 return $this->getAutoIncrement();
65 public function getDbTypeValues()
67 return $this->getInfo('DbTypeValues');