@@ -45,6 +45,15 @@ public class AlterExpression {
45
45
46
46
private List <ConstraintState > constraints ;
47
47
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
+ }
48
57
49
58
public AlterOperation getOperation () {
50
59
return operation ;
@@ -116,7 +125,7 @@ public void addColDataType(ColumnDataType columnDataType) {
116
125
}
117
126
colDataTypeList .add (columnDataType );
118
127
}
119
-
128
+
120
129
public void addColDropNotNull (ColumnDropNotNull columnDropNotNull ) {
121
130
if (columnDropNotNullList == null ) {
122
131
columnDropNotNullList = new ArrayList <ColumnDropNotNull >();
@@ -242,7 +251,12 @@ public String toString() {
242
251
243
252
b .append (operation ).append (" " );
244
253
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 ) {
246
260
b .append ("COLUMN " );
247
261
if (operation == AlterOperation .RENAME ) {
248
262
b .append (columnOldName ).append (" TO " );
@@ -263,7 +277,7 @@ public String toString() {
263
277
if (colDataTypeList .size () > 1 ) {
264
278
b .append (")" );
265
279
}
266
- } else if ( getColumnDropNotNullList () != null ) {
280
+ } else if (getColumnDropNotNullList () != null ) {
267
281
if (operation == AlterOperation .CHANGE ) {
268
282
if (optionalSpecifier != null ) {
269
283
b .append (optionalSpecifier ).append (" " );
@@ -325,6 +339,7 @@ public String toString() {
325
339
}
326
340
327
341
public final static class ColumnDataType extends ColumnDefinition {
342
+
328
343
private final boolean withType ;
329
344
330
345
public ColumnDataType (String columnName , boolean withType , ColDataType colDataType , List <String > columnSpecs ) {
@@ -358,8 +373,8 @@ public boolean isWithNot() {
358
373
359
374
@ Override
360
375
public String toString () {
361
- return columnName + " DROP" +
362
- (withNot ? " NOT " : " " ) + "NULL" ;
376
+ return columnName + " DROP"
377
+ + (withNot ? " NOT " : " " ) + "NULL" ;
363
378
}
364
379
}
365
380
}
0 commit comments