1 /*
2  * Copyright 2015-2018 HuntLabs.cn
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 module hunt.sql.ast.statement.SQLAlterTableAlterColumn;
18 
19 import hunt.sql.ast.SQLDataType;
20 import hunt.sql.ast.SQLExpr;
21 import hunt.sql.ast.SQLName;
22 import hunt.sql.ast.SQLObjectImpl;
23 import hunt.sql.visitor.SQLASTVisitor;
24 import hunt.sql.ast.statement.SQLAlterTableItem;
25 import hunt.sql.ast.statement.SQLColumnDefinition;
26 
27 
28 public class SQLAlterTableAlterColumn : SQLObjectImpl , SQLAlterTableItem {
29     private SQLName             originColumn;
30     private SQLColumnDefinition column;
31     private bool             setNotNull;
32     private bool             dropNotNull;
33     private SQLExpr             setDefault;
34     private bool             dropDefault;
35     private SQLDataType         dataType;
36 
37     override  protected void accept0(SQLASTVisitor visitor) {
38         if (visitor.visit(this)) {
39             acceptChild(visitor, column);
40             acceptChild(visitor, setDefault);
41         }
42         visitor.endVisit(this);
43     }
44 
45     public SQLColumnDefinition getColumn() {
46         return column;
47     }
48 
49     public void setColumn(SQLColumnDefinition column) {
50         this.column = column;
51     }
52 
53     public bool isSetNotNull() {
54         return setNotNull;
55     }
56 
57     public void setSetNotNull(bool setNotNull) {
58         this.setNotNull = setNotNull;
59     }
60 
61     public bool isDropNotNull() {
62         return dropNotNull;
63     }
64 
65     public void setDropNotNull(bool dropNotNull) {
66         this.dropNotNull = dropNotNull;
67     }
68 
69     public SQLExpr getSetDefault() {
70         return setDefault;
71     }
72 
73     public void setSetDefault(SQLExpr setDefault) {
74         this.setDefault = setDefault;
75     }
76 
77     public bool isDropDefault() {
78         return dropDefault;
79     }
80 
81     public void setDropDefault(bool dropDefault) {
82         this.dropDefault = dropDefault;
83     }
84 
85     public SQLName getOriginColumn() {
86         return originColumn;
87     }
88 
89     public void setOriginColumn(SQLName x) {
90         if (x !is null) {
91             x.setParent(this);
92         }
93         this.originColumn = x;
94     }
95 
96     public SQLDataType getDataType() {
97         return dataType;
98     }
99 
100     public void setDataType(SQLDataType x) {
101         if (x !is null) {
102             x.setParent(this);
103         }
104         this.dataType = x;
105     }
106 }