PHP Class Doctrine\DBAL\Platforms\SQLServerPlatform

Since: 2.0
Author: Roman Borschel ([email protected])
Author: Jonathan H. Wage ([email protected])
Author: Benjamin Eberlei ([email protected])
Author: Steve Müller ([email protected])
Inheritance: extends Doctrine\DBAL\Platforms\AbstractPlatform
Datei anzeigen Open project: doctrine/dbal Class Usage Examples

Public Methods

Method Description
appendLockHint ( $fromClause, $lockMode ) {@inheritDoc}
convertBooleans ( $item ) {@inheritDoc}
createSavePoint ( $savepoint ) {@inheritDoc}
getAddExtendedPropertySQL ( string $name, string | null $value = null, string | null $level0Type = null, string | null $level0Name = null, string | null $level1Type = null, string | null $level1Name = null, string | null $level2Type = null, string | null $level2Name = null ) : string Returns the SQL statement for adding an extended property to a database object.
getAlterTableSQL ( Doctrine\DBAL\Schema\TableDiff $diff ) {@inheritDoc}
getBigIntTypeDeclarationSQL ( array $field ) {@inheritDoc}
getBinaryMaxLength ( )
getBlobTypeDeclarationSQL ( array $field ) {@inheritDoc}
getBooleanTypeDeclarationSQL ( array $field ) {@inheritDoc}
getClobTypeDeclarationSQL ( array $field ) {@inheritDoc}
getColumnDeclarationSQL ( $name, array $field )
getConcatExpression ( ) {@inheritDoc}
getCreateDatabaseSQL ( $name ) {@inheritDoc}
getCreateIndexSQL ( Doctrine\DBAL\Schema\Index $index, $table ) {@inheritDoc}
getCreatePrimaryKeySQL ( Doctrine\DBAL\Schema\Index $index, $table ) {@inheritDoc}
getCreateSchemaSQL ( $schemaName ) {@inheritDoc}
getCreateTemporaryTableSnippetSQL ( ) {@inheritDoc}
getCreateViewSQL ( $name, $sql ) {@inheritDoc}
getDateDiffExpression ( $date1, $date2 ) {@inheritDoc}
getDateFormatString ( ) {@inheritDoc}
getDateTimeFormatString ( ) {@inheritDoc}
getDateTimeTypeDeclarationSQL ( array $fieldDeclaration ) {@inheritDoc}
getDateTimeTzFormatString ( ) {@inheritDoc}
getDateTypeDeclarationSQL ( array $fieldDeclaration ) {@inheritDoc}
getDefaultConstraintDeclarationSQL ( string $table, array $column ) : string Returns the SQL snippet for declaring a default constraint.
getDefaultSchemaName ( )
getDefaultValueDeclarationSQL ( $field ) {@inheritDoc}
getDropDatabaseSQL ( $name ) {@inheritDoc}
getDropExtendedPropertySQL ( string $name, string | null $level0Type = null, string | null $level0Name = null, string | null $level1Type = null, string | null $level1Name = null, string | null $level2Type = null, string | null $level2Name = null ) : string Returns the SQL statement for dropping an extended property from a database object.
getDropForeignKeySQL ( $foreignKey, $table ) {@inheritDoc}
getDropIndexSQL ( $index, $table = null ) {@inheritDoc}
getDropViewSQL ( $name ) {@inheritDoc}
getEmptyIdentityInsertSQL ( $quotedTableName, $quotedIdentifierColumnName ) {@inheritDoc}
getForUpdateSQL ( ) {@inheritDoc}
getForeignKeyReferentialActionSQL ( $action )
getGuidExpression ( ) {@inheritDoc}
getGuidTypeDeclarationSQL ( array $field ) {@inheritDoc}
getIntegerTypeDeclarationSQL ( array $field ) {@inheritDoc}
getLengthExpression ( $column ) {@inheritDoc}
getListDatabasesSQL ( ) {@inheritDoc}
getListNamespacesSQL ( ) {@inheritDoc}
getListTableColumnsSQL ( $table, $database = null ) {@inheritDoc}
getListTableForeignKeysSQL ( $table, $database = null ) {@inheritDoc}
getListTableIndexesSQL ( $table, $currentDatabase = null ) {@inheritDoc}
getListTablesSQL ( ) {@inheritDoc}
getListViewsSQL ( $database ) {@inheritDoc}
getLocateExpression ( $str, $substr, $startPos = false ) {@inheritDoc}
getModExpression ( $expression1, $expression2 ) {@inheritDoc}
getName ( ) {@inheritDoc}
getSetTransactionIsolationSQL ( $level ) {@inheritDoc}
getSmallIntTypeDeclarationSQL ( array $field ) {@inheritDoc}
getSubstringExpression ( $value, $from, $length = null ) {@inheritDoc}
getTemporaryTableName ( $tableName ) {@inheritDoc}
getTimeFormatString ( ) {@inheritDoc}
getTimeTypeDeclarationSQL ( array $fieldDeclaration ) {@inheritDoc}
getTrimExpression ( $str, $pos = self::TRIM_UNSPECIFIED, $char = false ) {@inheritDoc}
getTruncateTableSQL ( $tableName, $cascade = false ) {@inheritDoc}
getUniqueConstraintDeclarationSQL ( $name, Doctrine\DBAL\Schema\Index $index ) {@inheritDoc}
getUpdateExtendedPropertySQL ( string $name, string | null $value = null, string | null $level0Type = null, string | null $level0Name = null, string | null $level1Type = null, string | null $level1Name = null, string | null $level2Type = null, string | null $level2Name = null ) : string Returns the SQL statement for updating an extended property of a database object.
hasNativeGuidType ( ) {@inheritDoc}
prefersIdentityColumns ( ) {@inheritDoc}
quoteSingleIdentifier ( $str ) {@inheritDoc}
releaseSavePoint ( $savepoint ) {@inheritDoc}
rollbackSavePoint ( $savepoint ) {@inheritDoc}
supportsColumnCollation ( ) {@inheritDoc}
supportsCreateDropDatabase ( ) {@inheritDoc}
supportsIdentityColumns ( ) {@inheritDoc}
supportsLimitOffset ( ) {@inheritDoc}
supportsReleaseSavepoints ( ) {@inheritDoc}
supportsSchemas ( )

