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.SQLDropDatabaseStatement;
17 
18 import hunt.sql.ast.SQLExpr;
19 import hunt.sql.ast.SQLObject;
20 import hunt.sql.ast.SQLStatementImpl;
21 import hunt.sql.visitor.SQLASTVisitor;
22 import hunt.sql.ast.statement.SQLDropStatement;
23 
24 
25 import hunt.collection;
26 
27 public class SQLDropDatabaseStatement : SQLStatementImpl , SQLDropStatement {
28 
29     private SQLExpr database;
30     private bool ifExists;
31     
32     public this() {
33         
34     }
35     
36     public this(string dbType) {
37         super (dbType);
38     }
39 
40     
41     override  protected void accept0(SQLASTVisitor visitor) {
42         if (visitor.visit(this)) {
43             acceptChild(visitor, database);
44         }
45         visitor.endVisit(this);
46     }
47 
48     public SQLExpr getDatabase() {
49         return database;
50     }
51 
52     public void setDatabase(SQLExpr database) {
53         if (database !is null) {
54             database.setParent(this);
55         }
56         this.database = database;
57     }
58 
59     public bool isIfExists() {
60         return ifExists;
61     }
62 
63     public void setIfExists(bool ifExists) {
64         this.ifExists = ifExists;
65     }
66 
67     override
68     public List!SQLObject getChildren() {
69         List!SQLObject children = new ArrayList!SQLObject();
70         if (database !is null) {
71             children.add(database);
72         }
73         return children;
74     }
75 
76 }