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.SQLAlterTableDiscardPartition;
17 
18 import hunt.collection;
19 
20 import hunt.sql.ast.SQLName;
21 import hunt.sql.ast.SQLObjectImpl;
22 import hunt.sql.visitor.SQLASTVisitor;
23 import hunt.sql.ast.statement.SQLAlterTableItem;
24 import hunt.sql.ast.SQLObject;
25 
26 public class SQLAlterTableDiscardPartition : SQLObjectImpl , SQLAlterTableItem {
27 
28     private List!SQLName partitions;
29     private bool tablespace;
30 
31     this()
32     {
33         partitions = new ArrayList!SQLName(4);
34     }
35 
36     public List!SQLName getPartitions() {
37         return partitions;
38     }
39     
40     public void addPartition(SQLName partition) {
41         if (partition !is null) {
42             partition.setParent(this);
43         }
44         this.partitions.add(partition);
45     }
46 
47     override  protected void accept0(SQLASTVisitor visitor) {
48         if (visitor.visit(this)) {
49             acceptChild!SQLName(visitor, partitions);
50         }
51         visitor.endVisit(this);
52     }
53 
54     public bool isTablespace() {
55         return tablespace;
56     }
57 
58     public void setTablespace(bool tablespace) {
59         this.tablespace = tablespace;
60     }
61 }