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.SQLUseStatement; 17 18 import hunt.sql.ast.SQLName; 19 import hunt.sql.ast.SQLObject; 20 import hunt.sql.ast.SQLStatement; 21 import hunt.sql.ast.SQLStatementImpl; 22 import hunt.sql.visitor.SQLASTVisitor; 23 24 import hunt.collection; 25 26 public class SQLUseStatement : SQLStatementImpl { 27 28 private SQLName database; 29 30 public this() { 31 32 } 33 34 public this(string dbType) { 35 super (dbType); 36 } 37 38 public SQLName getDatabase() { 39 return database; 40 } 41 42 public void setDatabase(SQLName database) { 43 this.database = database; 44 } 45 46 override 47 public void accept0(SQLASTVisitor visitor) { 48 if (visitor.visit(this)) { 49 acceptChild(visitor, database); 50 } 51 visitor.endVisit(this); 52 } 53 54 override 55 public List!SQLObject getChildren() { 56 return Collections.singletonList!SQLObject(database); 57 } 58 }