Documentation

MySqlGrammar extends Grammar
in package

Table of Contents

$modifiers  : array<string|int, mixed>
The possible column modifiers.
$serials  : array<string|int, mixed>
The possible column serials.
$tablePrefix  : string
The grammar table prefix.
$transactions  : bool
If this Grammar supports schema changes wrapped in a transaction.
columnize()  : string
Convert an array of column names into a delimited string.
compileAdd()  : string
Compile an add column command.
compileChange()  : array<string|int, mixed>
Compile a change column command into a series of SQL statements.
compileColumnListing()  : string
Compile the query to determine the list of columns.
compileCreate()  : string
Compile a create table command.
compileDisableForeignKeyConstraints()  : string
Compile the command to disable foreign key constraints.
compileDrop()  : string
Compile a drop table command.
compileDropAllTables()  : string
Compile the SQL needed to drop all tables.
compileDropColumn()  : string
Compile a drop column command.
compileDropForeign()  : string
Compile a drop foreign key command.
compileDropIfExists()  : string
Compile a drop table (if exists) command.
compileDropIndex()  : string
Compile a drop index command.
compileDropPrimary()  : string
Compile a drop primary key command.
compileDropSpatialIndex()  : string
Compile a drop spatial index command.
compileDropUnique()  : string
Compile a drop unique key command.
compileEnableForeignKeyConstraints()  : string
Compile the command to enable foreign key constraints.
compileForeign()  : string
Compile a foreign key command.
compileGetAllTables()  : string
Compile the SQL needed to retrieve all table names.
compileIndex()  : string
Compile a plain index key command.
compilePrimary()  : string
Compile a primary key command.
compileRename()  : string
Compile a rename table command.
compileRenameColumn()  : array<string|int, mixed>
Compile a rename column command.
compileSpatialIndex()  : string
Compile a spatial index key command.
compileTableExists()  : string
Compile the query to determine the list of tables.
compileUnique()  : string
Compile a unique key command.
getDateFormat()  : string
Get the format for database stored dates.
getDoctrineTableDiff()  : TableDiff
Create an empty Doctrine DBAL TableDiff from the Blueprint.
getTablePrefix()  : string
Get the grammar's table prefix.
getValue()  : string
Get the value of a raw expression.
isExpression()  : bool
Determine if the given value is a raw expression.
parameter()  : string
Get the appropriate query parameter place-holder for a value.
parameterize()  : string
Create query parameter place-holders for an array.
prefixArray()  : array<string|int, mixed>
Add a prefix to an array of values.
setTablePrefix()  : $this
Set the grammar's table prefix.
supportsSchemaTransactions()  : bool
Check if this Grammar supports schema changes wrapped in a transaction.
typeGeometry()  : string
Create the column definition for a spatial Geometry type.
typeGeometryCollection()  : string
Create the column definition for a spatial GeometryCollection type.
typeLineString()  : string
Create the column definition for a spatial LineString type.
typeMultiLineString()  : string
Create the column definition for a spatial MultiLineString type.
typeMultiPoint()  : string
Create the column definition for a spatial MultiPoint type.
typeMultiPolygon()  : string
Create the column definition for a spatial MultiPolygon type.
typePoint()  : string
Create the column definition for a spatial Point type.
typePolygon()  : string
Create the column definition for a spatial Polygon type.
wrap()  : string
Wrap a value in keyword identifiers.
wrapArray()  : array<string|int, mixed>
Wrap an array of values.
wrapTable()  : string
Wrap a table in keyword identifiers.
addModifiers()  : string
Add the column modifiers to the definition.
compileCreateEncoding()  : string
Append the character set specifications to a command.
compileCreateEngine()  : string
Append the engine specifications to a command.
compileCreateTable()  : string
Create the main create table clause.
compileKey()  : string
Compile an index creation command.
getColumns()  : array<string|int, mixed>
Compile the blueprint's column definitions.
getCommandByName()  : Fluent|null
Get the primary key command if it exists on the blueprint.
getCommandsByName()  : array<string|int, mixed>
Get all of the commands with a given name.
getDefaultValue()  : string
Format a value so that it can be used in "default" clauses.
getType()  : string
Get the SQL for the column data type.
modifyAfter()  : string|null
Get the SQL for an "after" column modifier.
modifyCharset()  : string|null
Get the SQL for a character set column modifier.
modifyCollate()  : string|null
Get the SQL for a collation column modifier.
modifyComment()  : string|null
Get the SQL for a "comment" column modifier.
modifyDefault()  : string|null
Get the SQL for a default column modifier.
modifyFirst()  : string|null
Get the SQL for a "first" column modifier.
modifyIncrement()  : string|null
Get the SQL for an auto-increment column modifier.
modifyNullable()  : string|null
Get the SQL for a nullable column modifier.
modifyStoredAs()  : string|null
Get the SQL for a generated stored column modifier.
modifyUnsigned()  : string|null
Get the SQL for an unsigned column modifier.
modifyVirtualAs()  : string|null
Get the SQL for a generated virtual column modifier.
typeBigInteger()  : string
Create the column definition for a big integer type.
typeBinary()  : string
Create the column definition for a binary type.
typeBoolean()  : string
Create the column definition for a boolean type.
typeChar()  : string
Create the column definition for a char type.
typeDate()  : string
Create the column definition for a date type.
typeDateTime()  : string
Create the column definition for a date-time type.
typeDateTimeTz()  : string
Create the column definition for a date-time (with time zone) type.
typeDecimal()  : string
Create the column definition for a decimal type.
typeDouble()  : string
Create the column definition for a double type.
typeEnum()  : string
Create the column definition for an enum type.
typeFloat()  : string
Create the column definition for a float type.
typeInteger()  : string
Create the column definition for an integer type.
typeIpAddress()  : string
Create the column definition for an IP address type.
typeJson()  : string
Create the column definition for a json type.
typeJsonb()  : string
Create the column definition for a jsonb type.
typeLongText()  : string
Create the column definition for a long text type.
typeMacAddress()  : string
Create the column definition for a MAC address type.
typeMediumInteger()  : string
Create the column definition for a medium integer type.
typeMediumText()  : string
Create the column definition for a medium text type.
typeSmallInteger()  : string
Create the column definition for a small integer type.
typeString()  : string
Create the column definition for a string type.
typeText()  : string
Create the column definition for a text type.
typeTime()  : string
Create the column definition for a time type.
typeTimestamp()  : string
Create the column definition for a timestamp type.
typeTimestampTz()  : string
Create the column definition for a timestamp (with time zone) type.
typeTimeTz()  : string
Create the column definition for a time (with time zone) type.
typeTinyInteger()  : string
Create the column definition for a tiny integer type.
typeUuid()  : string
Create the column definition for a uuid type.
typeYear()  : string
Create the column definition for a year type.
wrapAliasedValue()  : string
Wrap a value that has an alias.
wrapSegments()  : string
Wrap the given value segments.
wrapValue()  : string
Wrap a single string in keyword identifiers.

