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.SQLCreateDatabaseStatement;
17 
18 import hunt.collection;
19 
20 import hunt.sql.ast.SQLCommentHint;
21 import hunt.sql.ast.SQLName;
22 import hunt.sql.ast.SQLObject;
23 import hunt.sql.ast.SQLStatementImpl;
24 import hunt.sql.visitor.SQLASTVisitor;
25 import hunt.sql.ast.statement.SQLCreateStatement;
26 
27 public class SQLCreateDatabaseStatement : SQLStatementImpl , SQLCreateStatement {
28 
29     private SQLName              name;
30 
31     private string               characterSet;
32     private string               collate;
33 
34     private List!SQLCommentHint hints;
35     
36     protected bool            ifNotExists = false;
37 
38     public this(){
39     }
40     
41     public this(string dbType){
42         super (dbType);
43     }
44 
45     
46     override  protected void accept0(SQLASTVisitor visitor) {
47         if (visitor.visit(this)) {
48             acceptChild(visitor, name);
49         }
50         visitor.endVisit(this);
51     }
52 
53     override
54     public List!SQLObject getChildren() {
55         List!SQLObject children = new ArrayList!SQLObject();
56         if (name !is null) {
57             children.add(name);
58         }
59         return children;
60     }
61 
62     public SQLName getName() {
63         return name;
64     }
65 
66     public void setName(SQLName name) {
67         this.name = name;
68     }
69 
70     public string getCharacterSet() {
71         return characterSet;
72     }
73 
74     public void setCharacterSet(string characterSet) {
75         this.characterSet = characterSet;
76     }
77 
78     public string getCollate() {
79         return collate;
80     }
81 
82     public void setCollate(string collate) {
83         this.collate = collate;
84     }
85 
86     public List!SQLCommentHint getHints() {
87         return hints;
88     }
89 
90     public void setHints(List!SQLCommentHint hints) {
91         this.hints = hints;
92     }
93     
94     public bool isIfNotExists() {
95         return ifNotExists;
96     }
97     
98     public void setIfNotExists(bool ifNotExists) {
99         this.ifNotExists = ifNotExists;
100     }
101 
102 }