@@ -45,6 +45,15 @@ public class AlterExpression {
4545
4646 private List <ConstraintState > constraints ;
4747 private List <String > parameters ;
48+ private String commentText ;
49+
50+ public String getCommentText () {
51+ return commentText ;
52+ }
53+
54+ public void setCommentText (String commentText ) {
55+ this .commentText = commentText ;
56+ }
4857
4958 public AlterOperation getOperation () {
5059 return operation ;
@@ -116,7 +125,7 @@ public void addColDataType(ColumnDataType columnDataType) {
116125 }
117126 colDataTypeList .add (columnDataType );
118127 }
119-
128+
120129 public void addColDropNotNull (ColumnDropNotNull columnDropNotNull ) {
121130 if (columnDropNotNullList == null ) {
122131 columnDropNotNullList = new ArrayList <ColumnDropNotNull >();
@@ -242,7 +251,12 @@ public String toString() {
242251
243252 b .append (operation ).append (" " );
244253
245- if (columnName != null ) {
254+ if (commentText != null ) {
255+ if (columnName != null ) {
256+ b .append (columnName ).append (" COMMENT " );
257+ }
258+ b .append (commentText );
259+ } else if (columnName != null ) {
246260 b .append ("COLUMN " );
247261 if (operation == AlterOperation .RENAME ) {
248262 b .append (columnOldName ).append (" TO " );
@@ -263,7 +277,7 @@ public String toString() {
263277 if (colDataTypeList .size () > 1 ) {
264278 b .append (")" );
265279 }
266- } else if ( getColumnDropNotNullList () != null ) {
280+ } else if (getColumnDropNotNullList () != null ) {
267281 if (operation == AlterOperation .CHANGE ) {
268282 if (optionalSpecifier != null ) {
269283 b .append (optionalSpecifier ).append (" " );
@@ -325,6 +339,7 @@ public String toString() {
325339 }
326340
327341 public final static class ColumnDataType extends ColumnDefinition {
342+
328343 private final boolean withType ;
329344
330345 public ColumnDataType (String columnName , boolean withType , ColDataType colDataType , List <String > columnSpecs ) {
@@ -358,8 +373,8 @@ public boolean isWithNot() {
358373
359374 @ Override
360375 public String toString () {
361- return columnName + " DROP" +
362- (withNot ? " NOT " : " " ) + "NULL" ;
376+ return columnName + " DROP"
377+ + (withNot ? " NOT " : " " ) + "NULL" ;
363378 }
364379 }
365380}
0 commit comments