Properties

$modifiers

The possible column modifiers.

protected array<string|int, mixed> $modifiers = ['Unsigned', 'VirtualAs', 'StoredAs', 'Charset', 'Collate', 'Nullable', 'Default', 'Increment', 'Comment', 'After', 'First']

$serials

The possible column serials.

protected array<string|int, mixed> $serials = ['bigInteger', 'integer', 'mediumInteger', 'smallInteger', 'tinyInteger']

$tablePrefix

The grammar table prefix.

protected string $tablePrefix = ''

$transactions

If this Grammar supports schema changes wrapped in a transaction.

protected bool $transactions = false

Methods

columnize()

Convert an array of column names into a delimited string.

public columnize(array<string|int, mixed> $columns) : string
Parameters
$columns : array<string|int, mixed>
Return values
string

compileChange()

Compile a change column command into a series of SQL statements.

public compileChange(Blueprint $blueprint, Fluent $command, Connection $connection) : array<string|int, mixed>
Parameters
$blueprint : Blueprint
$command : Fluent
$connection : Connection
Tags
throws
RuntimeException
Return values
array<string|int, mixed>

compileColumnListing()

Compile the query to determine the list of columns.

public compileColumnListing() : string
Return values
string

compileDisableForeignKeyConstraints()

Compile the command to disable foreign key constraints.

