Documentation

AbstractPlatform
in package

Base class for all DatabasePlatforms. The DatabasePlatforms are the central point of abstraction of platform-specific behaviors, features and SQL dialects.

They are a passive source of information.

Tags
link
www.doctrine-project.org
since
2.0
author

Guilherme Blanco guilhermeblanco@hotmail.com

author

Jonathan Wage jonwage@gmail.com

author

Roman Borschel roman@code-factory.org

author

Lukas Smith smith@pooteeweet.org (PEAR MDB2 library)

author

Benjamin Eberlei kontakt@beberlei.de

todo

Remove any unnecessary methods.

Table of Contents

CREATE_FOREIGNKEYS  = 2
CREATE_INDEXES  = 1
DATE_INTERVAL_UNIT_DAY  = 'DAY'
DATE_INTERVAL_UNIT_HOUR  = 'HOUR'
DATE_INTERVAL_UNIT_MINUTE  = 'MINUTE'
DATE_INTERVAL_UNIT_MONTH  = 'MONTH'
DATE_INTERVAL_UNIT_QUARTER  = 'QUARTER'
DATE_INTERVAL_UNIT_SECOND  = 'SECOND'
DATE_INTERVAL_UNIT_WEEK  = 'WEEK'
DATE_INTERVAL_UNIT_YEAR  = 'YEAR'
TRIM_BOTH  = 3
TRIM_LEADING  = 1
TRIM_TRAILING  = 2
TRIM_UNSPECIFIED  = 0
$_eventManager  : EventManager
$_keywords  : KeywordList
Holds the KeywordList instance for the current platform.
$doctrineTypeComments  : array<string|int, mixed>|null
Contains a list of all columns that should generate parseable column comments for type-detection in reverse engineering scenarios.
$doctrineTypeMapping  : array<string|int, mixed>|null
__construct()  : mixed
Constructor.
appendLockHint()  : string
Honors that some SQL vendors such as MsSql use table hints for locking instead of the ANSI SQL FOR UPDATE specification.
canEmulateSchemas()  : bool
Whether this platform can emulate schemas.
convertBooleans()  : mixed
Some platforms need the boolean values to be converted.
convertBooleansToDatabaseValue()  : mixed
This method should handle the prepared statements case. When there is no distinction, it's OK to use the same method.
convertFromBoolean()  : bool|null
Some platforms have boolean literals that needs to be correctly converted
createSavePoint()  : string
Returns the SQL to create a new savepoint.
fixSchemaElementName()  : string
Makes any fixes to a name of a schema element (table, sequence, ...) that are required by restrictions of the platform, like a maximum length.
getAcosExpression()  : string
Returns the SQL to get the arccosine of a value.
getAdvancedForeignKeyOptionsSQL()  : string
Returns the FOREIGN KEY query section dealing with non-standard options as MATCH, INITIALLY DEFERRED, ON UPDATE, .
getAlterSequenceSQL()  : string
Returns the SQL to change a sequence on this platform.
getAlterTableSQL()  : array<string|int, mixed>
Gets the SQL statements for altering an existing table.
getAvgExpression()  : string
Returns the SQL snippet to get the average value of a column.
getBetweenExpression()  : string
Returns the SQL that checks if an expression evaluates to a value between two values.
getBigIntTypeDeclarationSQL()  : string
Returns the SQL snippet that declares an 8 byte integer column.
getBinaryDefaultLength()  : int
Gets the default length of a binary field.
getBinaryMaxLength()  : int
Gets the maximum length of a binary field.
getBinaryTypeDeclarationSQL()  : string
Returns the SQL snippet used to declare a BINARY/VARBINARY column type.
getBitAndComparisonExpression()  : string
Returns the SQL bit AND comparison expression.
getBitOrComparisonExpression()  : string
Returns the SQL bit OR comparison expression.
getBlobTypeDeclarationSQL()  : string
Returns the SQL Snippet used to declare a BLOB column type.
getBooleanTypeDeclarationSQL()  : string
Returns the SQL snippet that declares a boolean column.
getCheckDeclarationSQL()  : string
Obtains DBMS specific SQL code portion needed to set a CHECK constraint declaration to be used in statements like CREATE TABLE.
getClobTypeDeclarationSQL()  : string
Returns the SQL snippet used to declare a CLOB column type.
getColumnCharsetDeclarationSQL()  : string
Obtains DBMS specific SQL code portion needed to set the CHARACTER SET of a field declaration to be used in statements like CREATE TABLE.
getColumnCollationDeclarationSQL()  : string
Obtains DBMS specific SQL code portion needed to set the COLLATION of a field declaration to be used in statements like CREATE TABLE.
getColumnDeclarationListSQL()  : string
Gets declaration of a number of fields in bulk.
getColumnDeclarationSQL()  : string
Obtains DBMS specific SQL code portion needed to declare a generic type field to be used in statements like CREATE TABLE.
getCommentOnColumnSQL()  : string
getConcatExpression()  : string
Returns a SQL snippet to concatenate the given expressions.
getCosExpression()  : string
Returns the SQL to get the cosine of a value.
getCountExpression()  : string
Returns the SQL snippet to get the number of rows (without a NULL value) of a column.
getCreateConstraintSQL()  : string
Returns the SQL to create a constraint on a table on this platform.
getCreateDatabaseSQL()  : string
Returns the SQL to create a new database.
getCreateForeignKeySQL()  : string
Returns the SQL to create a new foreign key.
getCreateIndexSQL()  : string
Returns the SQL to create an index on a table on this platform.
getCreatePrimaryKeySQL()  : string
Returns the SQL to create an unnamed primary key constraint.
getCreateSchemaSQL()  : string
Returns the SQL to create a named schema.
getCreateSequenceSQL()  : string
Returns the SQL to create a sequence on this platform.
getCreateTableSQL()  : array<string|int, mixed>
Returns the SQL statement(s) to create a table with the specified name, columns and constraints on this platform.
getCreateTemporaryTableSnippetSQL()  : string
getCreateViewSQL()  : string
getCurrentDateSQL()  : string
Returns the SQL specific for the platform to get the current date.
getCurrentTimeSQL()  : string
Returns the SQL specific for the platform to get the current time.
getCurrentTimestampSQL()  : string
Returns the SQL specific for the platform to get the current timestamp
getCustomTypeDeclarationSQL()  : string
Obtains SQL code portion needed to create a custom column, e.g. when a field has the "columnDefinition" keyword.
getDateAddDaysExpression()  : string
Returns the SQL to add the number of given days to a date.
getDateAddHourExpression()  : string
Returns the SQL to add the number of given hours to a date.
getDateAddMinutesExpression()  : string
Returns the SQL to add the number of given minutes to a date.
getDateAddMonthExpression()  : string
Returns the SQL to add the number of given months to a date.
getDateAddQuartersExpression()  : string
Returns the SQL to add the number of given quarters to a date.
getDateAddSecondsExpression()  : string
Returns the SQL to add the number of given seconds to a date.
getDateAddWeeksExpression()  : string
Returns the SQL to add the number of given weeks to a date.
getDateAddYearsExpression()  : string
Returns the SQL to add the number of given years to a date.
getDateDiffExpression()  : string
Returns the SQL to calculate the difference in days between the two passed dates.
getDateFormatString()  : string
Gets the format string, as accepted by the date() function, that describes the format of a stored date value of this platform.
getDateSubDaysExpression()  : string
Returns the SQL to subtract the number of given days to a date.
getDateSubHourExpression()  : string
Returns the SQL to subtract the number of given hours to a date.
getDateSubMinutesExpression()  : string
Returns the SQL to subtract the number of given minutes from a date.
getDateSubMonthExpression()  : string
Returns the SQL to subtract the number of given months to a date.
getDateSubQuartersExpression()  : string
Returns the SQL to subtract the number of given quarters from a date.
getDateSubSecondsExpression()  : string
Returns the SQL to subtract the number of given seconds from a date.
getDateSubWeeksExpression()  : string
Returns the SQL to subtract the number of given weeks from a date.
getDateSubYearsExpression()  : string
Returns the SQL to subtract the number of given years from a date.
getDateTimeFormatString()  : string
Gets the format string, as accepted by the date() function, that describes the format of a stored datetime value of this platform.
getDateTimeTypeDeclarationSQL()  : string
Obtains DBMS specific SQL to be used to create datetime fields in statements like CREATE TABLE.
getDateTimeTzFormatString()  : string
Gets the format string, as accepted by the date() function, that describes the format of a stored datetime with timezone value of this platform.
getDateTimeTzTypeDeclarationSQL()  : string
Obtains DBMS specific SQL to be used to create datetime with timezone offset fields.
getDateTypeDeclarationSQL()  : string
Obtains DBMS specific SQL to be used to create date fields in statements like CREATE TABLE.
getDecimalTypeDeclarationSQL()  : string
Returns the SQL snippet that declares a floating point column of arbitrary precision.
getDefaultSchemaName()  : string
Returns the default schema name.
getDefaultTransactionIsolationLevel()  : int
Gets the default transaction isolation level of the platform.
getDefaultValueDeclarationSQL()  : string
Obtains DBMS specific SQL code portion needed to set a default value declaration to be used in statements like CREATE TABLE.
getDoctrineTypeComment()  : string
Gets the comment to append to a column comment that helps parsing this type in reverse engineering.
getDoctrineTypeMapping()  : string
Gets the Doctrine type that is mapped for the given database column type.
getDropConstraintSQL()  : string
Returns the SQL to drop a constraint.
getDropDatabaseSQL()  : string
Returns the SQL snippet to drop an existing database.
getDropForeignKeySQL()  : string
Returns the SQL to drop a foreign key.
getDropIndexSQL()  : string
Returns the SQL to drop an index from a table.
getDropSequenceSQL()  : string
Returns the SQL snippet to drop an existing sequence.
getDropTableSQL()  : string
Returns the SQL snippet to drop an existing table.
getDropTemporaryTableSQL()  : string
Returns the SQL to safely drop a temporary table WITHOUT implicitly committing an open transaction.
getDropViewSQL()  : string
getDummySelectSQL()  : string
This is for test reasons, many vendors have special requirements for dummy statements.
getEmptyIdentityInsertSQL()  : string
Returns the insert SQL for an empty insert statement.
getEventManager()  : EventManager
Gets the EventManager used by the Platform.
getFloatDeclarationSQL()  : string
getForeignKeyBaseDeclarationSQL()  : string
Obtains DBMS specific SQL code portion needed to set the FOREIGN KEY constraint of a field declaration to be used in statements like CREATE TABLE.
getForeignKeyDeclarationSQL()  : string
Obtain DBMS specific SQL code portion needed to set the FOREIGN KEY constraint of a field declaration to be used in statements like CREATE TABLE.
getForeignKeyReferentialActionSQL()  : string
Returns the given referential action in uppercase if valid, otherwise throws an exception.
getForUpdateSQL()  : string
Returns the FOR UPDATE expression.
getGuidExpression()  : string
Returns the global unique identifier expression.
getGuidTypeDeclarationSQL()  : string
Returns the SQL snippet to declare a GUID/UUID field.
getIdentifierQuoteCharacter()  : string
Gets the character used for identifier quoting.
getIdentityColumnNullInsertSQL()  : mixed
getIdentitySequenceName()  : string
Returns the name of the sequence for a particular identity column in a particular table.
getIndexDeclarationSQL()  : string
Obtains DBMS specific SQL code portion needed to set an index declaration to be used in statements like CREATE TABLE.
getIndexFieldDeclarationListSQL()  : string
Obtains DBMS specific SQL code portion needed to set an index declaration to be used in statements like CREATE TABLE.
getIntegerTypeDeclarationSQL()  : string
Returns the SQL snippet that declares a 4 byte integer column.
getIsNotNullExpression()  : string
Returns the SQL that checks if an expression is not null.
getIsNullExpression()  : string
Returns the SQL that checks if an expression is null.
getJsonTypeDeclarationSQL()  : string
Returns the SQL snippet to declare a JSON field.
getLengthExpression()  : string
Returns the SQL snippet to get the length of a text field.
getListDatabasesSQL()  : string
getListNamespacesSQL()  : string
Returns the SQL statement for retrieving the namespaces defined in the database.
getListSequencesSQL()  : string
getListTableColumnsSQL()  : string
getListTableConstraintsSQL()  : string
getListTableForeignKeysSQL()  : string
getListTableIndexesSQL()  : string
Returns the list of indexes for the current database.
getListTablesSQL()  : string
getListUsersSQL()  : string
getListViewsSQL()  : string
Returns the SQL to list all views of a database or user.
getLocateExpression()  : string
Returns the SQL snippet to get the position of the first occurrence of substring $substr in string $str.
getLowerExpression()  : string
Returns the SQL snippet to change all characters from the expression to lowercase, according to the current character set mapping.
getLtrimExpression()  : string
Returns the SQL snippet to trim leading space characters from the expression.
getMaxExpression()  : string
Returns the SQL snippet to get the highest value of a column.
getMaxIdentifierLength()  : int
Maximum length of any given database identifier, like tables or column names.
getMd5Expression()  : string
Returns the SQL snippet to get the md5 sum of a field.
getMinExpression()  : string
Returns the SQL snippet to get the lowest value of a column.
getModExpression()  : string
Returns the SQL snippet to get the remainder of the division operation $expression1 / $expression2.
getName()  : string
Gets the name of the platform.
getNotExpression()  : string
Returns the SQL for a logical not.
getNowExpression()  : string
Returns the SQL snippet to get the current system date.
getPiExpression()  : string
Returns the SQL to get the PI value.
getReadLockSQL()  : string
Returns the SQL snippet to append to any SELECT statement which locks rows in shared read lock.
getRegexpExpression()  : string
Returns the regular expression operator.
getReservedKeywordsList()  : KeywordList
Returns the keyword list instance of this platform.
getRoundExpression()  : string
Returns the SQL snippet to round a numeric field to the number of decimals specified.
getRtrimExpression()  : string
Returns the SQL snippet to trim trailing space characters from the expression.
getSequenceNextValSQL()  : string
getSetTransactionIsolationSQL()  : string
Returns the SQL to set the transaction isolation level.
getSinExpression()  : string
Returns the SQL to get the sine of a value.
getSmallIntTypeDeclarationSQL()  : string
Returns the SQL snippet that declares a 2 byte integer column.
getSqlCommentEndString()  : string
Gets the string portion that ends an SQL comment.
getSqlCommentStartString()  : string
Gets the string portion that starts an SQL comment.
getSQLResultCasing()  : string
Gets the character casing of a column in an SQL result set of this platform.
getSqrtExpression()  : string
Returns the SQL snippet to get the squared value of a column.
getStringLiteralQuoteCharacter()  : string
Gets the character used for string literal quoting.
getSubstringExpression()  : string
Returns a SQL snippet to get a substring inside an SQL statement.
getSumExpression()  : string
Returns the SQL snippet to get the total sum of a column.
getTemporaryTableName()  : string
Some vendors require temporary table names to be qualified specially.
getTemporaryTableSQL()  : string
Returns the required SQL string that fits between CREATE ... TABLE to create the table as a temporary table.
getTimeFormatString()  : string
Gets the format string, as accepted by the date() function, that describes the format of a stored time value of this platform.
getTimeTypeDeclarationSQL()  : string
Obtains DBMS specific SQL to be used to create time fields in statements like CREATE TABLE.
getTrimExpression()  : string
Returns the SQL snippet to trim a string.
getTruncateTableSQL()  : string
Generates a Truncate Table SQL statement for a given table.
getUniqueConstraintDeclarationSQL()  : string
Obtains DBMS specific SQL code portion needed to set a unique constraint declaration to be used in statements like CREATE TABLE.
getUniqueFieldDeclarationSQL()  : string
Obtains DBMS specific SQL code portion needed to set the UNIQUE constraint of a field declaration to be used in statements like CREATE TABLE.
getUpperExpression()  : string
Returns the SQL snippet to change all characters from the expression to uppercase, according to the current character set mapping.
getVarcharDefaultLength()  : int
Gets the default length of a varchar field.
getVarcharMaxLength()  : int
Gets the maximum length of a varchar field.
getVarcharTypeDeclarationSQL()  : string
Returns the SQL snippet used to declare a VARCHAR column type.
getWildcards()  : array<string|int, mixed>
Gets all SQL wildcard characters of the platform.
getWriteLockSQL()  : string
Returns the SQL snippet to append to any SELECT statement which obtains an exclusive lock on the rows.
hasDoctrineTypeMappingFor()  : bool
Checks if a database type is currently supported by this platform.
hasNativeGuidType()  : bool
Does this platform have native guid type.
hasNativeJsonType()  : bool
Does this platform have native JSON type.
isCommentedDoctrineType()  : bool
Is it necessary for the platform to add a parsable type comment to allow reverse engineering the given type?
markDoctrineTypeCommented()  : void
Marks this type as to be commented in ALTER TABLE and CREATE TABLE statements.
modifyLimitQuery()  : string
Adds an driver-specific LIMIT clause to the query.
prefersIdentityColumns()  : bool
Whether the platform prefers identity columns (eg. autoincrement) for ID generation.
prefersSequences()  : bool
Whether the platform prefers sequences for ID generation.
quoteIdentifier()  : string
Quotes a string so that it can be safely used as a table or column name, even if it is a reserved word of the platform. This also detects identifier chains separated by dot and quotes them independently.
quoteSingleIdentifier()  : string
Quotes a single identifier (no dot chain separation).
quoteStringLiteral()  : string
Quotes a literal string.
registerDoctrineTypeMapping()  : mixed
Registers a doctrine type to be used in conjunction with a column type of this platform.
releaseSavePoint()  : string
Returns the SQL to release a savepoint.
rollbackSavePoint()  : string
Returns the SQL to rollback a savepoint.
setEventManager()  : mixed
Sets the EventManager used by the Platform.
supportsAlterTable()  : bool
Whether the platform supports altering tables.
supportsColumnCollation()  : bool
Does this platform support column collation?
supportsCommentOnStatement()  : bool
Whether this platform support the proprietary syntax "COMMENT ON asset".
supportsCreateDropDatabase()  : bool
Whether this platform supports create database.
supportsForeignKeyConstraints()  : bool
Whether the platform supports foreign key constraints.
supportsForeignKeyOnUpdate()  : bool
Whether this platform supports onUpdate in foreign key constraints.
supportsGettingAffectedRows()  : bool
Whether the platform supports getting the affected rows of a recent update/delete type query.
supportsIdentityColumns()  : bool
Whether the platform supports identity columns.
supportsIndexes()  : bool
Whether the platform supports indexes.
supportsInlineColumnComments()  : bool
Whether this platform support to add inline column comments as postfix.
supportsLimitOffset()  : bool
Whether the database platform support offsets in modify limit clauses.
supportsPartialIndexes()  : bool
Whether the platform supports partial indexes.
supportsPrimaryConstraints()  : bool
Whether the platform supports primary key constraints.
supportsReleaseSavepoints()  : bool
Whether the platform supports releasing savepoints.
supportsSavepoints()  : bool
Whether the platform supports savepoints.
supportsSchemas()  : bool
Whether the platform supports database schemas.
supportsSequences()  : bool
Whether the platform supports sequences.
supportsTransactions()  : bool
Whether the platform supports transactions.
supportsViews()  : bool
Whether this platform supports views.
usesSequenceEmulatedIdentityColumns()  : bool
Whether the platform emulates identity columns through sequences.
_getAlterTableIndexForeignKeySQL()  : array<string|int, mixed>
Common code for alter table statement generation that updates the changed Index and Foreign Key definitions.
_getCommonIntegerTypeDeclarationSQL()  : string
Returns the SQL snippet that declares common properties of an integer column.
_getCreateTableSQL()  : array<string|int, mixed>
Returns the SQL used to create a table.
_getTransactionIsolationLevelSQL()  : string
Returns the SQL for a given transaction isolation level Connection constant.
doModifyLimitQuery()  : string
Adds an driver-specific LIMIT clause to the query.
getBinaryTypeDeclarationSQLSnippet()  : string
Returns the SQL snippet used to declare a BINARY/VARBINARY column type.
getColumnComment()  : string
Gets the comment of a passed column modified by potential doctrine type comment hints.
getCreateIndexSQLFlags()  : string
Adds additional flags for index generation.
getDateArithmeticIntervalExpression()  : string
Returns the SQL for a date arithmetic expression.
getPartialIndexSQL()  : string
Adds condition for partial index.
getPostAlterTableIndexForeignKeySQL()  : array<string|int, mixed>
getPreAlterTableIndexForeignKeySQL()  : array<string|int, mixed>
getRenameIndexSQL()  : array<string|int, mixed>
Returns the SQL for renaming an index on a table.
getReservedKeywordsClass()  : string
Returns the class name of the reserved keywords list.
getVarcharTypeDeclarationSQLSnippet()  : string
initializeCommentedDoctrineTypes()  : void
Initializes the Doctrine Type comments instance variable for in_array() checks.
initializeDoctrineTypeMappings()  : void
Lazy load Doctrine Type Mappings.
onSchemaAlterTable()  : bool
onSchemaAlterTableAddColumn()  : bool
onSchemaAlterTableChangeColumn()  : bool
onSchemaAlterTableRemoveColumn()  : bool
onSchemaAlterTableRenameColumn()  : bool
initializeAllDoctrineTypeMappings()  : void
Initializes Doctrine Type Mappings with the platform defaults and with all additional type mappings.

