Doctrine


Doctrine\DBAL\Platforms\MySqlPlatform
/Doctrine/DBAL/Platforms/MySqlPlatform.php at line 37

Class MySqlPlatform

Class:MySqlPlatform - Superclass: AbstractPlatform
AbstractPlatform
⌊ MySqlPlatform

public class MySqlPlatform
extends AbstractPlatform

The MySqlPlatform provides the behavior, features and SQL dialect of the MySQL database platform. This platform represents a MySQL 5.0 or greater platform that uses the InnoDB storage engine.

Since:
2.0
Author:
Roman Borschel
Benjamin Eberlei
Todo:
Rename: MySQLPlatform
License:
http://www.opensource.org/licenses/lgpl-license.php LGPL
See Also:
www.doctrine-project.org
Version:
$Revision: 3938 $

Fields inherited from Doctrine\DBAL\Platforms\AbstractPlatform
CREATE_FOREIGNKEYS, CREATE_INDEXES, TRIM_BOTH, TRIM_LEADING, TRIM_TRAILING, TRIM_UNSPECIFIED
Method Summary
bool

createsExplicitIndexForForeignKeys()

string

getAdvancedForeignKeyOptionsSQL(ForeignKeyConstraint foreignKey)

Return the FOREIGN KEY query section dealing with non-standard options as MATCH, INITIALLY DEFERRED, ON UPDATE, ...

boolean

getAlterTableSQL(TableDiff diff, string name, array changes, boolean check)

Gets the SQL to alter an existing table.

string

getBigIntTypeDeclarationSQL(mixed field, array columnDef)

@override

string

getBooleanTypeDeclarationSQL(mixed field, array columnDef)

void

getClobTypeDeclarationSQL(array field)

@override

string

getCollationFieldDeclaration(string collation)

Obtain DBMS specific SQL code portion needed to set the COLLATION of a field declaration to be used in statements like CREATE TABLE.

string

getConcatExpression(string|array(string) strings, string arg1,)

Returns a series of strings concatinatedconcat() accepts an arbitrary number of parameters.

string

getCreateDatabaseSQL(string name, mixed database)

create a new database

void

getCreateViewSQL(mixed name, mixed sql)

string

getDateTimeTypeDeclarationSQL(array fieldDeclaration)

string

getDateTypeDeclarationSQL(array fieldDeclaration)

string

getDropDatabaseSQL(string name, mixed database)

drop an existing database

string

getDropIndexSQL(Index index, string|Table table, Index|string name)

Gets the SQL to drop an index of a table.

string

getDropTableSQL(string table)

Gets the SQL to drop a table.

void

getDropViewSQL(mixed name)

string

getGuidExpression()

Returns global unique identifier

string

getIdentifierQuoteCharacter()

Gets the character used for identifier quoting.

string

getIntegerTypeDeclarationSQL(string field, string name, array columnDef)

Obtain DBMS specific SQL code portion needed to declare an integer type field to be used in statements like CREATE TABLE.

void

getListDatabasesSQL()

void

getListTableColumnsSQL(mixed table)

void

getListTableConstraintsSQL(mixed table)

void

getListTableForeignKeysSQL(mixed table, mixed database)

void

getListTableIndexesSQL(mixed table)

void

getListTablesSQL()

string

getListViewsSQL(string database)

Get the SQL to list all views of a database or user.

integer

getLocateExpression(string str, string substr, mixed startPos, int pos)

returns the position of the first occurrence of substring $substr in string $str

string

getName()

Get the platform name for this instance.

string

getRegexpExpression()

Returns the regular expression operator.

void

getSetTransactionIsolationSQL(integer level)

Get sql to set the transaction isolation level

string

getShowDatabasesSQL()

Get sql query to show a list of database.

string

getSmallIntTypeDeclarationSQL(mixed field, array columnDef)

@override

string

getTimeTypeDeclarationSQL(array fieldDeclaration)

void

getVarcharTypeDeclarationSQL(array field)

Gets the SQL snippet used to declare a VARCHAR column on the MySql platform.

boolean

prefersIdentityColumns()

Whether the platform prefers identity columns for ID generation.

boolean

supportsIdentityColumns()

Whether the platform supports identity columns.

boolean

supportsSavepoints()

Whether the platform supports savepoints.

