Class ActiveRecord_Column

Description

A class containing information about a table column.

Located in /activerecord/lib/ActiveRecord/Column.php (line 15)


	
			
Variable Summary
 mixed $default
 mixed $limit
 mixed $name
 mixed $precision
 mixed $primary
 mixed $scale
 mixed $sql_type
 mixed $type
Method Summary
 ActiveRecord_Column __construct (string $name, string $default, [string $sql_type = NULL], [bool $null_allowed = true])
 mixed default_value ()
 int extract_limit (string $sql_type)
 int extract_precision (string $sql_type)
 int extract_scale (string $sql_type)
 bool is_number ()
 bool is_text ()
 int limit ()
 string name ()
 bool null_allowed ()
 int precision ()
 bool primary ()
 mixed reverse_type_cast (mixed $value)
 int scale ()
 bool set_primary (bool $flag)
 string simplified_type (string $sql_type)
 string sql_type ()
 string type ()
 mixed type_cast (mixed $value, [bool $allowNull = true])
Variables
mixed $default (line 47)

The default value

  • access: protected
mixed $limit (line 31)

The size limit of the column

  • access: protected
mixed $name (line 19)

The column name

  • access: protected
mixed $null_allowed (line 43)

Whether or not the column may contain nulls

  • access: protected
mixed $precision (line 39)

The precision of the column

  • access: protected
mixed $primary (line 52)

A flag indicating whether or not this is the primary key for the

table

  • access: protected
mixed $scale (line 35)

The scale of the columm

  • access: protected
mixed $sql_type (line 23)

The column data type (as reported by the DB)

  • access: protected
mixed $type (line 27)

The simplified column data type

  • access: protected
Methods
Constructor __construct (line 62)

Constructor

  • access: public
ActiveRecord_Column __construct (string $name, string $default, [string $sql_type = NULL], [bool $null_allowed = true])
  • string $name: The column name
  • string $default: The default value as a string
  • string $sql_type: The column data type
  • bool $null_allowed: Whether or not nulls are allowed
default_value (line 136)

Return the default value for the column

  • access: public
mixed default_value ()
extract_limit (line 264)

Retrieve the size limit from a raw SQL type

  • access: protected
int extract_limit (string $sql_type)
  • string $sql_type: The SQL type to use
extract_precision (line 279)

Retrieve the precision (for decimal types) from a raw SQL type

  • access: protected
int extract_precision (string $sql_type)
  • string $sql_type: The SQL type to use
extract_scale (line 294)

Retrieve the scale (for decimal types) from a raw SQL type

  • access: protected
int extract_scale (string $sql_type)
  • string $sql_type: The SQL type to use
is_number (line 173)

Return true if the data type is a numeric type

  • access: public
bool is_number ()
is_text (line 163)

Return true if the data type is a text type

  • access: public
bool is_text ()
limit (line 104)

Return the size limit of the column

  • access: public
int limit ()
name (line 77)

Return the column name

  • access: public
string name ()
null_allowed (line 128)

Returns true if the column may contain nulls, false otherwise.

  • access: public
bool null_allowed ()
precision (line 120)

Return the precision of the column

  • access: public
int precision ()
primary (line 144)

Returns true if this column is the tables primary key, false otherwise.

  • access: public
bool primary ()
reverse_type_cast (line 227)

The opposite of type_cast. Accepts a data type appropriate for this column and converts it (if required) back to a value appropriate for use in a SQL statement.

  • return: The value as the SQL-ready type
  • access: public
mixed reverse_type_cast (mixed $value)
  • mixed $value: The value to cast
scale (line 112)

Return the scale of the columm

  • access: public
int scale ()
set_primary (line 154)

Set whether or not this column is the tables primary key.

  • access: public
bool set_primary (bool $flag)
  • bool $flag: The new value for the primary indicator
simplified_type (line 311)

Return a normalized type name from a raw SQL type

  • access: protected
string simplified_type (string $sql_type)
  • string $sql_type: The SQL type to use
sql_type (line 85)

Return the column data type (as reported by the DB)

  • access: public
string sql_type ()
type (line 96)

Return the column data type as a normalized name. May be one of integer, float, decimal, datetime, date, timestamp, time, text, string, binary, or boolean.

  • access: public
string type ()
type_cast (line 186)

Cast a string or raw database value to the correct type for this column

  • return: The value as the correct type
  • access: public
mixed type_cast (mixed $value, [bool $allowNull = true])
  • mixed $value: The value to cast
  • bool $allowNull: Optional flag indicating whether or not NULL is an acceptable value (default is true)

Documentation generated on Wed, 25 Apr 2012 09:46:41 -0700 by phpDocumentor 1.4.3