Class Details

Class for a table column.


Class Variables

public boolean $auto_increment

True if this column is set to auto_increment.

public mixed $default

The default value of the column.

public string $inflected_name

The inflected name of this columns .. hyphens/spaces will be => _.

public int $length

The maximum length of this column.

public string $name

The true name of this column.

public boolean $nullable

True if this column allows null.

public boolean $pk

True if this column is a primary key.

public string $raw_type

The raw database specific type.

public boolean $sequence

Name of the sequence to use for this column if any.

public integer $type

The type of this column: STRING, INTEGER, ...

public static array $TYPE_MAPPING = array( 'datetime' => self::DATETIME, 'timestamp' => self::DATETIME, 'date' => self::DATE, 'time' => self::TIME, 'int' => self::INTEGER, 'tinyint' => self::INTEGER, 'smallint' => self::INTEGER, 'mediumint' => self::INTEGER, 'bigint' => self::INTEGER, 'float' => self::DECIMAL, 'double' => self::DECIMAL, 'numeric' => self::DECIMAL, 'decimal' => self::DECIMAL, 'dec' => self::DECIMAL)

Map a type to an column type.


Class Methods

public mixed cast ( mixed $value , Connection $connection )

Casts a value to the column's type.

  • mixed $value - The value to cast
  • Connection $connection - The Connection this column belongs to
  • return: type-casted value
public mixed map_raw_type ( )

Sets the $type member variable.


Class Constants

DATE = 5
DATETIME = 4
DECIMAL = 3
INTEGER = 2
STRING = 1
TIME = 6