Constants

DATE_INTERVAL_UNIT_MINUTE

public string DATE_INTERVAL_UNIT_MINUTE = 'MINUTE'

DATE_INTERVAL_UNIT_MONTH

public string DATE_INTERVAL_UNIT_MONTH = 'MONTH'

DATE_INTERVAL_UNIT_QUARTER

public string DATE_INTERVAL_UNIT_QUARTER = 'QUARTER'

DATE_INTERVAL_UNIT_SECOND

public string DATE_INTERVAL_UNIT_SECOND = 'SECOND'

Properties

$doctrineTypeComments

Contains a list of all columns that should generate parseable column comments for type-detection in reverse engineering scenarios.

protected array<string|int, mixed>|null $doctrineTypeComments = null

$doctrineTypeMapping

protected array<string|int, mixed>|null $doctrineTypeMapping = null

Methods

__construct()

Constructor.

public __construct() : mixed
Return values
mixed

appendLockHint()

Honors that some SQL vendors such as MsSql use table hints for locking instead of the ANSI SQL FOR UPDATE specification.

public appendLockHint(string $fromClause, int|null $lockMode) : string
Parameters
$fromClause : string

The FROM clause to append the hint for the given lock mode to.

$lockMode : int|null

One of the Doctrine\DBAL\LockMode::* constants. If null is given, nothing will be appended to the FROM clause.

