Methods Summary |
---|
public void | addColumn(Column column)
if ( !columns.contains( column ) ) columns.add( column );
|
public void | addColumns(java.util.Iterator extraColumns)
while ( extraColumns.hasNext() ) addColumn( (Column) extraColumns.next() );
|
public static java.lang.String | buildSqlCreateIndexString(org.hibernate.dialect.Dialect dialect, java.lang.String name, Table table, java.util.Iterator columns, boolean unique, java.lang.String defaultCatalog, java.lang.String defaultSchema)
//TODO handle supportsNotNullUnique=false, but such a case does not exist in the wild so far
StringBuffer buf = new StringBuffer( "create" )
.append( unique ?
" unique" :
"" )
.append( " index " )
.append( dialect.qualifyIndexName() ?
name :
StringHelper.unqualify( name ) )
.append( " on " )
.append( table.getQualifiedName( dialect, defaultCatalog, defaultSchema ) )
.append( " (" );
Iterator iter = columns;
while ( iter.hasNext() ) {
buf.append( ( (Column) iter.next() ).getQuotedName( dialect ) );
if ( iter.hasNext() ) buf.append( ", " );
}
buf.append( ")" );
return buf.toString();
|
public static java.lang.String | buildSqlDropIndexString(org.hibernate.dialect.Dialect dialect, Table table, java.lang.String name, java.lang.String defaultCatalog, java.lang.String defaultSchema)
return "drop index " +
StringHelper.qualify(
table.getQualifiedName( dialect, defaultCatalog, defaultSchema ),
name
);
|
public boolean | containsColumn(Column column)
return columns.contains( column );
|
public java.util.Iterator | getColumnIterator()
return columns.iterator();
|
public int | getColumnSpan()
return columns.size();
|
public java.lang.String | getName()
return name;
|
public Table | getTable()
return table;
|
public void | setName(java.lang.String name)
this.name = name;
|
public void | setTable(Table table)
this.table = table;
|
public java.lang.String | sqlConstraintString(org.hibernate.dialect.Dialect dialect)
StringBuffer buf = new StringBuffer( " index (" );
Iterator iter = getColumnIterator();
while ( iter.hasNext() ) {
buf.append( ( (Column) iter.next() ).getQuotedName( dialect ) );
if ( iter.hasNext() ) buf.append( ", " );
}
return buf.append( ')" ).toString();
|
public java.lang.String | sqlCreateString(org.hibernate.dialect.Dialect dialect, org.hibernate.engine.Mapping mapping, java.lang.String defaultCatalog, java.lang.String defaultSchema)
return buildSqlCreateIndexString(
dialect,
getName(),
getTable(),
getColumnIterator(),
false,
defaultCatalog,
defaultSchema
);
|
public java.lang.String | sqlDropString(org.hibernate.dialect.Dialect dialect, java.lang.String defaultCatalog, java.lang.String defaultSchema)
return "drop index " +
StringHelper.qualify(
table.getQualifiedName( dialect, defaultCatalog, defaultSchema ),
name
);
|
public java.lang.String | toString()
return getClass().getName() + "(" + getName() + ")";
|