Protected Methods

Method Description
_getCommonIntegerTypeDeclarationSQL ( array $columnDef ) {@inheritDoc}
_getCreateTableSQL ( $tableName, array $columns, array $options = [] ) {@inheritDoc}
doModifyLimitQuery ( $query, $limit, $offset = null ) {@inheritDoc}
getAlterColumnCommentSQL ( string $tableName, string $columnName, string $comment ) : string Returns the SQL statement for altering a column comment.
getBinaryTypeDeclarationSQLSnippet ( $length, $fixed )
getCreateColumnCommentSQL ( string $tableName, string $columnName, string $comment ) : string Returns the SQL statement for creating a column comment.
getCreateIndexSQLFlags ( Doctrine\DBAL\Schema\Index $index ) {@inheritDoc}
getDateArithmeticIntervalExpression ( $date, $operator, $interval, $unit )
getDropColumnCommentSQL ( string $tableName, string $columnName ) : string Returns the SQL statement for dropping a column comment.
getRenameIndexSQL ( $oldIndexName, Doctrine\DBAL\Schema\Index $index, $tableName )
getReservedKeywordsClass ( ) {@inheritDoc}
getVarcharTypeDeclarationSQLSnippet ( $length, $fixed ) {@inheritDoc}
initializeDoctrineTypeMappings ( ) {@inheritDoc}

Private Methods

