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