Column extends BaseObject
Class BaseObject Base class for all schema objects such as tables, columns, indexes, etc.
Table of Contents
Properties
- $body : mixed
- $default : mixed
- $enum : mixed
- $length : mixed
- $name : mixed
- $nullable : mixed
- $parent : Table|null
- $precision : mixed
- $type : mixed
- $typeAddition : mixed
- $unsigned : mixed
Methods
- __construct() : mixed
- checkType() : bool
- Checks the $type against type list: - INT - INTEGER - TINYINT - NUMERIC - NUMBER - FLOAT - DOUBLE - DECIMAL - BIGINT - SMALLINT - MEDIUMINT - VARCHAR - CHAR - TIMESTAMP - DATETIME - DATE - TIME - TEXT - LONGTEXT - MEDIUMTEXT - TINYTEXT - BLOB - MEDIUMBLOB - LONGBLOB - TINYBLOB - BINARY - VARBINARY - ENUM - SET - BOOLEAN
- compareName() : int
- Compares name of the table with given.
- create() : Column
- Creates column object from tokens.
- getCompareName() : string
- Returns "normalized" name of the table.
- getCreateDdl() : array<string|int, mixed>|string
- Return DDL for table column creation.
- getDdlType() : string
- Returns DDL presentation of column data type.
- getDropDdl() : array<string|int, mixed>|string
- Return DDL for column destruction.
- getLength() : int
- Returns storage size for the column.
- getLowercasedName() : string
- Returns "lowercased" name of the object.
- getModifyDdl() : array<string|int, mixed>|string
- Return DDL for object modification.
- getUnquotedName() : array<string|int, mixed>|string
- Returns "unquoted" name of the object.
- setBody() : BaseObject
- Sets source code for object.
- setParent() : BaseObject
- Sets parent for object.
Properties
$body
public
mixed
$body
= ''
$default
public
mixed
$default
= null
$enum
public
mixed
$enum
= []
$length
public
mixed
$length
= ''
$name
public
mixed
$name
= ''
$nullable
public
mixed
$nullable
= true
$parent
public
Table|null
$parent
= null
$precision
public
mixed
$precision
= 0
$type
public
mixed
$type
= ''
$typeAddition
public
mixed
$typeAddition
= ''
$unsigned
public
mixed
$unsigned
= false
Methods
__construct()
public
__construct([string $name = '' ]) : mixed
Parameters
- $name : string = ''
-
Name of the table.
checkType()
Checks the $type against type list: - INT - INTEGER - TINYINT - NUMERIC - NUMBER - FLOAT - DOUBLE - DECIMAL - BIGINT - SMALLINT - MEDIUMINT - VARCHAR - CHAR - TIMESTAMP - DATETIME - DATE - TIME - TEXT - LONGTEXT - MEDIUMTEXT - TINYTEXT - BLOB - MEDIUMBLOB - LONGBLOB - TINYBLOB - BINARY - VARBINARY - ENUM - SET - BOOLEAN
public
static checkType(string $type) : bool
Parameters
- $type : string
-
Type of a column.
Return values
boolcompareName()
Compares name of the table with given.
public
final compareName(string $name) : int
If name has no quotes when comparison is case insensitive.
Parameters
- $name : string
-
Table name to compare.
Tags
Return values
intcreate()
Creates column object from tokens.
public
static create(Tokenizer $tokenizer[, mixed $parent = null ]) : Column
Current position should point to the name of the column.
Parameters
- $tokenizer : Tokenizer
-
Tokens collection.
- $parent : mixed = null
Tags
Return values
ColumngetCompareName()
Returns "normalized" name of the table.
public
final static getCompareName(string $name) : string
If name is not quoted then it made uppercase.
Parameters
- $name : string
-
Table name.
Return values
stringgetCreateDdl()
Return DDL for table column creation.
public
getCreateDdl([string $dbType = '' ]) : array<string|int, mixed>|string
Parameters
- $dbType : string = ''
-
Database type (MYSQL, ORACLE or MSSQL).
Return values
array<string|int, mixed>|stringgetDdlType()
Returns DDL presentation of column data type.
public
getDdlType() : string
Return values
stringgetDropDdl()
Return DDL for column destruction.
public
getDropDdl([string $dbType = '' ]) : array<string|int, mixed>|string
Parameters
- $dbType : string = ''
-
Database type (MYSQL, ORACLE or MSSQL).
Return values
array<string|int, mixed>|stringgetLength()
Returns storage size for the column.
public
getLength(int $charWidth[, int $maxLength = null ]) : int
Parameters
- $charWidth : int
-
Collation defined maximum character size in bytes.
- $maxLength : int = null
-
Overwrite column definition length.
Tags
Return values
intgetLowercasedName()
Returns "lowercased" name of the object.
public
final getLowercasedName() : string
If name is not quoted then it made lowercase.
Return values
stringgetModifyDdl()
Return DDL for object modification.
public
getModifyDdl(BaseObject $target[, string $dbType = '' ]) : array<string|int, mixed>|string
Implemented only for MySQL database. For Oracle or MS SQL returns commentary.
Parameters
- $target : BaseObject
-
Column object.
- $dbType : string = ''
-
Database type (MYSQL, ORACLE or MSSQL).
Return values
array<string|int, mixed>|stringgetUnquotedName()
Returns "unquoted" name of the object.
public
final getUnquotedName([array<string|int, mixed>|string $name = null ]) : array<string|int, mixed>|string
Parameters
- $name : array<string|int, mixed>|string = null
-
Name or array of names to unquote.
Return values
array<string|int, mixed>|stringsetBody()
Sets source code for object.
public
setBody(string $body) : BaseObject
Parameters
- $body : string
-
The body.
Return values
BaseObjectsetParent()
Sets parent for object.
public
setParent([BaseObject $parent = null ]) : BaseObject
For example Table for Column.
Parameters
- $parent : BaseObject = null
-
Parent object.