Method Description
_appendUniqueConstraintDefinition ( string $sql, Doctrine\DBAL\Schema\Index $index ) : string Extend unique key constraint with required filters
alterColumnRequiresDropDefaultConstraint ( Doctrine\DBAL\Schema\ColumnDiff $columnDiff ) : boolean Checks whether a column alteration requires dropping its default constraint first.
generateDefaultConstraintName ( string $table, string $column ) : string Returns a unique default constraint name for a table and column.
generateIdentifierName ( string $identifier ) : string Returns a hash value for a given identifier.
getAlterTableAddDefaultConstraintClause ( string $tableName, Doctrine\DBAL\Schema\Column $column ) : string Returns the SQL clause for adding a default constraint in an ALTER TABLE statement.
getAlterTableDropDefaultConstraintClause ( string $tableName, string $columnName ) : string Returns the SQL clause for dropping an existing default constraint in an ALTER TABLE statement.
getTableWhereClause ( string $table, string $schemaColumn, string $tableColumn ) : string Returns the where clause to filter schema and table name in a query.
isOrderByInTopNSubquery ( string $query, integer $currentPosition ) : boolean Check an ORDER BY clause to see if it is in a TOP N query or subquery.
scrubInnerOrderBy ( $query ) : string Remove ORDER BY clauses in subqueries - they're not supported by SQL Server.

Method Details

_getCommonIntegerTypeDeclarationSQL() protected method

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

_getCreateTableSQL() protected method

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

appendLockHint() public method

{@inheritDoc}
public appendLockHint ( $fromClause, $lockMode )

convertBooleans() public method

{@inheritDoc}
public convertBooleans ( $item )

createSavePoint() public method

{@inheritDoc}
public createSavePoint ( $savepoint )

doModifyLimitQuery() protected method

{@inheritDoc}
protected doModifyLimitQuery ( $query, $limit, $offset = null )

getAddExtendedPropertySQL() public method

Returns the SQL statement for adding an extended property to a database object.
public getAddExtendedPropertySQL ( string $name, string | null $value = null, string | null $level0Type = null, string | null $level0Name = null, string | null $level1Type = null, string | null $level1Name = null, string | null $level2Type = null, string | null $level2Name = null ) : string
$name string The name of the property to add.
$value string | null The value of the property to add.
$level0Type string | null The type of the object at level 0 the property belongs to.
$level0Name string | null The name of the object at level 0 the property belongs to.
$level1Type string | null The type of the object at level 1 the property belongs to.
$level1Name string | null The name of the object at level 1 the property belongs to.
$level2Type string | null The type of the object at level 2 the property belongs to.
$level2Name string | null The name of the object at level 2 the property belongs to.
return string

getAlterColumnCommentSQL() protected method

SQL Server does not support native column comments, therefore the extended properties functionality is used as a workaround to store them. The property name used to store column comments is "MS_Description" which provides compatibility with SQL Server Management Studio, as column comments are stored in the same property there when specifying a column's "Description" attribute.
protected getAlterColumnCommentSQL ( string $tableName, string $columnName, string $comment ) : string
$tableName string The quoted table name to which the column belongs.
$columnName string The quoted column name to alter the comment for.
$comment string The column's comment.
return string

getAlterTableSQL() public method

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

getBigIntTypeDeclarationSQL() public method

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

getBinaryMaxLength() public method

public getBinaryMaxLength ( )

getBinaryTypeDeclarationSQLSnippet() protected method

protected getBinaryTypeDeclarationSQLSnippet ( $length, $fixed )

getBlobTypeDeclarationSQL() public method

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

getBooleanTypeDeclarationSQL() public method

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

getClobTypeDeclarationSQL() public method

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

getColumnDeclarationSQL() public method

Modifies column declaration order as it differs in Microsoft SQL Server.
public getColumnDeclarationSQL ( $name, array $field )
$field array

getConcatExpression() public method

{@inheritDoc}
public getConcatExpression ( )

getCreateColumnCommentSQL() protected method

SQL Server does not support native column comments, therefore the extended properties functionality is used as a workaround to store them. The property name used to store column comments is "MS_Description" which provides compatibility with SQL Server Management Studio, as column comments are stored in the same property there when specifying a column's "Description" attribute.
protected getCreateColumnCommentSQL ( string $tableName, string $columnName, string $comment ) : string
$tableName string The quoted table name to which the column belongs.
$columnName string The quoted column name to create the comment for.
$comment string The column's comment.
return string