Methods inherited from Doctrine\DBAL\Platforms\AbstractPlatform
convertBooleans, createsExplicitIndexForForeignKeys, fixSchemaElementName, getAcosExpression, getAdvancedForeignKeyOptionsSQL, getAlterTableSQL, getAvgExpression, getBetweenExpression, getBigIntTypeDeclarationSQL, getBooleanTypeDeclarationSQL, getCheckDeclarationSQL, getClobTypeDeclarationSQL, getColumnCharsetDeclarationSQL, getColumnCollationDeclarationSQL, getColumnDeclarationListSQL, getColumnDeclarationSQL, getConcatExpression, getCosExpression, getCountExpression, getCreateConstraintSQL, getCreateDatabaseSQL, getCreateForeignKeySQL, getCreateIndexSQL, getCreateSequenceSQL, getCreateTableSQL, getCreateTemporaryTableSnippetSQL, getCreateViewSQL, getCurrentDateSQL, getCurrentTimeSQL, getCurrentTimestampSQL, getCustomTypeDeclarationSQL, getDateFormatString, getDateTimeFormatString, getDateTimeTypeDeclarationSQL, getDateTypeDeclarationSQL, getDecimalTypeDeclarationSQL, getDefaultTransactionIsolationLevel, getDefaultValueDeclarationSQL, getDropConstraintSQL, getDropDatabaseSQL, getDropForeignKeySQL, getDropIndexSQL, getDropSequenceSQL, getDropTableSQL, getDropViewSQL, getEmptyIdentityInsertSQL, getForUpdateSql, getForeignKeyBaseDeclarationSQL, getForeignKeyDeclarationSQL, getForeignKeyReferentialActionSQL, getIdentifierQuoteCharacter, getIdentityColumnNullInsertSQL, getInExpression, getIndexDeclarationSQL, getIndexFieldDeclarationListSQL, getIntegerTypeDeclarationSQL, getIsNotNullExpression, getIsNullExpression, getLengthExpression, getListDatabasesSQL, getListSequencesSQL, getListTableColumnsSQL, getListTableConstraintsSQL, getListTableForeignKeysSQL, getListTableIndexesSQL, getListTablesSQL, getListUsersSQL, getListViewsSQL, getLocateExpression, getLowerExpression, getLtrimExpression, getMaxExpression, getMaxIdentifierLength, getMd5Expression, getMinExpression, getModExpression, getName, getNotExpression, getNowExpression, getPiExpression, getRegexpExpression, getRoundExpression, getRtrimExpression, getSQLResultCasing, getSequenceNextValSQL, getSetCharsetSQL, getSetTransactionIsolationSQL, getShowDatabasesSQL, getSinExpression, getSmallIntTypeDeclarationSQL, getSqlCommentEndString, getSqlCommentStartString, getSubstringExpression, getSumExpression, getTemporaryTableSQL, getTimeFormatString, getTimeTypeDeclarationSQL, getTrimExpression, getTruncateTableSQL, getUniqueConstraintDeclarationSQL, getUniqueFieldDeclarationSQL, getUpperExpression, getVarcharMaxLength, getVarcharTypeDeclarationSQL, getWildcards, modifyLimitQuery, prefersIdentityColumns, prefersSequences, quoteIdentifier, supportsAlterTable, supportsForeignKeyConstraints, supportsForeignKeyOnUpdate, supportsGettingAffectedRows, supportsIdentityColumns, supportsIndexes, supportsPrimaryConstraints, supportsSavepoints, supportsSchemas, supportsSequences, supportsTransactions

Method Detail

/Doctrine/DBAL/Platforms/MySqlPlatform.php at line 665

createsExplicitIndexForForeignKeys

public bool createsExplicitIndexForForeignKeys()


/Doctrine/DBAL/Platforms/MySqlPlatform.php at line 599

getAdvancedForeignKeyOptionsSQL

public string getAdvancedForeignKeyOptionsSQL(ForeignKeyConstraint foreignKey)

Return the FOREIGN KEY query section dealing with non-standard options as MATCH, INITIALLY DEFERRED, ON UPDATE, ...

Override.

/Doctrine/DBAL/Platforms/MySqlPlatform.php at line 501

getAlterTableSQL

public boolean getAlterTableSQL(TableDiff diff, string name, array changes, boolean check)

Gets the SQL to alter an existing table.

