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.SQLLoopStatement; 17 18 19 import hunt.collection; 20 21 import hunt.sql.ast.SQLObject; 22 import hunt.sql.ast.SQLStatement; 23 import hunt.sql.ast.SQLStatementImpl; 24 import hunt.sql.visitor.SQLASTVisitor; 25 26 public class SQLLoopStatement : SQLStatementImpl { 27 28 private string labelName; 29 30 private List!SQLStatement statements; 31 32 this() 33 { 34 statements = new ArrayList!SQLStatement(); 35 } 36 37 override 38 public void accept0(SQLASTVisitor visitor) { 39 if (visitor.visit(this)) { 40 acceptChild!SQLStatement(visitor, statements); 41 } 42 visitor.endVisit(this); 43 } 44 45 public List!SQLStatement getStatements() { 46 return statements; 47 } 48 49 public string getLabelName() { 50 return labelName; 51 } 52 53 public void setLabelName(string labelName) { 54 this.labelName = labelName; 55 } 56 57 public void addStatement(SQLStatement stmt) { 58 if (stmt !is null) { 59 stmt.setParent(this); 60 } 61 statements.add(stmt); 62 } 63 64 override 65 public List!SQLObject getChildren() { 66 return cast(List!SQLObject)statements; 67 } 68 }