getCreateDatabaseSQL() public method

{@inheritDoc}
public getCreateDatabaseSQL ( $name )

getCreateIndexSQL() public method

{@inheritDoc}
public getCreateIndexSQL ( Doctrine\DBAL\Schema\Index $index, $table )
$index Doctrine\DBAL\Schema\Index

getCreateIndexSQLFlags() protected method

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

getCreatePrimaryKeySQL() public method

{@inheritDoc}
public getCreatePrimaryKeySQL ( Doctrine\DBAL\Schema\Index $index, $table )
$index Doctrine\DBAL\Schema\Index

getCreateSchemaSQL() public method

{@inheritDoc}
public getCreateSchemaSQL ( $schemaName )

getCreateTemporaryTableSnippetSQL() public method

{@inheritDoc}

getCreateViewSQL() public method

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

getDateArithmeticIntervalExpression() protected method

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

getDateDiffExpression() public method

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

getDateFormatString() public method

{@inheritDoc}
public getDateFormatString ( )

getDateTimeFormatString() public method

{@inheritDoc}

getDateTimeTypeDeclarationSQL() public method

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

getDateTimeTzFormatString() public method

{@inheritDoc}

getDateTypeDeclarationSQL() public method

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

getDefaultConstraintDeclarationSQL() public method

Returns the SQL snippet for declaring a default constraint.
public getDefaultConstraintDeclarationSQL ( string $table, array $column ) : string
$table string Name of the table to return the default constraint declaration for.
$column array Column definition.
return string

getDefaultSchemaName() public method

getDefaultValueDeclarationSQL() public method

{@inheritDoc}
public getDefaultValueDeclarationSQL ( $field )

getDropColumnCommentSQL() protected method

SQL Server does not support native column comments, therefore the extended properties functionality is used as a workaround to store them. The property name used to store column comments is "MS_Description" which provides compatibility with SQL Server Management Studio, as column comments are stored in the same property there when specifying a column's "Description" attribute.
protected getDropColumnCommentSQL ( string $tableName, string $columnName ) : string
$tableName string The quoted table name to which the column belongs.
$columnName string The quoted column name to drop the comment for.
return string

getDropDatabaseSQL() public method

{@inheritDoc}
public getDropDatabaseSQL ( $name )

getDropExtendedPropertySQL() public method

Returns the SQL statement for dropping an extended property from a database object.
public getDropExtendedPropertySQL ( string $name, string | null $level0Type = null, string | null $level0Name = null, string | null $level1Type = null, string | null $level1Name = null, string | null $level2Type = null, string | null $level2Name = null ) : string
$name string The name of the property to drop.
$level0Type string | null The type of the object at level 0 the property belongs to.
$level0Name string | null The name of the object at level 0 the property belongs to.
$level1Type string | null The type of the object at level 1 the property belongs to.
$level1Name string | null The name of the object at level 1 the property belongs to.
$level2Type string | null The type of the object at level 2 the property belongs to.
$level2Name string | null The name of the object at level 2 the property belongs to.
return string

getDropForeignKeySQL() public method

{@inheritDoc}
public getDropForeignKeySQL ( $foreignKey, $table )

getDropIndexSQL() public method

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

getDropViewSQL() public method

{@inheritDoc}
public getDropViewSQL ( $name )

getEmptyIdentityInsertSQL() public method

{@inheritDoc}
public getEmptyIdentityInsertSQL ( $quotedTableName, $quotedIdentifierColumnName )

getForUpdateSQL() public method

{@inheritDoc}
public getForUpdateSQL ( )

getForeignKeyReferentialActionSQL() public method

getGuidExpression() public method

{@inheritDoc}
public getGuidExpression ( )

getGuidTypeDeclarationSQL() public method

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

getIntegerTypeDeclarationSQL() public method

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

getLengthExpression() public method

{@inheritDoc}
public getLengthExpression ( $column )

getListDatabasesSQL() public method

