Subversion-Projekte lars-tiefland.prado

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
/**
3
 * TPgsqlTableColumn class file.
4
 *
5
 * @author Wei Zhuo <weizhuo[at]gmail[dot]com>
6
 * @link http://www.pradosoft.com/
7
 * @copyright Copyright &copy; 2005-2008 PradoSoft
8
 * @license http://www.pradosoft.com/license/
9
 * @version $Id: TPgsqlTableColumn.php 2541 2008-10-21 15:05:13Z qiang.xue $
10
 * @package System.Data.Common.Pgsql
11
 */
12
 
13
/**
14
 * Load common TDbTableCommon class.
15
 */
16
Prado::using('System.Data.Common.TDbTableColumn');
17
 
18
/**
19
 * Describes the column metadata of the schema for a PostgreSQL database table.
20
 *
21
 * @author Wei Zhuo <weizho[at]gmail[dot]com>
22
 * @version $Id: TPgsqlTableColumn.php 2541 2008-10-21 15:05:13Z qiang.xue $
23
 * @package System.Data.Common.Pgsql
24
 * @since 3.1
25
 */
26
class TPgsqlTableColumn extends TDbTableColumn
27
{
28
	private static $types=array(
29
		'integer' => array('bit', 'bit varying', 'real', 'serial', 'int', 'integer'),
30
		'boolean' => array('boolean'),
31
		'float' => array('bigint', 'bigserial', 'double precision', 'money', 'numeric')
32
	);
33
 
34
	/**
35
	 * Overrides parent implementation, returns PHP type from the db type.
36
	 * @return boolean derived PHP primitive type from the column db type.
37
	 */
38
	public function getPHPType()
39
	{
40
		$dbtype = strtolower($this->getDbType());
41
		foreach(self::$types as $type => $dbtypes)
42
		{
43
			if(in_array($dbtype, $dbtypes))
44
				return $type;
45
		}
46
		return 'string';
47
	}
48
}
49