public compileDisableForeignKeyConstraints() : string
Return values
string

compileDropAllTables()

Compile the SQL needed to drop all tables.

public compileDropAllTables(array<string|int, mixed> $tables) : string
Parameters
$tables : array<string|int, mixed>
Return values
string

compileDropForeign()

Compile a drop foreign key command.

public compileDropForeign(Blueprint $blueprint, Fluent $command) : string
Parameters
$blueprint : Blueprint
$command : Fluent
Return values
string

compileDropIfExists()

Compile a drop table (if exists) command.

public compileDropIfExists(Blueprint $blueprint, Fluent $command) : string
Parameters
$blueprint : Blueprint
$command : Fluent
Return values
string

compileDropPrimary()

Compile a drop primary key command.

public compileDropPrimary(Blueprint $blueprint, Fluent $command) : string
Parameters
$blueprint : Blueprint
$command : Fluent
Return values
string

compileDropSpatialIndex()

Compile a drop spatial index command.

public compileDropSpatialIndex(Blueprint $blueprint, Fluent $command) : string
Parameters
$blueprint : Blueprint
$command : Fluent
Return values
string

compileDropUnique()

Compile a drop unique key command.

public compileDropUnique(Blueprint $blueprint, Fluent $command) : string
Parameters
$blueprint : Blueprint
$command : Fluent
Return values
string

compileEnableForeignKeyConstraints()

Compile the command to enable foreign key constraints.

public compileEnableForeignKeyConstraints() : string
Return values
string

compileForeign()

Compile a foreign key command.

public compileForeign(Blueprint $blueprint, Fluent $command) : string
Parameters
$blueprint : Blueprint
$command : Fluent
Return values
string

compileGetAllTables()

Compile the SQL needed to retrieve all table names.

public compileGetAllTables() : string
Return values
string

compileRenameColumn()

Compile a rename column command.

public compileRenameColumn(Blueprint $blueprint, Fluent $command, Connection $connection) : array<string|int, mixed>
Parameters
$blueprint : Blueprint
$command : Fluent
$connection : Connection
Return values
array<string|int, mixed>

compileSpatialIndex()

Compile a spatial index key command.

public compileSpatialIndex(Blueprint $blueprint, Fluent $command) : string
Parameters
$blueprint : Blueprint
$command : Fluent
Return values
string

compileTableExists()

Compile the query to determine the list of tables.

public compileTableExists() : string
Return values
string

getDateFormat()

Get the format for database stored dates.

public getDateFormat() : string
Return values
string

getTablePrefix()

Get the grammar's table prefix.

public getTablePrefix() : string
Return values
string

getValue()

Get the value of a raw expression.

public getValue(Expression $expression) : string
Parameters
$expression : Expression
Return values
string

isExpression()

Determine if the given value is a raw expression.

public isExpression(mixed $value) : bool
Parameters
$value : mixed
Return values
bool

parameter()

Get the appropriate query parameter place-holder for a value.

public parameter(mixed $value) : string
Parameters
$value : mixed
Return values
string

parameterize()

Create query parameter place-holders for an array.

public parameterize(array<string|int, mixed> $values) : string
Parameters
$values : array<string|int, mixed>
Return values
string

prefixArray()

Add a prefix to an array of values.