{@inheritDoc}
public getListDatabasesSQL ( )

getListNamespacesSQL() public method

{@inheritDoc}

getListTableColumnsSQL() public method

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

getListTableForeignKeysSQL() public method

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

getListTableIndexesSQL() public method

{@inheritDoc}
public getListTableIndexesSQL ( $table, $currentDatabase = null )

getListTablesSQL() public method

{@inheritDoc}
public getListTablesSQL ( )

getListViewsSQL() public method

{@inheritDoc}
public getListViewsSQL ( $database )

getLocateExpression() public method

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

getModExpression() public method

{@inheritDoc}
public getModExpression ( $expression1, $expression2 )

getName() public method

{@inheritDoc}
public getName ( )

getRenameIndexSQL() protected method

protected getRenameIndexSQL ( $oldIndexName, Doctrine\DBAL\Schema\Index $index, $tableName )
$index Doctrine\DBAL\Schema\Index

getReservedKeywordsClass() protected method

{@inheritDoc}
protected getReservedKeywordsClass ( )

getSetTransactionIsolationSQL() public method

{@inheritDoc}
public getSetTransactionIsolationSQL ( $level )

getSmallIntTypeDeclarationSQL() public method

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

getSubstringExpression() public method

{@inheritDoc}
public getSubstringExpression ( $value, $from, $length = null )

getTemporaryTableName() public method

{@inheritDoc}
public getTemporaryTableName ( $tableName )

getTimeFormatString() public method

{@inheritDoc}
public getTimeFormatString ( )

getTimeTypeDeclarationSQL() public method

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

getTrimExpression() public method

{@inheritDoc}
public getTrimExpression ( $str, $pos = self::TRIM_UNSPECIFIED, $char = false )

getTruncateTableSQL() public method

{@inheritDoc}
public getTruncateTableSQL ( $tableName, $cascade = false )

getUniqueConstraintDeclarationSQL() public method

{@inheritDoc}
public getUniqueConstraintDeclarationSQL ( $name, Doctrine\DBAL\Schema\Index $index )
$index Doctrine\DBAL\Schema\Index

getUpdateExtendedPropertySQL() public method

Returns the SQL statement for updating an extended property of a database object.
public getUpdateExtendedPropertySQL ( string $name, string | null $value = null, string | null $level0Type = null, string | null $level0Name = null, string | null $level1Type = null, string | null $level1Name = null, string | null $level2Type = null, string | null $level2Name = null ) : string
$name string The name of the property to update.
$value string | null The value of the property to update.
$level0Type string | null The type of the object at level 0 the property belongs to.
$level0Name string | null The name of the object at level 0 the property belongs to.
$level1Type string | null The type of the object at level 1 the property belongs to.
$level1Name string | null The name of the object at level 1 the property belongs to.
$level2Type string | null The type of the object at level 2 the property belongs to.
$level2Name string | null The name of the object at level 2 the property belongs to.
return string

getVarcharTypeDeclarationSQLSnippet() protected method

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

hasNativeGuidType() public method

{@inheritDoc}
public hasNativeGuidType ( )

initializeDoctrineTypeMappings() protected method

{@inheritDoc}

prefersIdentityColumns() public method

Microsoft SQL Server prefers "autoincrement" identity columns since sequences can only be emulated with a table.

quoteSingleIdentifier() public method

{@inheritDoc}
public quoteSingleIdentifier ( $str )

releaseSavePoint() public method

{@inheritDoc}
public releaseSavePoint ( $savepoint )

rollbackSavePoint() public method

{@inheritDoc}
public rollbackSavePoint ( $savepoint )

supportsColumnCollation() public method

{@inheritDoc}

supportsCreateDropDatabase() public method

{@inheritDoc}

supportsIdentityColumns() public method

Microsoft SQL Server supports this through AUTO_INCREMENT columns.

supportsLimitOffset() public method

{@inheritDoc}
public supportsLimitOffset ( )

supportsReleaseSavepoints() public method

{@inheritDoc}

supportsSchemas() public method

public supportsSchemas ( )