Parameters:
name - The name of the table that is intended to be changed.
changes - Associative array that contains the details of each type of change that is intended to be performed. The types of changes that are currently supported are defined as follows: name New name for the table. add Associative array with the names of fields to be added as indexes of the array. The value of each entry of the array should be set to another associative array with the properties of the fields to be added. The properties of the fields should be the same as defined by the Metabase parser. remove Associative array with the names of fields to be removed as indexes of the array. Currently the values assigned to each entry are ignored. An empty array should be used for future compatibility. rename Associative array with the names of fields to be renamed as indexes of the array. The value of each entry of the array should be set to another associative array with the entry named name with the new field name and the entry named Declaration that is expected to contain the portion of the field declaration already in DBMS specific SQL code as it is used in the CREATE TABLE statement. change Associative array with the names of the fields to be changed as indexes of the array. Keep in mind that if it is intended to change either the name of a field and any other properties, the change array entries should have the new names of the fields as array indexes. The value of each entry of the array should be set to another associative array with the properties of the fields to that are meant to be changed as array entries. These entries should be assigned to the new values of the respective properties. The properties of the fields should be the same as defined by the Metabase parser. Example array( 'name' => 'userlist', 'add' => array( 'quota' => array( 'type' => 'integer', 'unsigned' => 1 ) ), 'remove' => array( 'file_limit' => array(), 'time_limit' => array() ), 'change' => array( 'name' => array( 'length' => '20', 'definition' => array( 'type' => 'text', 'length' => 20, ), ) ), 'rename' => array( 'sex' => array( 'name' => 'gender', 'definition' => array( 'type' => 'text', 'length' => 1, 'default' => 'M', ), ) ) )
check - indicates whether the function should just check if the DBMS driver can perform the requested table alterations if the value is true or actually perform them otherwise.
Override.

/Doctrine/DBAL/Platforms/MySqlPlatform.php at line 568

getBigIntTypeDeclarationSQL

public string getBigIntTypeDeclarationSQL(mixed field, array columnDef)


/Doctrine/DBAL/Platforms/MySqlPlatform.php at line 221

getBooleanTypeDeclarationSQL

public string getBooleanTypeDeclarationSQL(mixed field, array columnDef)

Override.

/Doctrine/DBAL/Platforms/MySqlPlatform.php at line 175

getClobTypeDeclarationSQL

public void getClobTypeDeclarationSQL(array field)


/Doctrine/DBAL/Platforms/MySqlPlatform.php at line 234

getCollationFieldDeclaration

public string getCollationFieldDeclaration(string collation)

Obtain DBMS specific SQL code portion needed to set the COLLATION of a field declaration to be used in statements like CREATE TABLE.

Parameters:
collation - name of the collation
Returns:
DBMS specific SQL code portion needed to set the COLLATION of a field declaration.

/Doctrine/DBAL/Platforms/MySqlPlatform.php at line 98

getConcatExpression

public string getConcatExpression(string|array(string) strings, string arg1,)

Returns a series of strings concatinated

concat() accepts an arbitrary number of parameters. Each parameter must contain an expression or an array with expressions.

Parameters:
strings - that will be concatinated.
Override.

/Doctrine/DBAL/Platforms/MySqlPlatform.php at line 297

getCreateDatabaseSQL

public string getCreateDatabaseSQL(string name, mixed database)

create a new database

Parameters:
name - name of the database that should be created
Override.

/Doctrine/DBAL/Platforms/MySqlPlatform.php at line 142

getCreateViewSQL

public void getCreateViewSQL(mixed name, mixed sql)

/Doctrine/DBAL/Platforms/MySqlPlatform.php at line 193

getDateTimeTypeDeclarationSQL

public string getDateTimeTypeDeclarationSQL(array fieldDeclaration)

Override.

/Doctrine/DBAL/Platforms/MySqlPlatform.php at line 205

getDateTypeDeclarationSQL

public string getDateTypeDeclarationSQL(array fieldDeclaration)

Override.

/Doctrine/DBAL/Platforms/MySqlPlatform.php at line 309

getDropDatabaseSQL

public string getDropDatabaseSQL(string name, mixed database)

drop an existing database

Parameters:
name - name of the database that should be dropped
Override.

/Doctrine/DBAL/Platforms/MySqlPlatform.php at line 616

getDropIndexSQL

public string getDropIndexSQL(Index index, string|Table table, Index|string name)

Gets the SQL to drop an index of a table.

Parameters:
index - name of the index to be dropped
table - name of table that should be used in method
Override.

/Doctrine/DBAL/Platforms/MySqlPlatform.php at line 639

getDropTableSQL

public string getDropTableSQL(string table)

Gets the SQL to drop a table.

Parameters:
table - The name of table to drop.
Override.

/Doctrine/DBAL/Platforms/MySqlPlatform.php at line 147

getDropViewSQL

public void getDropViewSQL(mixed name)

/Doctrine/DBAL/Platforms/MySqlPlatform.php at line 67

getGuidExpression

public string getGuidExpression()

Returns global unique identifier

