public class DefaultUniqueDelegate extends Object implements UniqueDelegate
Constructor and Description |
---|
DefaultUniqueDelegate(Dialect dialect)
Constructs DefaultUniqueDelegate
|
Modifier and Type | Method and Description |
---|---|
String |
getAlterTableToAddUniqueKeyCommand(UniqueKey uniqueKey,
Metadata metadata,
SqlStringGenerationContext context)
Get the SQL ALTER TABLE command to be used to create the given UniqueKey.
|
String |
getAlterTableToDropUniqueKeyCommand(UniqueKey uniqueKey,
Metadata metadata,
SqlStringGenerationContext context)
Get the SQL ALTER TABLE command to be used to drop the given UniqueKey.
|
String |
getColumnDefinitionUniquenessFragment(Column column,
SqlStringGenerationContext context)
Get the fragment that can be used to make a column unique as part of its column definition.
|
protected String |
getDropUnique() |
String |
getTableCreationUniqueConstraintsFragment(Table table,
SqlStringGenerationContext context)
Get the fragment that can be used to apply unique constraints as part of table creation.
|
protected String |
uniqueConstraintSql(UniqueKey uniqueKey) |
protected final Dialect dialect
public DefaultUniqueDelegate(Dialect dialect)
dialect
- The dialect for which we are handling unique constraintspublic String getColumnDefinitionUniquenessFragment(Column column, SqlStringGenerationContext context)
UniqueDelegate
getColumnDefinitionUniquenessFragment
in interface UniqueDelegate
column
- The column to which to apply the uniquecontext
- A context for SQL string generationpublic String getTableCreationUniqueConstraintsFragment(Table table, SqlStringGenerationContext context)
UniqueDelegate
UniqueKey
instances for the given table (see
Table.getUniqueKeyIterator()
and generate the whole fragment for all
unique keys
Intended for Dialects which support unique constraint definitions, but just not in separate ALTER statements.getTableCreationUniqueConstraintsFragment
in interface UniqueDelegate
table
- The table for which to generate the unique constraints fragmentcontext
- A context for SQL string generation", unique(col1, col2), unique( col20)"
. NOTE: The leading
comma is important!public String getAlterTableToAddUniqueKeyCommand(UniqueKey uniqueKey, Metadata metadata, SqlStringGenerationContext context)
UniqueDelegate
getAlterTableToAddUniqueKeyCommand
in interface UniqueDelegate
uniqueKey
- The UniqueKey instance. Contains all information about the columnsmetadata
- Access to the bootstrap mapping informationcontext
- A context for SQL string generationpublic String getAlterTableToDropUniqueKeyCommand(UniqueKey uniqueKey, Metadata metadata, SqlStringGenerationContext context)
UniqueDelegate
getAlterTableToDropUniqueKeyCommand
in interface UniqueDelegate
uniqueKey
- The UniqueKey instance. Contains all information about the columnsmetadata
- Access to the bootstrap mapping informationcontext
- A context for SQL string generationprotected String getDropUnique()
Copyright © 2001-2021 Red Hat, Inc. All Rights Reserved.