]> git.sur5r.net Git - bacula/bacula/blob - gui/baculum/framework/Data/Common/Pgsql/TPgsqlTableColumn.php
baculum: New Baculum API and Baculum Web
[bacula/bacula] / gui / baculum / framework / Data / Common / Pgsql / TPgsqlTableColumn.php
1 <?php
2 /**
3  * TPgsqlTableColumn class file.
4  *
5  * @author Wei Zhuo <weizhuo[at]gmail[dot]com>
6  * @link https://github.com/pradosoft/prado
7  * @copyright Copyright &copy; 2005-2016 The PRADO Group
8  * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT
9  * @package System.Data.Common.Pgsql
10  */
11
12 /**
13  * Load common TDbTableCommon class.
14  */
15 Prado::using('System.Data.Common.TDbTableColumn');
16
17 /**
18  * Describes the column metadata of the schema for a PostgreSQL database table.
19  *
20  * @author Wei Zhuo <weizho[at]gmail[dot]com>
21  * @package System.Data.Common.Pgsql
22  * @since 3.1
23  */
24 class TPgsqlTableColumn extends TDbTableColumn
25 {
26         private static $types=array(
27                 'integer' => array('bit', 'bit varying', 'real', 'serial', 'int', 'integer'),
28                 'boolean' => array('boolean'),
29                 'float' => array('bigint', 'bigserial', 'double precision', 'money', 'numeric')
30         );
31
32         /**
33          * Overrides parent implementation, returns PHP type from the db type.
34          * @return boolean derived PHP primitive type from the column db type.
35          */
36         public function getPHPType()
37         {
38                 $dbtype = strtolower($this->getDbType());
39                 foreach(self::$types as $type => $dbtypes)
40                 {
41                         if(in_array($dbtype, $dbtypes))
42                                 return $type;
43                 }
44                 return 'string';
45         }
46 }
47