\Gishiki\Database\SchemaTable

Represent a table inside a database.

Summary

Methods
Properties
Constants
__construct()
addColumn()
getColumns()
setName()
getName()
No public properties found
No constants found
No protected methods found
$name
$columns
N/A
No private methods found
No private properties found
N/A

Properties

$name

$name : string

Type

string — the name of the table

$columns

$columns : array

Type

array — a list of columns inside the current database

Methods

__construct()

__construct(string  $name) 

Initialize a table with the given name.

This function internally calls setName(), and you should catch exceptions thrown by that function.

Parameters

string $name

the name of the table

addColumn()

addColumn(\Gishiki\Database\Schema\Column  $col) : \Gishiki\Database\Schema\Table

Add a column to the current table.

Parameters

\Gishiki\Database\Schema\Column $col

the column to be added

Throws

\Gishiki\Database\DatabaseException

A table with the same name already exists

Returns

\Gishiki\Database\Schema\Table

a reference to the modified table

getColumns()

getColumns() : array<mixed,\Gishiki\Database\Schema\Column>

Return the list of columns inside the current table.

Returns

array<mixed,\Gishiki\Database\Schema\Column> —

the list of columns

setName()

setName(string  $name) : \Gishiki\Database\Schema\Table

Change the name of the current table.

Parameters

string $name

the name of the table

Throws

\InvalidArgumentException

the table name is invalid

Returns

\Gishiki\Database\Schema\Table

a reference to the modified table

getName()

getName() : string

Retrieve the name of the table.

Returns

string —

the table name