public prefixArray(string $prefix, array<string|int, mixed> $values) : array<string|int, mixed>
Parameters
$prefix : string
$values : array<string|int, mixed>
Return values
array<string|int, mixed>

setTablePrefix()

Set the grammar's table prefix.

public setTablePrefix(string $prefix) : $this
Parameters
$prefix : string
Return values
$this

supportsSchemaTransactions()

Check if this Grammar supports schema changes wrapped in a transaction.

public supportsSchemaTransactions() : bool
Return values
bool

typeGeometry()

Create the column definition for a spatial Geometry type.

public typeGeometry(Fluent $column) : string
Parameters
$column : Fluent
Return values
string

typeGeometryCollection()

Create the column definition for a spatial GeometryCollection type.

public typeGeometryCollection(Fluent $column) : string
Parameters
$column : Fluent
Return values
string

typeLineString()

Create the column definition for a spatial LineString type.

public typeLineString(Fluent $column) : string
Parameters
$column : Fluent
Return values
string

typeMultiLineString()

Create the column definition for a spatial MultiLineString type.

public typeMultiLineString(Fluent $column) : string
Parameters
$column : Fluent
Return values
string

typeMultiPoint()

Create the column definition for a spatial MultiPoint type.

public typeMultiPoint(Fluent $column) : string
Parameters
$column : Fluent
Return values
string

typeMultiPolygon()

Create the column definition for a spatial MultiPolygon type.

public typeMultiPolygon(Fluent $column) : string
Parameters
$column : Fluent
Return values
string

typePoint()

Create the column definition for a spatial Point type.

public typePoint(Fluent $column) : string
Parameters
$column : Fluent
Return values
string

typePolygon()

Create the column definition for a spatial Polygon type.

public typePolygon(Fluent $column) : string
Parameters
$column : Fluent
Return values
string

wrap()

Wrap a value in keyword identifiers.

public wrap(Expression|string $value[, bool $prefixAlias = false ]) : string
Parameters
$value : Expression|string
$prefixAlias : bool = false
Return values
string

wrapArray()

Wrap an array of values.

public wrapArray(array<string|int, mixed> $values) : array<string|int, mixed>
Parameters
$values : array<string|int, mixed>
Return values
array<string|int, mixed>

wrapTable()

Wrap a table in keyword identifiers.

public wrapTable(Expression|string $table) : string
Parameters
$table : Expression|string
Return values
string

addModifiers()

Add the column modifiers to the definition.

protected addModifiers(string $sql, Blueprint $blueprint, Fluent $column) : string
Parameters
$sql : string
$blueprint : Blueprint
$column : Fluent
Return values
string

compileCreateEncoding()

Append the character set specifications to a command.

protected compileCreateEncoding(string $sql, Connection $connection, Blueprint $blueprint) : string
Parameters
$sql : string
$connection : Connection
$blueprint : Blueprint
Return values
string

compileCreateEngine()

Append the engine specifications to a command.

protected compileCreateEngine(string $sql, Connection $connection, Blueprint $blueprint) : string
Parameters
$sql : string
$connection : Connection
$blueprint : Blueprint
Return values
string

compileKey()

Compile an index creation command.

protected compileKey(Blueprint $blueprint, Fluent $command, string $type) : string
Parameters
$blueprint : Blueprint
$command : Fluent
$type : string
Return values
string

getColumns()

Compile the blueprint's column definitions.

protected getColumns(Blueprint $blueprint) : array<string|int, mixed>
Parameters
$blueprint : Blueprint
Return values
array<string|int, mixed>

getCommandByName()

Get the primary key command if it exists on the blueprint.

protected getCommandByName(Blueprint $blueprint, string $name) : Fluent|null
Parameters
$blueprint : Blueprint
$name : string
Return values
Fluent|null

getCommandsByName()

Get all of the commands with a given name.

protected getCommandsByName(Blueprint $blueprint, string $name) : array<string|int, mixed>
Parameters
$blueprint : Blueprint
$name : string
Return values
array<string|int, mixed>