Return values
string

canEmulateSchemas()

Whether this platform can emulate schemas.

public canEmulateSchemas() : bool

Platforms that either support or emulate schemas don't automatically filter a schema for the namespaced elements in .

Return values
bool

convertBooleans()

Some platforms need the boolean values to be converted.

public convertBooleans(mixed $item) : mixed

The default conversion in this implementation converts to integers (false => 0, true => 1).

Note: if the input is not a boolean the original input might be returned.

There are two contexts when converting booleans: Literals and Prepared Statements. This method should handle the literal case

Parameters
$item : mixed

A boolean or an array of them.

Return values
mixed

A boolean database value or an array of them.

convertBooleansToDatabaseValue()

This method should handle the prepared statements case. When there is no distinction, it's OK to use the same method.

public convertBooleansToDatabaseValue(mixed $item) : mixed

Note: if the input is not a boolean the original input might be returned.

Parameters
$item : mixed

A boolean or an array of them.

Return values
mixed

A boolean database value or an array of them.

convertFromBoolean()

Some platforms have boolean literals that needs to be correctly converted

public convertFromBoolean(mixed $item) : bool|null

The default conversion tries to convert value into bool "(bool)$item"

Parameters
$item : mixed
Return values
bool|null

createSavePoint()

Returns the SQL to create a new savepoint.

public createSavePoint(string $savepoint) : string
Parameters
$savepoint : string
Return values
string

fixSchemaElementName()

Makes any fixes to a name of a schema element (table, sequence, ...) that are required by restrictions of the platform, like a maximum length.

public fixSchemaElementName(string $schemaElementName) : string
Parameters
$schemaElementName : string
Return values
string

getAcosExpression()

Returns the SQL to get the arccosine of a value.

public getAcosExpression(string $value) : string
Parameters
$value : string
Return values
string

getAdvancedForeignKeyOptionsSQL()

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

public getAdvancedForeignKeyOptionsSQL(ForeignKeyConstraint $foreignKey) : string

..

Parameters
$foreignKey : ForeignKeyConstraint

The foreign key definition.

Return values
string

getAlterSequenceSQL()

Returns the SQL to change a sequence on this platform.

public getAlterSequenceSQL(Sequence $sequence) : string
Parameters
$sequence : Sequence
Tags
throws
DBALException

If not supported on this platform.

Return values
string

getAlterTableSQL()

Gets the SQL statements for altering an existing table.

public getAlterTableSQL(TableDiff $diff) : array<string|int, mixed>

This method returns an array of SQL statements, since some platforms need several statements.

Parameters
$diff : TableDiff
Tags
throws
DBALException

If not supported on this platform.

Return values
array<string|int, mixed>

getAvgExpression()

Returns the SQL snippet to get the average value of a column.

public getAvgExpression(string $column) : string
Parameters
$column : string

The column to use.

Return values
string

Generated SQL including an AVG aggregate function.

getBetweenExpression()

Returns the SQL that checks if an expression evaluates to a value between two values.

public getBetweenExpression(string $expression, string $value1, string $value2) : string

The parameter $expression is checked if it is between $value1 and $value2.

Note: There is a slight difference in the way BETWEEN works on some databases. http://www.w3schools.com/sql/sql_between.asp. If you want complete database independence you should avoid using between().

Parameters
$expression : string

The value to compare to.

$value1 : string

The lower value to compare with.

$value2 : string

The higher value to compare with.

Return values
string

The logical expression.

