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.SQLPrimaryKeyImpl;
17 
18 import hunt.sql.visitor.SQLASTVisitor;
19 import hunt.sql.ast.statement.SQLUnique;
20 import hunt.sql.ast.statement.SQLPrimaryKey;
21 import hunt.collection;
22 import hunt.sql.ast.SQLObject;
23 import hunt.sql.ast.statement.SQLSelectOrderByItem;
24 
25 public class SQLPrimaryKeyImpl : SQLUnique , SQLPrimaryKey {
26 
27     alias cloneTo = SQLUnique.cloneTo;
28 
29     protected bool clustered         = false; // sql server
30 
31     
32     override  protected void accept0(SQLASTVisitor visitor) {
33         if (visitor.visit(this)) {
34             acceptChild(visitor, this.getName());
35             acceptChild!SQLSelectOrderByItem(visitor, this.getColumns());
36         }
37         visitor.endVisit(this);
38     }
39 
40     override public SQLPrimaryKeyImpl clone() {
41         SQLPrimaryKeyImpl x = new SQLPrimaryKeyImpl();
42         cloneTo(x);
43         return x;
44     }
45 
46     public void cloneTo(SQLPrimaryKeyImpl x) {
47         super.cloneTo(x);
48         x.clustered = clustered;
49     }
50 
51     public bool isClustered() {
52         return clustered;
53     }
54 
55     public void setClustered(bool clustered) {
56         this.clustered = clustered;
57     }
58 }