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.MySqlPrepareStatement; 17 18 import hunt.sql.ast.SQLExpr; 19 import hunt.sql.ast.SQLName; 20 import hunt.sql.ast.SQLObject; 21 import hunt.sql.dialect.mysql.visitor.MySqlASTVisitor; 22 import hunt.sql.dialect.mysql.ast.statement.MySqlStatementImpl; 23 24 25 import hunt.collection; 26 27 public class MySqlPrepareStatement : MySqlStatementImpl { 28 29 alias accept0 = MySqlStatementImpl.accept0; 30 31 private SQLName name; 32 private SQLExpr from; 33 34 public this(){ 35 } 36 37 public this(SQLName name, SQLExpr from){ 38 this.name = name; 39 this.from = from; 40 } 41 42 public SQLName getName() { 43 return name; 44 } 45 46 public void setName(SQLName name) { 47 this.name = name; 48 } 49 50 public SQLExpr getFrom() { 51 return from; 52 } 53 54 public void setFrom(SQLExpr from) { 55 this.from = from; 56 } 57 58 override public void accept0(MySqlASTVisitor visitor) { 59 if (visitor.visit(this)) { 60 acceptChild(visitor, name); 61 acceptChild(visitor, from); 62 } 63 visitor.endVisit(this); 64 } 65 66 override 67 public List!(SQLObject) getChildren() { 68 List!(SQLObject) children = new ArrayList!(SQLObject)(); 69 if (name !is null) { 70 children.add(name); 71 } 72 if (this.from !is null) { 73 children.add(from); 74 } 75 return children; 76 } 77 }