Skip to content

Commit

Permalink
HHH-10451 - Fix generation of 'comment on table ... ' and 'comment on…
Browse files Browse the repository at this point in the history
… column' statements
  • Loading branch information
dreab8 committed Jan 25, 2016
1 parent 53872de commit 8e32162
Showing 1 changed file with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,16 +145,26 @@ public String[] getSqlCreateStrings(Table table, Metadata metadata) {
List<String> sqlStrings = new ArrayList<String>();
sqlStrings.add( buf.toString() );

applyComments( table, sqlStrings );
applyComments( table, tableName, sqlStrings );

applyInitCommands( table, sqlStrings );

return sqlStrings.toArray( new String[ sqlStrings.size() ] );
}

protected void applyComments(Table table, List<String> sqlStrings) {
if ( table.getComment() != null ) {
sqlStrings.add( dialect.getTableComment( table.getComment() ) );
protected void applyComments(Table table, QualifiedName tableName, List<String> sqlStrings) {
if ( dialect.supportsCommentOn() ) {
if ( table.getComment() != null ) {
sqlStrings.add( "comment on table " + tableName + " is '" + table.getComment() + "'" );
}
final Iterator iter = table.getColumnIterator();
while ( iter.hasNext() ) {
Column column = (Column) iter.next();
String columnComment = column.getComment();
if ( columnComment != null ) {
sqlStrings.add( "comment on column " + tableName + column.getQuotedName( dialect ) + " is '" + columnComment + "'" );
}
}
}
}

Expand Down

0 comments on commit 8e32162

Please sign in to comment.