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.dialect.mysql.ast.statement.MySqlRenameTableStatement; 17 18 19 import hunt.collection; 20 import hunt.sql.ast.SQLObject; 21 22 import hunt.sql.ast.SQLExpr; 23 import hunt.sql.ast.SQLName; 24 import hunt.sql.dialect.mysql.ast.MySqlObjectImpl; 25 import hunt.sql.dialect.mysql.visitor.MySqlASTVisitor; 26 import hunt.sql.dialect.mysql.ast.statement.MySqlStatementImpl; 27 28 public class MySqlRenameTableStatement : MySqlStatementImpl { 29 30 alias accept0 = MySqlStatementImpl.accept0; 31 32 private List!(Item) items; 33 34 this() 35 { 36 items = new ArrayList!(Item)(2); 37 } 38 39 public List!(Item) getItems() { 40 return items; 41 } 42 43 public void addItem(Item item) { 44 if (item !is null) { 45 item.setParent(this); 46 } 47 this.items.add(item); 48 } 49 50 override public void accept0(MySqlASTVisitor visitor) { 51 if (visitor.visit(this)) { 52 acceptChild(visitor, cast(List!(SQLObject))items); 53 } 54 visitor.endVisit(this); 55 } 56 57 public static class Item : MySqlObjectImpl { 58 59 alias accept0 = MySqlObjectImpl.accept0; 60 61 private SQLName name; 62 private SQLName to; 63 64 public SQLName getName() { 65 return name; 66 } 67 68 public void setName(SQLName name) { 69 this.name = name; 70 } 71 72 public SQLName getTo() { 73 return to; 74 } 75 76 public void setTo(SQLName to) { 77 this.to = to; 78 } 79 80 override 81 public void accept0(MySqlASTVisitor visitor) { 82 if (visitor.visit(this)) { 83 acceptChild(visitor, name); 84 acceptChild(visitor, to); 85 } 86 visitor.endVisit(this); 87 } 88 89 } 90 }