getBigIntTypeDeclarationSQL()

Returns the SQL snippet that declares an 8 byte integer column.

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

getBinaryDefaultLength()

Gets the default length of a binary field.

public getBinaryDefaultLength() : int
Return values
int

getBinaryMaxLength()

Gets the maximum length of a binary field.

public getBinaryMaxLength() : int
Return values
int

getBinaryTypeDeclarationSQL()

Returns the SQL snippet used to declare a BINARY/VARBINARY column type.

public getBinaryTypeDeclarationSQL(array<string|int, mixed> $field) : string
Parameters
$field : array<string|int, mixed>

The column definition.

Return values
string

getBitAndComparisonExpression()

Returns the SQL bit AND comparison expression.

public getBitAndComparisonExpression(string $value1, string $value2) : string
Parameters
$value1 : string
$value2 : string
Return values
string

getBitOrComparisonExpression()

Returns the SQL bit OR comparison expression.

public getBitOrComparisonExpression(string $value1, string $value2) : string
Parameters
$value1 : string
$value2 : string
Return values
string

getBlobTypeDeclarationSQL()

Returns the SQL Snippet used to declare a BLOB column type.

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

getBooleanTypeDeclarationSQL()

Returns the SQL snippet that declares a boolean column.

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

getCheckDeclarationSQL()

Obtains DBMS specific SQL code portion needed to set a CHECK constraint declaration to be used in statements like CREATE TABLE.

public getCheckDeclarationSQL(array<string|int, mixed> $definition) : string
Parameters
$definition : array<string|int, mixed>

The check definition.

Return values
string

DBMS specific SQL code portion needed to set a CHECK constraint.

getClobTypeDeclarationSQL()

Returns the SQL snippet used to declare a CLOB column type.

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

getColumnCharsetDeclarationSQL()

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

public getColumnCharsetDeclarationSQL(string $charset) : string
Parameters
$charset : string

The name of the charset.

Return values
string

DBMS specific SQL code portion needed to set the CHARACTER SET of a field declaration.

getColumnCollationDeclarationSQL()

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

public getColumnCollationDeclarationSQL(string $collation) : string
Parameters
$collation : string

The name of the collation.

Return values
string

DBMS specific SQL code portion needed to set the COLLATION of a field declaration.

getColumnDeclarationListSQL()

Gets declaration of a number of fields in bulk.

public getColumnDeclarationListSQL(array<string|int, mixed> $fields) : string
Parameters
$fields : array<string|int, mixed>

A multidimensional associative array. The first dimension determines the field name, while the second dimension is keyed with the name of the properties of the field being declared as array indexes. Currently, the types of supported field properties are as follows:

length Integer value that determines the maximum length of the text field. If this argument is missing the field should be declared to have the longest length allowed by the DBMS.

default Text 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. charset Text value with the default CHARACTER SET for this field. collation Text value with the default COLLATION for this field. unique unique constraint

Return values
string

getColumnDeclarationSQL()

Obtains DBMS specific SQL code portion needed to declare a generic type field to be used in statements like CREATE TABLE.

public getColumnDeclarationSQL(string $name, array<string|int, mixed> $field) : string
Parameters
$name : string

The name the field to be declared.

$field : array<string|int, mixed>

An 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:

length Integer value that determines the maximum length of the text field. If this argument is missing the field should be declared to have the longest length allowed by the DBMS.

default Text 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. charset Text value with the default CHARACTER SET for this field. collation Text value with the default COLLATION for this field. unique unique constraint check column check constraint columnDefinition a string that defines the complete column

Return values
string

DBMS specific SQL code portion that should be used to declare the column.

getCommentOnColumnSQL()

public getCommentOnColumnSQL(string $tableName, string $columnName, string $comment) : string
Parameters
$tableName : string
$columnName : string
$comment : string
Return values
string

getConcatExpression()

Returns a SQL snippet to concatenate the given expressions.

public getConcatExpression() : string

Accepts an arbitrary number of string parameters. Each parameter must contain an expression.

Return values
string

getCosExpression()

Returns the SQL to get the cosine of a value.

public getCosExpression(string $value) : string
Parameters
$value : string
Return values
string

getCountExpression()

Returns the SQL snippet to get the number of rows (without a NULL value) of a column.

public getCountExpression(string|int $column) : string

If a '*' is used instead of a column the number of selected rows is returned.

Parameters
$column : string|int

The column to use.

Return values
string

Generated SQL including a COUNT aggregate function.

getCreateConstraintSQL()

Returns the SQL to create a constraint on a table on this platform.

public getCreateConstraintSQL(Constraint $constraint, Table|string $table) : string
Parameters
$constraint : Constraint
$table : Table|string
Tags
throws
InvalidArgumentException
Return values
string

getCreateDatabaseSQL()

Returns the SQL to create a new database.

public getCreateDatabaseSQL(string $database) : string
Parameters
$database : string

The name of the database that should be created.

Tags
throws
DBALException

If not supported on this platform.

Return values
string

getCreateForeignKeySQL()

Returns the SQL to create a new foreign key.

public getCreateForeignKeySQL(ForeignKeyConstraint $foreignKey, Table|string $table) : string
Parameters
$foreignKey : ForeignKeyConstraint

The foreign key constraint.

$table : Table|string

The name of the table on which the foreign key is to be created.

Return values
string

getCreateIndexSQL()

Returns the SQL to create an index on a table on this platform.

public getCreateIndexSQL(Index $index, Table|string $table) : string
Parameters
$index : Index
$table : Table|string

The name of the table on which the index is to be created.

Tags
throws
InvalidArgumentException
Return values
string

getCreatePrimaryKeySQL()

Returns the SQL to create an unnamed primary key constraint.

public getCreatePrimaryKeySQL(Index $index, Table|string $table) : string
Parameters
$index : Index
$table : Table|string
Return values
string

getCreateSchemaSQL()

Returns the SQL to create a named schema.

public getCreateSchemaSQL(string $schemaName) : string
Parameters
$schemaName : string
Tags
throws
DBALException

If not supported on this platform.

Return values
string

getCreateSequenceSQL()

Returns the SQL to create a sequence on this platform.

public getCreateSequenceSQL(Sequence $sequence) : string
Parameters
$sequence : Sequence
Tags
throws
DBALException

If not supported on this platform.

Return values
string

getCreateTableSQL()

Returns the SQL statement(s) to create a table with the specified name, columns and constraints on this platform.

public getCreateTableSQL(Table $table[, int $createFlags = self::CREATE_INDEXES ]) : array<string|int, mixed>
Parameters
$table : Table
$createFlags : int = self::CREATE_INDEXES
Tags
throws
DBALException
throws
InvalidArgumentException
Return values
array<string|int, mixed>

The sequence of SQL statements.

getCreateTemporaryTableSnippetSQL()

public getCreateTemporaryTableSnippetSQL() : string
Return values
string

getCreateViewSQL()

public getCreateViewSQL(string $name, string $sql) : string
Parameters
$name : string
$sql : string
Tags
throws
DBALException

If not supported on this platform.

Return values
string

getCurrentDateSQL()

Returns the SQL specific for the platform to get the current date.

public getCurrentDateSQL() : string
Return values
string

getCurrentTimeSQL()

Returns the SQL specific for the platform to get the current time.

public getCurrentTimeSQL() : string
Return values
string

getCurrentTimestampSQL()

Returns the SQL specific for the platform to get the current timestamp

public getCurrentTimestampSQL() : string
Return values
string

getCustomTypeDeclarationSQL()

Obtains SQL code portion needed to create a custom column, e.g. when a field has the "columnDefinition" keyword.

public getCustomTypeDeclarationSQL(array<string|int, mixed> $columnDef) : string

Only "AUTOINCREMENT" and "PRIMARY KEY" are added if appropriate.

Parameters
$columnDef : array<string|int, mixed>
Return values
string

getDateAddDaysExpression()

Returns the SQL to add the number of given days to a date.

public getDateAddDaysExpression(string $date, int $days) : string
Parameters
$date : string
$days : int
Tags
throws
DBALException

If not supported on this platform.

Return values
string

getDateAddHourExpression()

Returns the SQL to add the number of given hours to a date.

public getDateAddHourExpression(string $date, int $hours) : string
Parameters
$date : string
$hours : int
Tags
throws
DBALException

If not supported on this platform.

Return values
string

getDateAddMinutesExpression()

Returns the SQL to add the number of given minutes to a date.

public getDateAddMinutesExpression(string $date, int $minutes) : string
Parameters
$date : string
$minutes : int
Tags
throws
DBALException

If not supported on this platform.

Return values
string

getDateAddMonthExpression()

Returns the SQL to add the number of given months to a date.

public getDateAddMonthExpression(string $date, int $months) : string
Parameters
$date : string
$months : int
Tags
throws
DBALException

If not supported on this platform.

Return values
string

