PHP Class Doctrine\DBAL\Platforms\MySqlPlatform

Since: 2.0
Author: Roman Borschel ([email protected])
Inheritance: extends Doctrine\DBAL\Platforms\AbstractPlatform
Show file Open project: doctrine/dbal Class Usage Examples

Public Methods

Method Description
getAdvancedForeignKeyOptionsSQL ( Doctrine\DBAL\Schema\ForeignKeyConstraint $foreignKey ) {@inheritDoc}
getAlterTableSQL ( Doctrine\DBAL\Schema\TableDiff $diff ) {@inheritDoc}
getBigIntTypeDeclarationSQL ( array $field ) {@inheritDoc}
getBinaryMaxLength ( )
getBlobTypeDeclarationSQL ( array $field ) : string Gets the SQL Snippet used to declare a BLOB column type.
getBooleanTypeDeclarationSQL ( array $field ) {@inheritDoc}
getClobTypeDeclarationSQL ( array $field ) : string Gets the SQL snippet used to declare a CLOB column type.
getCollationFieldDeclaration ( string $collation ) : string Obtain DBMS specific SQL code portion needed to set the COLLATION of a field declaration to be used in statements like CREATE TABLE.
getConcatExpression ( ) {@inheritDoc}
getCreateDatabaseSQL ( $name ) {@inheritDoc}
getCreateViewSQL ( $name, $sql ) {@inheritDoc}
getDateDiffExpression ( $date1, $date2 ) {@inheritDoc}
getDateTimeTypeDeclarationSQL ( array $fieldDeclaration ) {@inheritDoc}
getDateTypeDeclarationSQL ( array $fieldDeclaration ) {@inheritDoc}
getDecimalTypeDeclarationSQL ( array $columnDef )
getDefaultValueDeclarationSQL ( $field )
getDropDatabaseSQL ( $name ) {@inheritDoc}
getDropIndexSQL ( $index, $table = null ) {@inheritDoc}
getDropTemporaryTableSQL ( $table ) {@inheritDoc}
getDropViewSQL ( $name ) {@inheritDoc}
getFloatDeclarationSQL ( array $field )
getGuidExpression ( ) {@inheritDoc}
getIdentifierQuoteCharacter ( ) {@inheritDoc}
getIntegerTypeDeclarationSQL ( array $field ) {@inheritDoc}
getListDatabasesSQL ( ) {@inheritDoc}
getListTableColumnsSQL ( $table, $database = null ) {@inheritDoc}
getListTableConstraintsSQL ( $table ) {@inheritDoc}
getListTableForeignKeysSQL ( $table, $database = null ) {@inheritDoc}
getListTableIndexesSQL ( $table, $currentDatabase = null ) {@inheritDoc}
getListTablesSQL ( ) {@inheritDoc}
getListViewsSQL ( $database ) {@inheritDoc}
getLocateExpression ( $str, $substr, $startPos = false ) {@inheritDoc}
getName ( ) {@inheritDoc}
getReadLockSQL ( ) {@inheritDoc}
getRegexpExpression ( ) {@inheritDoc}
getSetTransactionIsolationSQL ( $level ) {@inheritDoc}
getSmallIntTypeDeclarationSQL ( array $field ) {@inheritDoc}
getTimeTypeDeclarationSQL ( array $fieldDeclaration ) {@inheritDoc}
getVarcharMaxLength ( ) {@inheritDoc}
prefersIdentityColumns ( ) {@inheritDoc}
quoteStringLiteral ( $str )
supportsColumnCollation ( ) {@inheritDoc}
supportsIdentityColumns ( ) {@inheritDoc}
supportsInlineColumnComments ( ) {@inheritDoc}

Protected Methods

Method Description
_getCommonIntegerTypeDeclarationSQL ( array $columnDef ) {@inheritDoc}
_getCreateTableSQL ( $tableName, array $columns, array $options = [] ) {@inheritDoc}
doModifyLimitQuery ( string $query, integer $limit, integer $offset ) : string Adds MySQL-specific LIMIT clause to the query 18446744073709551615 is 2^64-1 maximum of unsigned BIGINT the biggest limit possible
getBinaryTypeDeclarationSQLSnippet ( $length, $fixed )
getCreateIndexSQLFlags ( Doctrine\DBAL\Schema\Index $index ) {@inheritDoc}
getDateArithmeticIntervalExpression ( $date, $operator, $interval, $unit )
getDropPrimaryKeySQL ( string $table ) : string
getPostAlterTableIndexForeignKeySQL ( Doctrine\DBAL\Schema\TableDiff $diff )
getPostAlterTableRenameIndexForeignKeySQL ( Doctrine\DBAL\Schema\TableDiff $diff ) : array
getPreAlterTableIndexForeignKeySQL ( Doctrine\DBAL\Schema\TableDiff $diff ) {@inheritDoc}
getPreAlterTableRenameIndexForeignKeySQL ( Doctrine\DBAL\Schema\TableDiff $diff ) : array
getReservedKeywordsClass ( ) {@inheritDoc}
getVarcharTypeDeclarationSQLSnippet ( $length, $fixed ) {@inheritDoc}
initializeDoctrineTypeMappings ( ) {@inheritDoc}

