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 module hunt.sql.ast.statement.SQLAlterTableAddConstraint;
17 
18 import hunt.sql.ast.SQLObjectImpl;
19 import hunt.sql.visitor.SQLASTVisitor;
20 import hunt.sql.ast.statement.SQLAlterTableItem;
21 import hunt.sql.ast.statement.SQLConstraint;
22 
23 
24 public class SQLAlterTableAddConstraint : SQLObjectImpl , SQLAlterTableItem {
25 
26     private SQLConstraint constraint;
27     private bool      withNoCheck = false;
28 
29     public this(){
30 
31     }
32 
33     public this(SQLConstraint constraint){
34         this.setConstraint(constraint);
35     }
36 
37     override  protected void accept0(SQLASTVisitor visitor) {
38         if (visitor.visit(this)) {
39             acceptChild(visitor, constraint);
40         }
41         visitor.endVisit(this);
42     }
43 
44     public SQLConstraint getConstraint() {
45         return constraint;
46     }
47 
48     public void setConstraint(SQLConstraint constraint) {
49         if (constraint !is null) {
50             constraint.setParent(this);
51         }
52         this.constraint = constraint;
53     }
54 
55     public bool isWithNoCheck() {
56         return withNoCheck;
57     }
58 
59     public void setWithNoCheck(bool withNoCheck) {
60         this.withNoCheck = withNoCheck;
61     }
62 
63 }