getDateAddQuartersExpression()

Returns the SQL to add the number of given quarters to a date.

public getDateAddQuartersExpression(string $date, int $quarters) : string
Parameters
$date : string
$quarters : int
Tags
throws
DBALException

If not supported on this platform.

Return values
string

getDateAddSecondsExpression()

Returns the SQL to add the number of given seconds to a date.

public getDateAddSecondsExpression(string $date, int $seconds) : string
Parameters
$date : string
$seconds : int
Tags
throws
DBALException

If not supported on this platform.

Return values
string

getDateAddWeeksExpression()

Returns the SQL to add the number of given weeks to a date.

public getDateAddWeeksExpression(string $date, int $weeks) : string
Parameters
$date : string
$weeks : int
Tags
throws
DBALException

If not supported on this platform.

Return values
string

getDateAddYearsExpression()

Returns the SQL to add the number of given years to a date.

public getDateAddYearsExpression(string $date, int $years) : string
Parameters
$date : string
$years : int
Tags
throws
DBALException

If not supported on this platform.

Return values
string

getDateDiffExpression()

Returns the SQL to calculate the difference in days between the two passed dates.

public getDateDiffExpression(string $date1, string $date2) : string

Computes diff = date1 - date2.

Parameters
$date1 : string
$date2 : string
Tags
throws
DBALException

If not supported on this platform.

Return values
string

getDateFormatString()

Gets the format string, as accepted by the date() function, that describes the format of a stored date value of this platform.

public getDateFormatString() : string
Return values
string

The format string.

getDateSubDaysExpression()

Returns the SQL to subtract the number of given days to a date.

public getDateSubDaysExpression(string $date, int $days) : string
Parameters
$date : string
$days : int
Tags
throws
DBALException

If not supported on this platform.

Return values
string

getDateSubHourExpression()

Returns the SQL to subtract the number of given hours to a date.

public getDateSubHourExpression(string $date, int $hours) : string
Parameters
$date : string
$hours : int
Tags
throws
DBALException

If not supported on this platform.

Return values
string

getDateSubMinutesExpression()

Returns the SQL to subtract the number of given minutes from a date.

public getDateSubMinutesExpression(string $date, int $minutes) : string
Parameters
$date : string
$minutes : int
Tags
throws
DBALException

If not supported on this platform.

Return values
string

getDateSubMonthExpression()

Returns the SQL to subtract the number of given months to a date.

public getDateSubMonthExpression(string $date, int $months) : string
Parameters
$date : string
$months : int
Tags
throws
DBALException

If not supported on this platform.

Return values
string

getDateSubQuartersExpression()

Returns the SQL to subtract the number of given quarters from a date.

public getDateSubQuartersExpression(string $date, int $quarters) : string
Parameters
$date : string
$quarters : int
Tags
throws
DBALException

If not supported on this platform.

Return values
string

getDateSubSecondsExpression()

Returns the SQL to subtract the number of given seconds from a date.

public getDateSubSecondsExpression(string $date, int $seconds) : string
Parameters
$date : string
$seconds : int
Tags
throws
DBALException

If not supported on this platform.

Return values
string

getDateSubWeeksExpression()

Returns the SQL to subtract the number of given weeks from a date.

public getDateSubWeeksExpression(string $date, int $weeks) : string
Parameters
$date : string
$weeks : int
Tags
throws
DBALException

If not supported on this platform.

Return values
string

getDateSubYearsExpression()

Returns the SQL to subtract the number of given years from a date.

public getDateSubYearsExpression(string $date, int $years) : string
Parameters
$date : string
$years : int
Tags
throws
DBALException

If not supported on this platform.

Return values
string

getDateTimeFormatString()

Gets the format string, as accepted by the date() function, that describes the format of a stored datetime value of this platform.

public getDateTimeFormatString() : string
Return values
string

The format string.

getDateTimeTypeDeclarationSQL()

Obtains DBMS specific SQL to be used to create datetime fields in statements like CREATE TABLE.

public getDateTimeTypeDeclarationSQL(array<string|int, mixed> $fieldDeclaration) : string
Parameters
$fieldDeclaration : array<string|int, mixed>
Tags
throws
DBALException

If not supported on this platform.

Return values
string

getDateTimeTzFormatString()

Gets the format string, as accepted by the date() function, that describes the format of a stored datetime with timezone value of this platform.

public getDateTimeTzFormatString() : string
Return values
string

The format string.

getDateTimeTzTypeDeclarationSQL()

Obtains DBMS specific SQL to be used to create datetime with timezone offset fields.

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

getDateTypeDeclarationSQL()

Obtains DBMS specific SQL to be used to create date fields in statements like CREATE TABLE.

public getDateTypeDeclarationSQL(array<string|int, mixed> $fieldDeclaration) : string
Parameters
$fieldDeclaration : array<string|int, mixed>
Tags
throws
DBALException

If not supported on this platform.

Return values
string

getDecimalTypeDeclarationSQL()

Returns the SQL snippet that declares a floating point column of arbitrary precision.

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

getDefaultSchemaName()

Returns the default schema name.

public getDefaultSchemaName() : string
Tags
throws
DBALException

If not supported on this platform.

Return values
string

getDefaultTransactionIsolationLevel()

Gets the default transaction isolation level of the platform.

public getDefaultTransactionIsolationLevel() : int
Tags
see

Doctrine\DBAL\Connection\TRANSACTION_* constants.

Return values
int

The default isolation level.

getDefaultValueDeclarationSQL()

Obtains DBMS specific SQL code portion needed to set a default value declaration to be used in statements like CREATE TABLE.

public getDefaultValueDeclarationSQL(array<string|int, mixed> $field) : string
Parameters
$field : array<string|int, mixed>

The field definition array.

Return values
string

DBMS specific SQL code portion needed to set a default value.

getDoctrineTypeComment()

Gets the comment to append to a column comment that helps parsing this type in reverse engineering.

public getDoctrineTypeComment(Type $doctrineType) : string
Parameters
$doctrineType : Type
Return values
string

getDoctrineTypeMapping()

Gets the Doctrine type that is mapped for the given database column type.

public getDoctrineTypeMapping(string $dbType) : string
Parameters
$dbType : string
Tags
throws
DBALException
Return values
string

getDropConstraintSQL()

Returns the SQL to drop a constraint.

public getDropConstraintSQL(Constraint|string $constraint, Table|string $table) : string
Parameters
$constraint : Constraint|string
$table : Table|string
Return values
string

getDropDatabaseSQL()

Returns the SQL snippet to drop an existing database.

public getDropDatabaseSQL(string $database) : string
Parameters
$database : string

The name of the database that should be dropped.

Return values
string

getDropIndexSQL()

Returns the SQL to drop an index from a table.

public getDropIndexSQL(Index|string $index[, Table|string $table = null ]) : string
Parameters
$index : Index|string
$table : Table|string = null
Tags
throws
InvalidArgumentException
Return values
string

getDropSequenceSQL()

Returns the SQL snippet to drop an existing sequence.

public getDropSequenceSQL(Sequence|string $sequence) : string
Parameters
$sequence : Sequence|string
Tags
throws
DBALException

If not supported on this platform.

Return values
string

getDropTableSQL()

Returns the SQL snippet to drop an existing table.

public getDropTableSQL(Table|string $table) : string
Parameters
$table : Table|string
Tags
throws
InvalidArgumentException
Return values
string

getDropTemporaryTableSQL()

Returns the SQL to safely drop a temporary table WITHOUT implicitly committing an open transaction.

public getDropTemporaryTableSQL(Table|string $table) : string
Parameters
$table : Table|string
Return values
string

getDropViewSQL()

public getDropViewSQL(string $name) : string
Parameters
$name : string
Tags
throws
DBALException

If not supported on this platform.

Return values
string

getDummySelectSQL()

This is for test reasons, many vendors have special requirements for dummy statements.

public getDummySelectSQL() : string
Return values
string

getEmptyIdentityInsertSQL()

Returns the insert SQL for an empty insert statement.

public getEmptyIdentityInsertSQL(string $tableName, string $identifierColumnName) : string
Parameters
$tableName : string
$identifierColumnName : string
Return values
string

getFloatDeclarationSQL()

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

getForeignKeyBaseDeclarationSQL()

Obtains DBMS specific SQL code portion needed to set the FOREIGN KEY constraint of a field declaration to be used in statements like CREATE TABLE.

public getForeignKeyBaseDeclarationSQL(ForeignKeyConstraint $foreignKey) : string
Parameters
$foreignKey : ForeignKeyConstraint
Tags
throws
InvalidArgumentException
Return values
string

getForeignKeyDeclarationSQL()

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

public getForeignKeyDeclarationSQL(ForeignKeyConstraint $foreignKey) : string
Parameters
$foreignKey : ForeignKeyConstraint
Return values
string

