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.SQLAlterDatabaseStatement;
17 
18 import hunt.sql.ast.SQLName;
19 import hunt.sql.ast.SQLObject;
20 import hunt.sql.ast.SQLStatementImpl;
21 import hunt.sql.visitor.SQLASTVisitor;
22 import hunt.sql.ast.statement.SQLAlterStatement;
23 import hunt.sql.ast.statement.SQLAlterCharacter;
24 
25 import hunt.collection;
26 
27 public class SQLAlterDatabaseStatement : SQLStatementImpl , SQLAlterStatement {
28 
29     private SQLName name;
30 
31     private bool upgradeDataDirectoryName;
32 
33     private SQLAlterCharacter character;
34     
35     public this() {
36         
37     }
38     
39     public this(string dbType) {
40         this.setDbType(dbType);
41     }
42 
43     public SQLName getName() {
44         return name;
45     }
46 
47     public void setName(SQLName name) {
48         if (name !is null) {
49             name.setParent(this);
50         }
51         this.name = name;
52     }
53 
54     public SQLAlterCharacter getCharacter() {
55         return character;
56     }
57 
58     public void setCharacter(SQLAlterCharacter character) {
59         if (character !is null) {
60             character.setParent(this);
61         }
62         this.character = character;
63     }
64 
65     public bool isUpgradeDataDirectoryName() {
66         return upgradeDataDirectoryName;
67     }
68 
69     public void setUpgradeDataDirectoryName(bool upgradeDataDirectoryName) {
70         this.upgradeDataDirectoryName = upgradeDataDirectoryName;
71     }
72 
73     override  protected void accept0(SQLASTVisitor visitor) {
74         if (visitor.visit(this)) {
75             acceptChild(visitor, name);
76         }
77         visitor.endVisit(this);
78     }
79 
80     override
81     public List!SQLObject getChildren() {
82         return Collections.singletonList!SQLObject(name);
83     }
84 }