Private Methods

Method Description
buildPartitionOptions ( array $options ) : string Build SQL for partition options.
buildTableOptions ( array $options ) : string Build SQL for table options
getPreAlterTableAlterIndexForeignKeySQL ( Doctrine\DBAL\Schema\TableDiff $diff ) : array
getPreAlterTableAlterPrimaryKeySQL ( Doctrine\DBAL\Schema\TableDiff $diff, Doctrine\DBAL\Schema\Index $index ) : string[]
getRemainingForeignKeyConstraintsRequiringRenamedIndexes ( Doctrine\DBAL\Schema\TableDiff $diff ) : array Returns the remaining foreign key constraints that require one of the renamed indexes.
getUnsignedDeclaration ( array $columnDef ) : string Get unsigned declaration for a column.

Method Details

_getCommonIntegerTypeDeclarationSQL() protected method

{@inheritDoc}
protected _getCommonIntegerTypeDeclarationSQL ( array $columnDef )
$columnDef array

_getCreateTableSQL() protected method

{@inheritDoc}
protected _getCreateTableSQL ( $tableName, array $columns, array $options = [] )
$columns array
$options array

doModifyLimitQuery() protected method

Adds MySQL-specific LIMIT clause to the query 18446744073709551615 is 2^64-1 maximum of unsigned BIGINT the biggest limit possible
protected doModifyLimitQuery ( string $query, integer $limit, integer $offset ) : string
$query string
$limit integer
$offset integer
return string

getAdvancedForeignKeyOptionsSQL() public method

{@inheritDoc}
public getAdvancedForeignKeyOptionsSQL ( Doctrine\DBAL\Schema\ForeignKeyConstraint $foreignKey )
$foreignKey Doctrine\DBAL\Schema\ForeignKeyConstraint

getAlterTableSQL() public method

{@inheritDoc}
public getAlterTableSQL ( Doctrine\DBAL\Schema\TableDiff $diff )
$diff Doctrine\DBAL\Schema\TableDiff

getBigIntTypeDeclarationSQL() public method

{@inheritDoc}
public getBigIntTypeDeclarationSQL ( array $field )
$field array

getBinaryMaxLength() public method

public getBinaryMaxLength ( )

getBinaryTypeDeclarationSQLSnippet() protected method

protected getBinaryTypeDeclarationSQLSnippet ( $length, $fixed )

getBlobTypeDeclarationSQL() public method

TINYBLOB : 2 ^ 8 - 1 = 255 BLOB : 2 ^ 16 - 1 = 65535 MEDIUMBLOB : 2 ^ 24 - 1 = 16777215 LONGBLOB : 2 ^ 32 - 1 = 4294967295
public getBlobTypeDeclarationSQL ( array $field ) : string
$field array
return string

getBooleanTypeDeclarationSQL() public method

{@inheritDoc}
public getBooleanTypeDeclarationSQL ( array $field )
$field array

getClobTypeDeclarationSQL() public method

TINYTEXT : 2 ^ 8 - 1 = 255 TEXT : 2 ^ 16 - 1 = 65535 MEDIUMTEXT : 2 ^ 24 - 1 = 16777215 LONGTEXT : 2 ^ 32 - 1 = 4294967295
public getClobTypeDeclarationSQL ( array $field ) : string
$field array
return string

getCollationFieldDeclaration() public method

Obtain DBMS specific SQL code portion needed to set the COLLATION of a field declaration to be used in statements like CREATE TABLE.
Deprecation: Deprecated since version 2.5, Use {@link self::getColumnCollationDeclarationSQL()} instead.
public getCollationFieldDeclaration ( string $collation ) : string
$collation string name of the collation
return string DBMS specific SQL code portion needed to set the COLLATION of a field declaration.

getConcatExpression() public method

{@inheritDoc}
public getConcatExpression ( )

getCreateDatabaseSQL() public method

{@inheritDoc}
public getCreateDatabaseSQL ( $name )

getCreateIndexSQLFlags() protected method

{@inheritDoc}
protected getCreateIndexSQLFlags ( Doctrine\DBAL\Schema\Index $index )
$index Doctrine\DBAL\Schema\Index

getCreateViewSQL() public method

{@inheritDoc}
public getCreateViewSQL ( $name, $sql )

getDateArithmeticIntervalExpression() protected method

protected getDateArithmeticIntervalExpression ( $date, $operator, $interval, $unit )

getDateDiffExpression() public method

{@inheritDoc}
public getDateDiffExpression ( $date1, $date2 )

getDateTimeTypeDeclarationSQL() public method

{@inheritDoc}
public getDateTimeTypeDeclarationSQL ( array $fieldDeclaration )
$fieldDeclaration array

getDateTypeDeclarationSQL() public method