Returns:
to get global unique identifier
Override.

/Doctrine/DBAL/Platforms/MySqlPlatform.php at line 45

getIdentifierQuoteCharacter

public string getIdentifierQuoteCharacter()

Gets the character used for identifier quoting.

Override.

/Doctrine/DBAL/Platforms/MySqlPlatform.php at line 562

getIntegerTypeDeclarationSQL

public string getIntegerTypeDeclarationSQL(string field, string name, array columnDef)

Obtain DBMS specific SQL code portion needed to declare an integer type field to be used in statements like CREATE TABLE.

Parameters:
name - name the field to be declared.
field - associative array with the name of the properties of the field being declared as array indexes. Currently, the types of supported field properties are as follows: unsigned Boolean flag that indicates whether the field should be declared as unsigned integer if possible. default Integer value to be used as default for this field. notnull Boolean flag that indicates whether this field is constrained to not be set to null.
Returns:
DBMS specific SQL code portion that should be used to declare the specified field.
Override.

/Doctrine/DBAL/Platforms/MySqlPlatform.php at line 104

getListDatabasesSQL

public void getListDatabasesSQL()

/Doctrine/DBAL/Platforms/MySqlPlatform.php at line 285

getListTableColumnsSQL

public void getListTableColumnsSQL(mixed table)

/Doctrine/DBAL/Platforms/MySqlPlatform.php at line 109

getListTableConstraintsSQL

public void getListTableConstraintsSQL(mixed table)

/Doctrine/DBAL/Platforms/MySqlPlatform.php at line 124

getListTableForeignKeysSQL

public void getListTableForeignKeysSQL(mixed table, mixed database)

/Doctrine/DBAL/Platforms/MySqlPlatform.php at line 114

getListTableIndexesSQL

public void getListTableIndexesSQL(mixed table)

/Doctrine/DBAL/Platforms/MySqlPlatform.php at line 280

getListTablesSQL

public void getListTablesSQL()

/Doctrine/DBAL/Platforms/MySqlPlatform.php at line 119

getListViewsSQL

public string getListViewsSQL(string database)

Get the SQL to list all views of a database or user.


/Doctrine/DBAL/Platforms/MySqlPlatform.php at line 80

getLocateExpression

public integer getLocateExpression(string str, string substr, mixed startPos, int pos)

returns the position of the first occurrence of substring $substr in string $str

Parameters:
substr - literal string to find
str - literal string
pos - position to start at, beginning of string by default

/Doctrine/DBAL/Platforms/MySqlPlatform.php at line 660

getName

public string getName()

Get the platform name for this instance.


/Doctrine/DBAL/Platforms/MySqlPlatform.php at line 56

getRegexpExpression

public string getRegexpExpression()

Returns the regular expression operator.

Override.

/Doctrine/DBAL/Platforms/MySqlPlatform.php at line 650

getSetTransactionIsolationSQL

public void getSetTransactionIsolationSQL(integer level)

Get sql to set the transaction isolation level


/Doctrine/DBAL/Platforms/MySqlPlatform.php at line 275

getShowDatabasesSQL

public string getShowDatabasesSQL()

Get sql query to show a list of database.


/Doctrine/DBAL/Platforms/MySqlPlatform.php at line 574

getSmallIntTypeDeclarationSQL

public string getSmallIntTypeDeclarationSQL(mixed field, array columnDef)


/Doctrine/DBAL/Platforms/MySqlPlatform.php at line 213

getTimeTypeDeclarationSQL

public string getTimeTypeDeclarationSQL(array fieldDeclaration)

Override.

/Doctrine/DBAL/Platforms/MySqlPlatform.php at line 157

getVarcharTypeDeclarationSQL

public void getVarcharTypeDeclarationSQL(array field)

Gets the SQL snippet used to declare a VARCHAR column on the MySql platform.

Params:
array $field

/Doctrine/DBAL/Platforms/MySqlPlatform.php at line 247

prefersIdentityColumns

public boolean prefersIdentityColumns()

Whether the platform prefers identity columns for ID generation. MySql prefers "autoincrement" identity columns since sequences can only be emulated with a table.

Override.

/Doctrine/DBAL/Platforms/MySqlPlatform.php at line 259

supportsIdentityColumns

public boolean supportsIdentityColumns()

Whether the platform supports identity columns. MySql supports this through AUTO_INCREMENT columns.

Override.

/Doctrine/DBAL/Platforms/MySqlPlatform.php at line 270

supportsSavepoints

public boolean supportsSavepoints()

Whether the platform supports savepoints. MySql does not.

Override.

Doctrine