AlterTable
extends TableStatement
in package
Class AlterTable.
Tags
Table of Contents
Constants
- ALGO_COPY : string = 'COPY'
- ALGO_DEFAULT : string = 'DEFAULT'
- ALGO_INPLACE : string = 'INPLACE'
- ALGO_INSTANT : string = 'INSTANT'
- ALGO_NOCOPY : string = 'NOCOPY'
- LOCK_DEFAULT : string = 'DEFAULT'
- LOCK_EXCLUSIVE : string = 'EXCLUSIVE'
- LOCK_NONE : string = 'NONE'
- LOCK_SHARED : string = 'SHARED'
- OPT_AUTO_INCREMENT : string = 'AUTO_INCREMENT'
- OPT_AVG_ROW_LENGTH : string = 'AVG_ROW_LENGTH'
- OPT_CHARSET : string = 'CHARSET'
- OPT_CHECKSUM : string = 'CHECKSUM'
- OPT_COLLATE : string = 'COLLATE'
- OPT_COMMENT : string = 'COMMENT'
- OPT_CONNECTION : string = 'CONNECTION'
- OPT_DATA_DIRECTORY : string = 'DATA DIRECTORY'
- OPT_DELAY_KEY_WRITE : string = 'DELAY_KEY_WRITE'
- OPT_ENCRYPTED : string = 'ENCRYPTED'
- OPT_ENCRYPTION_KEY_ID : string = 'ENCRYPTION_KEY_ID'
- OPT_ENGINE : string = 'ENGINE'
- OPT_IETF_QUOTES : string = 'IETF_QUOTES'
- OPT_INDEX_DIRECTORY : string = 'INDEX DIRECTORY'
- OPT_INSERT_METHOD : string = 'INSERT_METHOD'
- OPT_KEY_BLOCK_SIZE : string = 'KEY_BLOCK_SIZE'
- OPT_MAX_ROWS : string = 'MAX_ROWS'
- OPT_MIN_ROWS : string = 'MIN_ROWS'
- OPT_PACK_KEYS : string = 'PACK_KEYS'
- OPT_PAGE_CHECKSUM : string = 'PAGE_CHECKSUM'
- OPT_PAGE_COMPRESSED : string = 'PAGE_COMPRESSED'
- OPT_PAGE_COMPRESSION_LEVEL : string = 'PAGE_COMPRESSION_LEVEL'
- OPT_PASSWORD : string = 'PASSWORD'
- OPT_ROW_FORMAT : string = 'ROW_FORMAT'
- OPT_SEQUENCE : string = 'SEQUENCE'
- OPT_STATS_AUTO_RECALC : string = 'STATS_AUTO_RECALC'
- OPT_STATS_PERSISTENT : string = 'STATS_PERSISTENT'
- OPT_STATS_SAMPLE_PAGES : string = 'STATS_SAMPLE_PAGES'
- OPT_TABLESPACE : string = 'TABLESPACE'
- OPT_TRANSACTIONAL : string = 'TRANSACTIONAL'
- OPT_UNION : string = 'UNION'
- OPT_WITH_SYSTEM_VERSIONING : string = 'WITH SYSTEM VERSIONING'
Properties
Methods
- __construct() : mixed
- Statement constructor.
- __toString() : string
- add() : static
- addIfNotExists() : static
- algorithm() : static
- change() : static
- changeIfExists() : static
- charset() : static
- collate() : static
- convertToCharset() : static
- disableKeys() : static
- dropColumn() : static
- dropColumnIfExists() : static
- dropConstraint() : static
- dropConstraintIfExists() : static
- dropForeignKey() : static
- dropForeignKeyIfExists() : static
- dropKey() : static
- dropKeyIfExists() : static
- dropPrimaryKey() : static
- enableKeys() : static
- force() : static
- ifExists() : static
- ignore() : static
- lock() : static
- modify() : static
- modifyIfExists() : static
- noWait() : static
- online() : static
- option() : static
- Adds a table option.
- options() : static
- Adds table options.
- orderBy() : static
- renameColumn() : static
- renameKey() : static
- renameTo() : static
- reset() : static
- Resets SQL clauses and parts.
- run() : int|string
- Runs the ALTER TABLE statement.
- sql() : string
- Renders the SQL statement.
- table() : static
- wait() : static
- joinParts() : string
- renderAdd() : string|null
- renderAlgorithm() : string|null
- renderChange() : string|null
- renderCharset() : string|null
- renderCollate() : string|null
- renderConvertToCharset() : string|null
- renderDisableKeys() : string|null
- renderDropColumns() : string|null
- renderDropConstraints() : string|null
- renderDropForeignKeys() : string|null
- renderDropKeys() : string|null
- renderDropPrimaryKey() : string|null
- renderEnableKeys() : string|null
- renderForce() : string|null
- renderIfExists() : string|null
- renderIgnore() : string|null
- renderLock() : string|null
- renderModify() : string|null
- renderNoWait() : string|null
- renderOnline() : string|null
- renderOptions() : string|null
- renderOrderBy() : string|null
- renderRenameColumns() : string|null
- renderRenameKeys() : string|null
- renderRenameTo() : string|null
- renderTable() : string
- renderWait() : string|null
Constants
ALGO_COPY
public
string
ALGO_COPY
= 'COPY'
ALGO_DEFAULT
public
string
ALGO_DEFAULT
= 'DEFAULT'
ALGO_INPLACE
public
string
ALGO_INPLACE
= 'INPLACE'
ALGO_INSTANT
public
string
ALGO_INSTANT
= 'INSTANT'
ALGO_NOCOPY
public
string
ALGO_NOCOPY
= 'NOCOPY'
LOCK_DEFAULT
public
string
LOCK_DEFAULT
= 'DEFAULT'
LOCK_EXCLUSIVE
public
string
LOCK_EXCLUSIVE
= 'EXCLUSIVE'
LOCK_NONE
public
string
LOCK_NONE
= 'NONE'
LOCK_SHARED
public
string
LOCK_SHARED
= 'SHARED'
OPT_AUTO_INCREMENT
public
string
OPT_AUTO_INCREMENT
= 'AUTO_INCREMENT'
Tags
OPT_AVG_ROW_LENGTH
public
string
OPT_AVG_ROW_LENGTH
= 'AVG_ROW_LENGTH'
Tags
OPT_CHARSET
public
string
OPT_CHARSET
= 'CHARSET'
Tags
OPT_CHECKSUM
public
string
OPT_CHECKSUM
= 'CHECKSUM'
Tags
OPT_COLLATE
public
string
OPT_COLLATE
= 'COLLATE'
Tags
OPT_COMMENT
public
string
OPT_COMMENT
= 'COMMENT'
Tags
OPT_CONNECTION
public
string
OPT_CONNECTION
= 'CONNECTION'
Tags
OPT_DATA_DIRECTORY
public
string
OPT_DATA_DIRECTORY
= 'DATA DIRECTORY'
Tags
OPT_DELAY_KEY_WRITE
public
string
OPT_DELAY_KEY_WRITE
= 'DELAY_KEY_WRITE'
Tags
OPT_ENCRYPTED
public
string
OPT_ENCRYPTED
= 'ENCRYPTED'
Tags
OPT_ENCRYPTION_KEY_ID
public
string
OPT_ENCRYPTION_KEY_ID
= 'ENCRYPTION_KEY_ID'
Tags
OPT_ENGINE
public
string
OPT_ENGINE
= 'ENGINE'
Tags
OPT_IETF_QUOTES
public
string
OPT_IETF_QUOTES
= 'IETF_QUOTES'
Tags
OPT_INDEX_DIRECTORY
public
string
OPT_INDEX_DIRECTORY
= 'INDEX DIRECTORY'
Tags
OPT_INSERT_METHOD
public
string
OPT_INSERT_METHOD
= 'INSERT_METHOD'
Tags
OPT_KEY_BLOCK_SIZE
public
string
OPT_KEY_BLOCK_SIZE
= 'KEY_BLOCK_SIZE'
Tags
OPT_MAX_ROWS
public
string
OPT_MAX_ROWS
= 'MAX_ROWS'
Tags
OPT_MIN_ROWS
public
string
OPT_MIN_ROWS
= 'MIN_ROWS'
Tags
OPT_PACK_KEYS
public
string
OPT_PACK_KEYS
= 'PACK_KEYS'
Tags
OPT_PAGE_CHECKSUM
public
string
OPT_PAGE_CHECKSUM
= 'PAGE_CHECKSUM'
Tags
OPT_PAGE_COMPRESSED
public
string
OPT_PAGE_COMPRESSED
= 'PAGE_COMPRESSED'
Tags
OPT_PAGE_COMPRESSION_LEVEL
public
string
OPT_PAGE_COMPRESSION_LEVEL
= 'PAGE_COMPRESSION_LEVEL'
Tags
OPT_PASSWORD
public
string
OPT_PASSWORD
= 'PASSWORD'
Tags
OPT_ROW_FORMAT
public
string
OPT_ROW_FORMAT
= 'ROW_FORMAT'
Tags
OPT_SEQUENCE
public
string
OPT_SEQUENCE
= 'SEQUENCE'
Tags
OPT_STATS_AUTO_RECALC
public
string
OPT_STATS_AUTO_RECALC
= 'STATS_AUTO_RECALC'
Tags
OPT_STATS_PERSISTENT
public
string
OPT_STATS_PERSISTENT
= 'STATS_PERSISTENT'
Tags
OPT_STATS_SAMPLE_PAGES
public
string
OPT_STATS_SAMPLE_PAGES
= 'STATS_SAMPLE_PAGES'
Tags
OPT_TABLESPACE
public
string
OPT_TABLESPACE
= 'TABLESPACE'
Tags
OPT_TRANSACTIONAL
public
string
OPT_TRANSACTIONAL
= 'TRANSACTIONAL'
Tags
OPT_UNION
public
string
OPT_UNION
= 'UNION'
Tags
OPT_WITH_SYSTEM_VERSIONING
public
string
OPT_WITH_SYSTEM_VERSIONING
= 'WITH SYSTEM VERSIONING'
Tags
Properties
$database
protected
Database
$database
$sql
SQL clauses and parts.
protected
array<string, mixed>
$sql
= []
Methods
__construct()
Statement constructor.
public
__construct(Database $database) : mixed
Parameters
- $database : Database
__toString()
public
__toString() : string
Return values
stringadd()
public
add(callable $definition[, bool $ifNotExists = false ]) : static
Parameters
- $definition : callable
- $ifNotExists : bool = false
Return values
staticaddIfNotExists()
public
addIfNotExists(callable $definition) : static
Parameters
- $definition : callable
Return values
staticalgorithm()
public
algorithm(string $algo) : static
Parameters
- $algo : string
Tags
Return values
staticchange()
public
change(callable $definition[, bool $ifExists = false ]) : static
Parameters
- $definition : callable
- $ifExists : bool = false
Return values
staticchangeIfExists()
public
changeIfExists(callable $definition) : static
Parameters
- $definition : callable
Return values
staticcharset()
public
charset(string|null $charset) : static
Parameters
- $charset : string|null
Return values
staticcollate()
public
collate(string|null $collation) : static
Parameters
- $collation : string|null
Return values
staticconvertToCharset()
public
convertToCharset(string $charset[, string|null $collation = null ]) : static
Parameters
- $charset : string
- $collation : string|null = null
Return values
staticdisableKeys()
public
disableKeys() : static
Return values
staticdropColumn()
public
dropColumn(string $name[, bool $ifExists = false ]) : static
Parameters
- $name : string
- $ifExists : bool = false
Return values
staticdropColumnIfExists()
public
dropColumnIfExists(string $name) : static
Parameters
- $name : string
Return values
staticdropConstraint()
public
dropConstraint(string $name[, bool $ifExists = false ]) : static
Parameters
- $name : string
- $ifExists : bool = false
Return values
staticdropConstraintIfExists()
public
dropConstraintIfExists(string $name) : static
Parameters
- $name : string
Return values
staticdropForeignKey()
public
dropForeignKey(string $name[, bool $ifExists = false ]) : static
Parameters
- $name : string
- $ifExists : bool = false
Return values
staticdropForeignKeyIfExists()
public
dropForeignKeyIfExists(string $name) : static
Parameters
- $name : string
Return values
staticdropKey()
public
dropKey(string $name[, bool $ifExists = false ]) : static
Parameters
- $name : string
- $ifExists : bool = false
Return values
staticdropKeyIfExists()
public
dropKeyIfExists(string $name) : static
Parameters
- $name : string
Return values
staticdropPrimaryKey()
public
dropPrimaryKey() : static
Return values
staticenableKeys()
public
enableKeys() : static
Return values
staticforce()
public
force() : static
Return values
staticifExists()
public
ifExists() : static
Return values
staticignore()
public
ignore() : static
Return values
staticlock()
public
lock(string $type) : static
Parameters
- $type : string
Tags
Return values
staticmodify()
public
modify(callable $definition[, bool $ifExists = false ]) : static
Parameters
- $definition : callable
- $ifExists : bool = false
Return values
staticmodifyIfExists()
public
modifyIfExists(callable $definition) : static
Parameters
- $definition : callable
Return values
staticnoWait()
public
noWait() : static
Return values
staticonline()
public
online() : static
Return values
staticoption()
Adds a table option.
public
option(string $name[, int|string|null $value = null ]) : static
Parameters
- $name : string
- $value : int|string|null = null
Return values
staticoptions()
Adds table options.
public
options(array<string, int|string> $options) : static
Parameters
- $options : array<string, int|string>
Return values
staticorderBy()
public
orderBy(string $column, string ...$columns) : static
Parameters
- $column : string
- $columns : string
Return values
staticrenameColumn()
public
renameColumn(string $name, string $newName) : static
Parameters
- $name : string
- $newName : string
Return values
staticrenameKey()
public
renameKey(string $name, string $newName) : static
Parameters
- $name : string
- $newName : string
Return values
staticrenameTo()
public
renameTo(string $newTableName) : static
Parameters
- $newTableName : string
Return values
staticreset()
Resets SQL clauses and parts.
public
reset([string|null $sql = null ]) : static
Parameters
- $sql : string|null = null
-
A part name or null to reset all
Tags
Return values
staticrun()
Runs the ALTER TABLE statement.
public
run() : int|string
Return values
int|string —The number of affected rows
sql()
Renders the SQL statement.
public
sql() : string
Return values
stringtable()
public
table(string $tableName) : static
Parameters
- $tableName : string
Return values
staticwait()
public
wait(int $seconds) : static
Parameters
- $seconds : int
Return values
staticjoinParts()
protected
joinParts(array<string|int, string|null> $parts) : string
Parameters
- $parts : array<string|int, string|null>
Return values
stringrenderAdd()
protected
renderAdd() : string|null
Return values
string|nullrenderAlgorithm()
protected
renderAlgorithm() : string|null
Return values
string|nullrenderChange()
protected
renderChange() : string|null
Return values
string|nullrenderCharset()
protected
renderCharset() : string|null
Return values
string|nullrenderCollate()
protected
renderCollate() : string|null
Return values
string|nullrenderConvertToCharset()
protected
renderConvertToCharset() : string|null
Return values
string|nullrenderDisableKeys()
protected
renderDisableKeys() : string|null
Return values
string|nullrenderDropColumns()
protected
renderDropColumns() : string|null
Return values
string|nullrenderDropConstraints()
protected
renderDropConstraints() : string|null
Return values
string|nullrenderDropForeignKeys()
protected
renderDropForeignKeys() : string|null
Return values
string|nullrenderDropKeys()
protected
renderDropKeys() : string|null
Return values
string|nullrenderDropPrimaryKey()
protected
renderDropPrimaryKey() : string|null
Return values
string|nullrenderEnableKeys()
protected
renderEnableKeys() : string|null
Return values
string|nullrenderForce()
protected
renderForce() : string|null
Return values
string|nullrenderIfExists()
protected
renderIfExists() : string|null
Return values
string|nullrenderIgnore()
protected
renderIgnore() : string|null
Return values
string|nullrenderLock()
protected
renderLock() : string|null
Return values
string|nullrenderModify()
protected
renderModify() : string|null
Return values
string|nullrenderNoWait()
protected
renderNoWait() : string|null
Return values
string|nullrenderOnline()
protected
renderOnline() : string|null
Return values
string|nullrenderOptions()
protected
renderOptions() : string|null
Return values
string|nullrenderOrderBy()
protected
renderOrderBy() : string|null
Return values
string|nullrenderRenameColumns()
protected
renderRenameColumns() : string|null
Return values
string|nullrenderRenameKeys()
protected
renderRenameKeys() : string|null
Return values
string|nullrenderRenameTo()
protected
renderRenameTo() : string|null
Return values
string|nullrenderTable()
protected
renderTable() : string
Return values
stringrenderWait()
protected
renderWait() : string|null