{@inheritDoc}
public getDateTypeDeclarationSQL ( array $fieldDeclaration )
$fieldDeclaration array

getDecimalTypeDeclarationSQL() public method

public getDecimalTypeDeclarationSQL ( array $columnDef )
$columnDef array

getDefaultValueDeclarationSQL() public method

public getDefaultValueDeclarationSQL ( $field )

getDropDatabaseSQL() public method

{@inheritDoc}
public getDropDatabaseSQL ( $name )

getDropIndexSQL() public method

{@inheritDoc}
public getDropIndexSQL ( $index, $table = null )

getDropPrimaryKeySQL() protected method

protected getDropPrimaryKeySQL ( string $table ) : string
$table string
return string

getDropTemporaryTableSQL() public method

MySQL commits a transaction implicitly when DROP TABLE is executed, however not if DROP TEMPORARY TABLE is executed.
public getDropTemporaryTableSQL ( $table )

getDropViewSQL() public method

{@inheritDoc}
public getDropViewSQL ( $name )

getFloatDeclarationSQL() public method

public getFloatDeclarationSQL ( array $field )
$field array

getGuidExpression() public method

{@inheritDoc}
public getGuidExpression ( )

getIdentifierQuoteCharacter() public method

{@inheritDoc}

getIntegerTypeDeclarationSQL() public method

{@inheritDoc}
public getIntegerTypeDeclarationSQL ( array $field )
$field array

getListDatabasesSQL() public method

{@inheritDoc}
public getListDatabasesSQL ( )

getListTableColumnsSQL() public method

{@inheritDoc}
public getListTableColumnsSQL ( $table, $database = null )

getListTableConstraintsSQL() public method

{@inheritDoc}
public getListTableConstraintsSQL ( $table )

getListTableForeignKeysSQL() public method

{@inheritDoc}
public getListTableForeignKeysSQL ( $table, $database = null )

getListTableIndexesSQL() public method

Two approaches to listing the table indexes. The information_schema is preferred, because it doesn't cause problems with SQL keywords such as "order" or "table".
public getListTableIndexesSQL ( $table, $currentDatabase = null )

getListTablesSQL() public method

{@inheritDoc}
public getListTablesSQL ( )

getListViewsSQL() public method

{@inheritDoc}
public getListViewsSQL ( $database )

getLocateExpression() public method

{@inheritDoc}
public getLocateExpression ( $str, $substr, $startPos = false )

getName() public method

{@inheritDoc}
public getName ( )

getPostAlterTableIndexForeignKeySQL() protected method

protected getPostAlterTableIndexForeignKeySQL ( Doctrine\DBAL\Schema\TableDiff $diff )
$diff Doctrine\DBAL\Schema\TableDiff

getPostAlterTableRenameIndexForeignKeySQL() protected method

protected getPostAlterTableRenameIndexForeignKeySQL ( Doctrine\DBAL\Schema\TableDiff $diff ) : array
$diff Doctrine\DBAL\Schema\TableDiff The table diff to gather the SQL for.
return array

getPreAlterTableIndexForeignKeySQL() protected method

{@inheritDoc}
protected getPreAlterTableIndexForeignKeySQL ( Doctrine\DBAL\Schema\TableDiff $diff )
$diff Doctrine\DBAL\Schema\TableDiff

getPreAlterTableRenameIndexForeignKeySQL() protected method

protected getPreAlterTableRenameIndexForeignKeySQL ( Doctrine\DBAL\Schema\TableDiff $diff ) : array
$diff Doctrine\DBAL\Schema\TableDiff The table diff to gather the SQL for.
return array

getReadLockSQL() public method

{@inheritDoc}
public getReadLockSQL ( )

getRegexpExpression() public method

{@inheritDoc}
public getRegexpExpression ( )

getReservedKeywordsClass() protected method

{@inheritDoc}
protected getReservedKeywordsClass ( )

getSetTransactionIsolationSQL() public method

{@inheritDoc}
public getSetTransactionIsolationSQL ( $level )

getSmallIntTypeDeclarationSQL() public method

{@inheritDoc}
public getSmallIntTypeDeclarationSQL ( array $field )
$field array

getTimeTypeDeclarationSQL() public method

{@inheritDoc}
public getTimeTypeDeclarationSQL ( array $fieldDeclaration )
$fieldDeclaration array

getVarcharMaxLength() public method

{@inheritDoc}
public getVarcharMaxLength ( )

getVarcharTypeDeclarationSQLSnippet() protected method

{@inheritDoc}
protected getVarcharTypeDeclarationSQLSnippet ( $length, $fixed )

initializeDoctrineTypeMappings() protected method

{@inheritDoc}

prefersIdentityColumns() public method

MySql prefers "autoincrement" identity columns since sequences can only be emulated with a table.

quoteStringLiteral() public method

public quoteStringLiteral ( $str )

supportsColumnCollation() public method

{@inheritDoc}

supportsIdentityColumns() public method

MySql supports this through AUTO_INCREMENT columns.

supportsInlineColumnComments() public method

{@inheritDoc}