getDefaultValue()

Format a value so that it can be used in "default" clauses.

protected getDefaultValue(mixed $value) : string
Parameters
$value : mixed
Return values
string

getType()

Get the SQL for the column data type.

protected getType(Fluent $column) : string
Parameters
$column : Fluent
Return values
string

modifyAfter()

Get the SQL for an "after" column modifier.

protected modifyAfter(Blueprint $blueprint, Fluent $column) : string|null
Parameters
$blueprint : Blueprint
$column : Fluent
Return values
string|null

modifyCharset()

Get the SQL for a character set column modifier.

protected modifyCharset(Blueprint $blueprint, Fluent $column) : string|null
Parameters
$blueprint : Blueprint
$column : Fluent
Return values
string|null

modifyCollate()

Get the SQL for a collation column modifier.

protected modifyCollate(Blueprint $blueprint, Fluent $column) : string|null
Parameters
$blueprint : Blueprint
$column : Fluent
Return values
string|null

modifyComment()

Get the SQL for a "comment" column modifier.

protected modifyComment(Blueprint $blueprint, Fluent $column) : string|null
Parameters
$blueprint : Blueprint
$column : Fluent
Return values
string|null

modifyDefault()

Get the SQL for a default column modifier.

protected modifyDefault(Blueprint $blueprint, Fluent $column) : string|null
Parameters
$blueprint : Blueprint
$column : Fluent
Return values
string|null

modifyFirst()

Get the SQL for a "first" column modifier.

protected modifyFirst(Blueprint $blueprint, Fluent $column) : string|null
Parameters
$blueprint : Blueprint
$column : Fluent
Return values
string|null

modifyIncrement()

Get the SQL for an auto-increment column modifier.

protected modifyIncrement(Blueprint $blueprint, Fluent $column) : string|null
Parameters
$blueprint : Blueprint
$column : Fluent
Return values
string|null

modifyNullable()

Get the SQL for a nullable column modifier.

protected modifyNullable(Blueprint $blueprint, Fluent $column) : string|null
Parameters
$blueprint : Blueprint
$column : Fluent
Return values
string|null

modifyStoredAs()

Get the SQL for a generated stored column modifier.

protected modifyStoredAs(Blueprint $blueprint, Fluent $column) : string|null
Parameters
$blueprint : Blueprint
$column : Fluent
Return values
string|null

modifyUnsigned()

Get the SQL for an unsigned column modifier.

protected modifyUnsigned(Blueprint $blueprint, Fluent $column) : string|null
Parameters
$blueprint : Blueprint
$column : Fluent
Return values
string|null

modifyVirtualAs()

Get the SQL for a generated virtual column modifier.

protected modifyVirtualAs(Blueprint $blueprint, Fluent $column) : string|null
Parameters
$blueprint : Blueprint
$column : Fluent
Return values
string|null

typeBigInteger()

Create the column definition for a big integer type.

protected typeBigInteger(Fluent $column) : string
Parameters
$column : Fluent
Return values
string

typeBinary()

Create the column definition for a binary type.

protected typeBinary(Fluent $column) : string
Parameters
$column : Fluent
Return values
string

typeBoolean()

Create the column definition for a boolean type.

protected typeBoolean(Fluent $column) : string
Parameters
$column : Fluent
Return values
string

typeChar()

Create the column definition for a char type.

protected typeChar(Fluent $column) : string
Parameters
$column : Fluent
Return values
string

typeDate()

Create the column definition for a date type.

protected typeDate(Fluent $column) : string
Parameters
$column : Fluent
Return values
string

typeDateTime()

Create the column definition for a date-time type.

protected typeDateTime(Fluent $column) : string
Parameters
$column : Fluent
Return values
string

typeDateTimeTz()

Create the column definition for a date-time (with time zone) type.