DBMS specific SQL code portion needed to set the FOREIGN KEY constraint of a field declaration.

getForeignKeyReferentialActionSQL()

Returns the given referential action in uppercase if valid, otherwise throws an exception.

public getForeignKeyReferentialActionSQL(string $action) : string
Parameters
$action : string

The foreign key referential action.

Tags
throws
InvalidArgumentException

if unknown referential action given

Return values
string

getForUpdateSQL()

Returns the FOR UPDATE expression.

public getForUpdateSQL() : string
Return values
string

getGuidExpression()

Returns the global unique identifier expression.

public getGuidExpression() : string
Tags
throws
DBALException

If not supported on this platform.

Return values
string

getGuidTypeDeclarationSQL()

Returns the SQL snippet to declare a GUID/UUID field.

public getGuidTypeDeclarationSQL(array<string|int, mixed> $field) : string

By default this maps directly to a CHAR(36) and only maps to more special datatypes when the underlying databases support this datatype.

Parameters
$field : array<string|int, mixed>
Return values
string

getIdentifierQuoteCharacter()

Gets the character used for identifier quoting.

public getIdentifierQuoteCharacter() : string
Return values
string

getIdentityColumnNullInsertSQL()

public getIdentityColumnNullInsertSQL() : mixed
Tags
deprecated
todo

Remove in 3.0

Return values
mixed

getIdentitySequenceName()

Returns the name of the sequence for a particular identity column in a particular table.

public getIdentitySequenceName(string $tableName, string $columnName) : string
Parameters
$tableName : string

The name of the table to return the sequence name for.

$columnName : string

The name of the identity column in the table to return the sequence name for.

Tags
throws
DBALException

If not supported on this platform.

see
usesSequenceEmulatedIdentityColumns
Return values
string

getIndexDeclarationSQL()

Obtains DBMS specific SQL code portion needed to set an index declaration to be used in statements like CREATE TABLE.

public getIndexDeclarationSQL(string $name, Index $index) : string
Parameters
$name : string

The name of the index.

$index : Index

The index definition.

Tags
throws
InvalidArgumentException
Return values
string

DBMS specific SQL code portion needed to set an index.

getIndexFieldDeclarationListSQL()

Obtains DBMS specific SQL code portion needed to set an index declaration to be used in statements like CREATE TABLE.

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

getIntegerTypeDeclarationSQL()

Returns the SQL snippet that declares a 4 byte integer column.

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

getIsNotNullExpression()

Returns the SQL that checks if an expression is not null.

public getIsNotNullExpression(string $expression) : string
Parameters
$expression : string

The expression that should be compared to null.

Return values
string

The logical expression.

getIsNullExpression()

Returns the SQL that checks if an expression is null.

public getIsNullExpression(string $expression) : string
Parameters
$expression : string

The expression that should be compared to null.

Return values
string

The logical expression.

getJsonTypeDeclarationSQL()

Returns the SQL snippet to declare a JSON field.

public getJsonTypeDeclarationSQL(array<string|int, mixed> $field) : string

By default this maps directly to a CLOB and only maps to more special datatypes when the underlying databases support this datatype.

Parameters
$field : array<string|int, mixed>
Return values
string

getLengthExpression()

Returns the SQL snippet to get the length of a text field.

public getLengthExpression(string $column) : string
Parameters
$column : string
Return values
string

getListDatabasesSQL()

public getListDatabasesSQL() : string
Tags
throws
DBALException

If not supported on this platform.

Return values
string

getListNamespacesSQL()

Returns the SQL statement for retrieving the namespaces defined in the database.

public getListNamespacesSQL() : string
Tags
throws
DBALException

If not supported on this platform.

Return values
string

getListSequencesSQL()

public getListSequencesSQL(string $database) : string
Parameters
$database : string
Tags
throws
DBALException

If not supported on this platform.

Return values
string

getListTableColumnsSQL()

public getListTableColumnsSQL(string $table[, string|null $database = null ]) : string
Parameters
$table : string
$database : string|null = null
Tags
throws
DBALException

If not supported on this platform.

Return values
string

getListTableConstraintsSQL()

public getListTableConstraintsSQL(string $table) : string
Parameters
$table : string
Tags
throws
DBALException

If not supported on this platform.

Return values
string

getListTableForeignKeysSQL()

public getListTableForeignKeysSQL(string $table) : string
Parameters
$table : string
Tags
throws
DBALException

If not supported on this platform.

Return values
string

getListTableIndexesSQL()

Returns the list of indexes for the current database.

public getListTableIndexesSQL(string $table[, string $currentDatabase = null ]) : string

The current database parameter is optional but will always be passed when using the SchemaManager API and is the database the given table is in.

Attention: Some platforms only support currentDatabase when they are connected with that database. Cross-database information schema requests may be impossible.

Parameters
$table : string
$currentDatabase : string = null
Tags
throws
DBALException

If not supported on this platform.

Return values
string

getListTablesSQL()

public getListTablesSQL() : string
Tags
throws
DBALException

If not supported on this platform.

Return values
string

getListUsersSQL()

public getListUsersSQL() : string
Tags
throws
DBALException

If not supported on this platform.

Return values
string

getListViewsSQL()

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

public getListViewsSQL(string $database) : string
Parameters
$database : string
Tags
throws
DBALException

If not supported on this platform.

Return values
string

getLocateExpression()

Returns the SQL snippet to get the position of the first occurrence of substring $substr in string $str.

public getLocateExpression(string $str, string $substr[, int|bool $startPos = false ]) : string
Parameters
$str : string

Literal string.

$substr : string

Literal string to find.

$startPos : int|bool = false

Position to start at, beginning of string by default.

Tags
throws
DBALException

If not supported on this platform.

Return values
string

getLowerExpression()

Returns the SQL snippet to change all characters from the expression to lowercase, according to the current character set mapping.

public getLowerExpression(string $str) : string
Parameters
$str : string

Literal string or column name.

Return values
string

getLtrimExpression()

Returns the SQL snippet to trim leading space characters from the expression.

public getLtrimExpression(string $str) : string
Parameters
$str : string

Literal string or column name.

Return values
string

getMaxExpression()

Returns the SQL snippet to get the highest value of a column.

public getMaxExpression(string $column) : string
Parameters
$column : string

The column to use.

Return values
string

Generated SQL including a MAX aggregate function.

getMaxIdentifierLength()

Maximum length of any given database identifier, like tables or column names.

public getMaxIdentifierLength() : int
Return values
int

getMd5Expression()

Returns the SQL snippet to get the md5 sum of a field.

public getMd5Expression(string $column) : string

Note: Not SQL92, but common functionality.

Parameters
$column : string
Return values
string

getMinExpression()

Returns the SQL snippet to get the lowest value of a column.

public getMinExpression(string $column) : string
Parameters
$column : string

The column to use.

Return values
string

Generated SQL including a MIN aggregate function.

getModExpression()

Returns the SQL snippet to get the remainder of the division operation $expression1 / $expression2.

public getModExpression(string $expression1, string $expression2) : string
Parameters
$expression1 : string
$expression2 : string
Return values
string

getName()

Gets the name of the platform.

public abstract getName() : string
Return values
string

getNotExpression()

Returns the SQL for a logical not.

public getNotExpression(string $expression) : string

