CDbColumnSchema
CDbColumnSchema class describes the column meta data of a database table.
Public Properties
Hide inherited properties
| Property | Type | Description | Defined By |
| allowNull |
boolean |
whether this column can be null. |
CDbColumnSchema |
| dbType |
string |
the DB type of this column. |
CDbColumnSchema |
| defaultValue |
mixed |
default value of this column |
CDbColumnSchema |
| isForeignKey |
boolean |
whether this column is a foreign key |
CDbColumnSchema |
| isPrimaryKey |
boolean |
whether this column is a primary key |
CDbColumnSchema |
| name |
string |
name of this column (without quotes). |
CDbColumnSchema |
| precision |
integer |
precision of the column data, if it is numeric. |
CDbColumnSchema |
| rawName |
string |
raw name of this column. |
CDbColumnSchema |
| scale |
integer |
scale of the column data, if it is numeric. |
CDbColumnSchema |
| size |
integer |
size of the column. |
CDbColumnSchema |
| type |
string |
the PHP type of this column. |
CDbColumnSchema |
Property Details
public boolean $allowNull;
whether this column can be null.
public string $dbType;
the DB type of this column.
public mixed $defaultValue;
default value of this column
public boolean $isForeignKey;
whether this column is a foreign key
public boolean $isPrimaryKey;
whether this column is a primary key
public string $name;
name of this column (without quotes).
public integer $precision;
precision of the column data, if it is numeric.
public string $rawName;
raw name of this column. This is the quoted name that can be used in SQL queries.
public integer $scale;
scale of the column data, if it is numeric.
public integer $size;
size of the column.
public string $type;
the PHP type of this column.
Method Details
|
protected void extractDefault(mixed $defaultValue)
|
| $defaultValue |
mixed |
the default value obtained from metadata |
Extracts the default value for the column.
The value is typecasted to correct PHP type.
|
protected void extractLimit(string $dbType)
|
| $dbType |
string |
the column's DB type |
Extracts size, precision and scale information from column's DB type.
|
protected void extractType(string $dbType)
|
| $dbType |
string |
DB type |
Extracts the PHP type from DB type.
|
public void init(string $dbType, mixed $defaultValue)
|
| $dbType |
string |
the column's DB type |
| $defaultValue |
mixed |
the default value |
Initializes the column with its DB type and default value.
This sets up the column's PHP type, size, precision, scale as well as default value.
|
public mixed typecast(mixed $value)
|
| $value |
mixed |
input value |
| {return} |
mixed |
converted value |
Converts the input value to the type that this column is of.