protected typeDateTimeTz(Fluent $column) : string
Parameters
$column : Fluent
Return values
string

typeDecimal()

Create the column definition for a decimal type.

protected typeDecimal(Fluent $column) : string
Parameters
$column : Fluent
Return values
string

typeDouble()

Create the column definition for a double type.

protected typeDouble(Fluent $column) : string
Parameters
$column : Fluent
Return values
string

typeEnum()

Create the column definition for an enum type.

protected typeEnum(Fluent $column) : string
Parameters
$column : Fluent
Return values
string

typeFloat()

Create the column definition for a float type.

protected typeFloat(Fluent $column) : string
Parameters
$column : Fluent
Return values
string

typeInteger()

Create the column definition for an integer type.

protected typeInteger(Fluent $column) : string
Parameters
$column : Fluent
Return values
string

typeIpAddress()

Create the column definition for an IP address type.

protected typeIpAddress(Fluent $column) : string
Parameters
$column : Fluent
Return values
string

typeJson()

Create the column definition for a json type.

protected typeJson(Fluent $column) : string
Parameters
$column : Fluent
Return values
string

typeJsonb()

Create the column definition for a jsonb type.

protected typeJsonb(Fluent $column) : string
Parameters
$column : Fluent
Return values
string

typeLongText()

Create the column definition for a long text type.

protected typeLongText(Fluent $column) : string
Parameters
$column : Fluent
Return values
string

typeMacAddress()

Create the column definition for a MAC address type.

protected typeMacAddress(Fluent $column) : string
Parameters
$column : Fluent
Return values
string

typeMediumInteger()

Create the column definition for a medium integer type.

protected typeMediumInteger(Fluent $column) : string
Parameters
$column : Fluent
Return values
string

typeMediumText()

Create the column definition for a medium text type.

protected typeMediumText(Fluent $column) : string
Parameters
$column : Fluent
Return values
string

typeSmallInteger()

Create the column definition for a small integer type.

protected typeSmallInteger(Fluent $column) : string
Parameters
$column : Fluent
Return values
string

typeString()

Create the column definition for a string type.

protected typeString(Fluent $column) : string
Parameters
$column : Fluent
Return values
string

typeText()

Create the column definition for a text type.

protected typeText(Fluent $column) : string
Parameters
$column : Fluent
Return values
string

typeTime()

Create the column definition for a time type.

protected typeTime(Fluent $column) : string
Parameters
$column : Fluent
Return values
string

typeTimestamp()

Create the column definition for a timestamp type.

protected typeTimestamp(Fluent $column) : string
Parameters
$column : Fluent
Return values
string

typeTimestampTz()

Create the column definition for a timestamp (with time zone) type.

protected typeTimestampTz(Fluent $column) : string
Parameters
$column : Fluent
Return values
string

typeTimeTz()

Create the column definition for a time (with time zone) type.

protected typeTimeTz(Fluent $column) : string
Parameters
$column : Fluent
Return values
string

typeTinyInteger()

Create the column definition for a tiny integer type.

protected typeTinyInteger(Fluent $column) : string
Parameters
$column : Fluent
Return values
string

typeUuid()

Create the column definition for a uuid type.

protected typeUuid(Fluent $column) : string
Parameters
$column : Fluent
Return values
string

typeYear()

Create the column definition for a year type.

protected typeYear(Fluent $column) : string
Parameters
$column : Fluent
Return values
string

wrapAliasedValue()

Wrap a value that has an alias.

protected wrapAliasedValue(string $value[, bool $prefixAlias = false ]) : string
Parameters
$value : string
$prefixAlias : bool = false
Return values
string

wrapSegments()

Wrap the given value segments.

protected wrapSegments(array<string|int, mixed> $segments) : string
Parameters
$segments : array<string|int, mixed>
Return values
string

wrapValue()

Wrap a single string in keyword identifiers.

protected wrapValue(string $value) : string
Parameters
$value : string
Return values
string

Search results