Example: $q = new Doctrine_Query(); $e = $q->expr; $q->select('*')->from('table') ->where($e->eq('id', $e->not('null'));

Parameters
$expression : string
Return values
string

The logical expression.

getNowExpression()

Returns the SQL snippet to get the current system date.

public getNowExpression() : string
Return values
string

getPiExpression()

Returns the SQL to get the PI value.

public getPiExpression() : string
Return values
string

getReadLockSQL()

Returns the SQL snippet to append to any SELECT statement which locks rows in shared read lock.

public getReadLockSQL() : string

This defaults to the ANSI SQL "FOR UPDATE", which is an exclusive lock (Write). Some database vendors allow to lighten this constraint up to be a real read lock.

Return values
string

getRegexpExpression()

Returns the regular expression operator.

public getRegexpExpression() : string
Tags
throws
DBALException

If not supported on this platform.

Return values
string

getRoundExpression()

Returns the SQL snippet to round a numeric field to the number of decimals specified.

public getRoundExpression(string $column, int $decimals) : string
Parameters
$column : string
$decimals : int
Return values
string

getRtrimExpression()

Returns the SQL snippet to trim trailing space characters from the expression.

public getRtrimExpression(string $str) : string
Parameters
$str : string

Literal string or column name.

Return values
string

getSequenceNextValSQL()

public getSequenceNextValSQL(string $sequenceName) : string
Parameters
$sequenceName : string
Tags
throws
DBALException

If not supported on this platform.

Return values
string

getSetTransactionIsolationSQL()

Returns the SQL to set the transaction isolation level.

public getSetTransactionIsolationSQL(int $level) : string
Parameters
$level : int
Tags
throws
DBALException

If not supported on this platform.

Return values
string

getSinExpression()

Returns the SQL to get the sine of a value.

public getSinExpression(string $value) : string
Parameters
$value : string
Return values
string

getSmallIntTypeDeclarationSQL()

Returns the SQL snippet that declares a 2 byte integer column.

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

getSqlCommentEndString()

Gets the string portion that ends an SQL comment.

public getSqlCommentEndString() : string
Return values
string

getSqlCommentStartString()

Gets the string portion that starts an SQL comment.

public getSqlCommentStartString() : string
Return values
string

getSQLResultCasing()

Gets the character casing of a column in an SQL result set of this platform.

public getSQLResultCasing(string $column) : string
Parameters
$column : string

The column name for which to get the correct character casing.

Return values
string

The column name in the character casing used in SQL result sets.

getSqrtExpression()

Returns the SQL snippet to get the squared value of a column.

public getSqrtExpression(string $column) : string
Parameters
$column : string

The column to use.

Return values
string

Generated SQL including an SQRT aggregate function.

getStringLiteralQuoteCharacter()

Gets the character used for string literal quoting.

public getStringLiteralQuoteCharacter() : string
Return values
string

getSubstringExpression()

Returns a SQL snippet to get a substring inside an SQL statement.

public getSubstringExpression(string $value, int $from[, int|null $length = null ]) : string

Note: Not SQL92, but common functionality.

SQLite only supports the 2 parameter variant of this function.

Parameters
$value : string

An sql string literal or column name/alias.

$from : int

Where to start the substring portion.

$length : int|null = null

The substring portion length.

Return values
string

getSumExpression()

Returns the SQL snippet to get the total sum of a column.

public getSumExpression(string $column) : string
Parameters
$column : string

The column to use.

Return values
string

Generated SQL including a SUM aggregate function.

getTemporaryTableName()

Some vendors require temporary table names to be qualified specially.

public getTemporaryTableName(string $tableName) : string
Parameters
$tableName : string
Return values
string

getTemporaryTableSQL()

Returns the required SQL string that fits between CREATE ... TABLE to create the table as a temporary table.

public getTemporaryTableSQL() : string

Should be overridden in driver classes to return the correct string for the specific database type.

The default is to return the string "TEMPORARY" - this will result in a SQL error for any database that does not support temporary tables, or that requires a different SQL command from "CREATE TEMPORARY TABLE".

Return values
string

The string required to be placed between "CREATE" and "TABLE" to generate a temporary table, if possible.

getTimeFormatString()

Gets the format string, as accepted by the date() function, that describes the format of a stored time value of this platform.

public getTimeFormatString() : string
Return values
string

The format string.

getTimeTypeDeclarationSQL()

Obtains DBMS specific SQL to be used to create time fields in statements like CREATE TABLE.

public getTimeTypeDeclarationSQL(array<string|int, mixed> $fieldDeclaration) : string
Parameters
$fieldDeclaration : array<string|int, mixed>
Tags
throws
DBALException

If not supported on this platform.

Return values
string

getTrimExpression()

Returns the SQL snippet to trim a string.

public getTrimExpression(string $str[, int $pos = self::TRIM_UNSPECIFIED ][, string|bool $char = false ]) : string
Parameters
$str : string

The expression to apply the trim to.

$pos : int = self::TRIM_UNSPECIFIED

The position of the trim (leading/trailing/both).

$char : string|bool = false

The char to trim, has to be quoted already. Defaults to space.

Return values
string

getTruncateTableSQL()

Generates a Truncate Table SQL statement for a given table.

public getTruncateTableSQL(string $tableName[, bool $cascade = false ]) : string

Cascade is not supported on many platforms but would optionally cascade the truncate by following the foreign keys.

Parameters
$tableName : string
$cascade : bool = false
Return values
string

getUniqueConstraintDeclarationSQL()

Obtains DBMS specific SQL code portion needed to set a unique constraint declaration to be used in statements like CREATE TABLE.

public getUniqueConstraintDeclarationSQL(string $name, Index $index) : string
Parameters
$name : string

The name of the unique constraint.

$index : Index

The index definition.

Tags
throws
InvalidArgumentException
Return values
string

DBMS specific SQL code portion needed to set a constraint.

getUniqueFieldDeclarationSQL()

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

public getUniqueFieldDeclarationSQL() : string
Return values
string

DBMS specific SQL code portion needed to set the UNIQUE constraint of a field declaration.

getUpperExpression()

Returns the SQL snippet to change all characters from the expression to uppercase, according to the current character set mapping.

public getUpperExpression(string $str) : string
Parameters
$str : string

Literal string or column name.

Return values
string

getVarcharDefaultLength()

Gets the default length of a varchar field.

public getVarcharDefaultLength() : int
Return values
int

getVarcharMaxLength()

Gets the maximum length of a varchar field.

public getVarcharMaxLength() : int
Return values
int

getVarcharTypeDeclarationSQL()

Returns the SQL snippet used to declare a VARCHAR column type.

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

getWildcards()

Gets all SQL wildcard characters of the platform.

public getWildcards() : array<string|int, mixed>
Return values
array<string|int, mixed>

getWriteLockSQL()

Returns the SQL snippet to append to any SELECT statement which obtains an exclusive lock on the rows.

public getWriteLockSQL() : string

The semantics of this lock mode should equal the SELECT .. FOR UPDATE of the ANSI SQL standard.

Return values
string

hasDoctrineTypeMappingFor()

Checks if a database type is currently supported by this platform.

public hasDoctrineTypeMappingFor(string $dbType) : bool
Parameters
$dbType : string
Return values
bool

hasNativeGuidType()

Does this platform have native guid type.

public hasNativeGuidType() : bool
Return values
bool

hasNativeJsonType()

Does this platform have native JSON type.

public hasNativeJsonType() : bool
Return values
bool

isCommentedDoctrineType()

Is it necessary for the platform to add a parsable type comment to allow reverse engineering the given type?

public isCommentedDoctrineType(Type $doctrineType) : bool
Parameters
$doctrineType : Type
Return values
bool

markDoctrineTypeCommented()

Marks this type as to be commented in ALTER TABLE and CREATE TABLE statements.

public markDoctrineTypeCommented(string|Type $doctrineType) : void
Parameters
$doctrineType : string|Type
Return values
void

modifyLimitQuery()

Adds an driver-specific LIMIT clause to the query.

public final modifyLimitQuery(string $query, int|null $limit[, int|null $offset = null ]) : string
Parameters
$query : string
$limit : int|null
$offset : int|null = null
Tags
throws
DBALException
Return values
string

prefersIdentityColumns()

Whether the platform prefers identity columns (eg. autoincrement) for ID generation.

public prefersIdentityColumns() : bool

Subclasses should override this method to return TRUE if they prefer identity columns.

Return values
bool

prefersSequences()

Whether the platform prefers sequences for ID generation.

public prefersSequences() : bool

Subclasses should override this method to return TRUE if they prefer sequences.

Return values
bool

quoteIdentifier()

Quotes a string so that it can be safely used as a table or column name, even if it is a reserved word of the platform. This also detects identifier chains separated by dot and quotes them independently.

public quoteIdentifier(string $str) : string

NOTE: Just because you CAN use quoted identifiers doesn't mean you SHOULD use them. In general, they end up causing way more problems than they solve.

Parameters
$str : string

The identifier name to be quoted.

Return values
string

The quoted identifier string.

quoteSingleIdentifier()

Quotes a single identifier (no dot chain separation).

public quoteSingleIdentifier(string $str) : string
Parameters
$str : string

The identifier name to be quoted.

Return values
string

The quoted identifier string.

quoteStringLiteral()

Quotes a literal string.

public quoteStringLiteral(string $str) : string

This method is NOT meant to fix SQL injections! It is only meant to escape this platform's string literal quote character inside the given literal string.

Parameters
$str : string

The literal string to be quoted.

Return values
string

The quoted literal string.

registerDoctrineTypeMapping()

Registers a doctrine type to be used in conjunction with a column type of this platform.

public registerDoctrineTypeMapping(string $dbType, string $doctrineType) : mixed
Parameters
$dbType : string
$doctrineType : string
Tags
throws
DBALException

If the type is not found.

Return values
mixed

releaseSavePoint()

Returns the SQL to release a savepoint.

public releaseSavePoint(string $savepoint) : string
Parameters
$savepoint : string
Return values
string

rollbackSavePoint()

Returns the SQL to rollback a savepoint.

public rollbackSavePoint(string $savepoint) : string
Parameters
$savepoint : string
Return values
string

supportsAlterTable()

Whether the platform supports altering tables.

public supportsAlterTable() : bool
Return values
bool

supportsColumnCollation()

Does this platform support column collation?

public supportsColumnCollation() : bool
Return values
bool

supportsCommentOnStatement()

Whether this platform support the proprietary syntax "COMMENT ON asset".

public supportsCommentOnStatement() : bool
Return values
bool

supportsCreateDropDatabase()

Whether this platform supports create database.

public supportsCreateDropDatabase() : bool

Some databases don't allow to create and drop databases at all or only with certain tools.

Return values
bool

supportsForeignKeyConstraints()

Whether the platform supports foreign key constraints.

public supportsForeignKeyConstraints() : bool
Return values
bool

supportsForeignKeyOnUpdate()

Whether this platform supports onUpdate in foreign key constraints.

public supportsForeignKeyOnUpdate() : bool
Return values
bool

supportsGettingAffectedRows()

Whether the platform supports getting the affected rows of a recent update/delete type query.

public supportsGettingAffectedRows() : bool
Return values
bool

supportsIdentityColumns()

Whether the platform supports identity columns.

public supportsIdentityColumns() : bool

Identity columns are columns that receive an auto-generated value from the database on insert of a row.

Return values
bool

supportsIndexes()

Whether the platform supports indexes.

public supportsIndexes() : bool
Return values
bool

supportsInlineColumnComments()

Whether this platform support to add inline column comments as postfix.

public supportsInlineColumnComments() : bool
Return values
bool

supportsLimitOffset()

Whether the database platform support offsets in modify limit clauses.

public supportsLimitOffset() : bool
Return values
bool

supportsPartialIndexes()

Whether the platform supports partial indexes.

public supportsPartialIndexes() : bool
Return values
bool

supportsPrimaryConstraints()

Whether the platform supports primary key constraints.

public supportsPrimaryConstraints() : bool
Return values
bool

supportsReleaseSavepoints()

Whether the platform supports releasing savepoints.

public supportsReleaseSavepoints() : bool
Return values
bool

supportsSavepoints()

Whether the platform supports savepoints.

public supportsSavepoints() : bool
Return values
bool

supportsSchemas()

Whether the platform supports database schemas.

public supportsSchemas() : bool
Return values
bool

supportsSequences()

Whether the platform supports sequences.

public supportsSequences() : bool
Return values
bool

supportsTransactions()

Whether the platform supports transactions.

public supportsTransactions() : bool
Return values
bool

supportsViews()

Whether this platform supports views.

public supportsViews() : bool
Return values
bool

usesSequenceEmulatedIdentityColumns()

Whether the platform emulates identity columns through sequences.

public usesSequenceEmulatedIdentityColumns() : bool

Some platforms that do not support identity columns natively but support sequences can emulate identity columns by using sequences.

Return values
bool

_getAlterTableIndexForeignKeySQL()

Common code for alter table statement generation that updates the changed Index and Foreign Key definitions.

protected _getAlterTableIndexForeignKeySQL(TableDiff $diff) : array<string|int, mixed>
Parameters
$diff : TableDiff
Return values
array<string|int, mixed>

_getCommonIntegerTypeDeclarationSQL()

Returns the SQL snippet that declares common properties of an integer column.

protected abstract _getCommonIntegerTypeDeclarationSQL(array<string|int, mixed> $columnDef) : string
Parameters
$columnDef : array<string|int, mixed>
Return values
string

_getCreateTableSQL()

Returns the SQL used to create a table.

protected _getCreateTableSQL(string $tableName, array<string|int, mixed> $columns[, array<string|int, mixed> $options = array() ]) : array<string|int, mixed>
Parameters
$tableName : string
$columns : array<string|int, mixed>
$options : array<string|int, mixed> = array()
Return values
array<string|int, mixed>

_getTransactionIsolationLevelSQL()

Returns the SQL for a given transaction isolation level Connection constant.

protected _getTransactionIsolationLevelSQL(int $level) : string
Parameters
$level : int
Tags
throws
InvalidArgumentException
Return values
string

doModifyLimitQuery()

Adds an driver-specific LIMIT clause to the query.

protected doModifyLimitQuery(string $query, int|null $limit, int|null $offset) : string
Parameters
$query : string
$limit : int|null
$offset : int|null
Return values
string

getBinaryTypeDeclarationSQLSnippet()

Returns the SQL snippet used to declare a BINARY/VARBINARY column type.

protected getBinaryTypeDeclarationSQLSnippet(int $length, bool $fixed) : string
Parameters
$length : int

The length of the column.

$fixed : bool

Whether the column length is fixed.

Tags
throws
DBALException

If not supported on this platform.

Return values
string

getColumnComment()

Gets the comment of a passed column modified by potential doctrine type comment hints.

protected getColumnComment(Column $column) : string
Parameters
$column : Column
Return values
string

getCreateIndexSQLFlags()

Adds additional flags for index generation.

protected getCreateIndexSQLFlags(Index $index) : string
Parameters
$index : Index
Return values
string

getDateArithmeticIntervalExpression()

Returns the SQL for a date arithmetic expression.

protected getDateArithmeticIntervalExpression(string $date, string $operator, int $interval, string $unit) : string
Parameters
$date : string

The column or literal representing a date to perform the arithmetic operation on.

$operator : string

The arithmetic operator (+ or -).

$interval : int

The interval that shall be calculated into the date.

$unit : string

The unit of the interval that shall be calculated into the date. One of the DATE_INTERVAL_UNIT_* constants.

Tags
throws
DBALException

If not supported on this platform.

Return values
string

getPartialIndexSQL()

Adds condition for partial index.

protected getPartialIndexSQL(Index $index) : string
Parameters
$index : Index
Return values
string

getPostAlterTableIndexForeignKeySQL()

protected getPostAlterTableIndexForeignKeySQL(TableDiff $diff) : array<string|int, mixed>
Parameters
$diff : TableDiff
Return values
array<string|int, mixed>

getPreAlterTableIndexForeignKeySQL()

protected getPreAlterTableIndexForeignKeySQL(TableDiff $diff) : array<string|int, mixed>
Parameters
$diff : TableDiff
Return values
array<string|int, mixed>

getRenameIndexSQL()

Returns the SQL for renaming an index on a table.

protected getRenameIndexSQL(string $oldIndexName, Index $index, string $tableName) : array<string|int, mixed>
Parameters
$oldIndexName : string

The name of the index to rename from.

$index : Index

The definition of the index to rename to.

$tableName : string

The table to rename the given index on.

Return values
array<string|int, mixed>

The sequence of SQL statements for renaming the given index.

getReservedKeywordsClass()

Returns the class name of the reserved keywords list.

protected getReservedKeywordsClass() : string
Tags
throws
DBALException

If not supported on this platform.

Return values
string

getVarcharTypeDeclarationSQLSnippet()

protected getVarcharTypeDeclarationSQLSnippet(int $length, bool $fixed) : string
Parameters
$length : int
$fixed : bool
Tags
throws
DBALException

If not supported on this platform.

Return values
string

initializeCommentedDoctrineTypes()

Initializes the Doctrine Type comments instance variable for in_array() checks.

protected initializeCommentedDoctrineTypes() : void
Return values
void

initializeDoctrineTypeMappings()

Lazy load Doctrine Type Mappings.

protected abstract initializeDoctrineTypeMappings() : void
Return values
void

onSchemaAlterTable()

protected onSchemaAlterTable(TableDiff $diff, array<string|int, mixed> &$sql) : bool
Parameters
$diff : TableDiff
$sql : array<string|int, mixed>
Return values
bool

onSchemaAlterTableAddColumn()

protected onSchemaAlterTableAddColumn(Column $column, TableDiff $diff, array<string|int, mixed> &$columnSql) : bool
Parameters
$column : Column
$diff : TableDiff
$columnSql : array<string|int, mixed>
Return values
bool

onSchemaAlterTableChangeColumn()

protected onSchemaAlterTableChangeColumn(ColumnDiff $columnDiff, TableDiff $diff, array<string|int, mixed> &$columnSql) : bool
Parameters
$columnDiff : ColumnDiff
$diff : TableDiff
$columnSql : array<string|int, mixed>
Return values
bool

onSchemaAlterTableRemoveColumn()

protected onSchemaAlterTableRemoveColumn(Column $column, TableDiff $diff, array<string|int, mixed> &$columnSql) : bool
Parameters
$column : Column
$diff : TableDiff
$columnSql : array<string|int, mixed>
Return values
bool

onSchemaAlterTableRenameColumn()

protected onSchemaAlterTableRenameColumn(string $oldColumnName, Column $column, TableDiff $diff, array<string|int, mixed> &$columnSql) : bool
Parameters
$oldColumnName : string
$column : Column
$diff : TableDiff
$columnSql : array<string|int, mixed>
Return values
bool

initializeAllDoctrineTypeMappings()

Initializes Doctrine Type Mappings with the platform defaults and with all additional type mappings.

private initializeAllDoctrineTypeMappings() : void
Return values
void

Search results