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.SQLExplainStatement; 17 18 19 import hunt.collection; 20 21 import hunt.sql.ast.SQLCommentHint; 22 import hunt.sql.ast.SQLObject; 23 import hunt.sql.ast.SQLStatement; 24 import hunt.sql.ast.SQLStatementImpl; 25 import hunt.sql.visitor.SQLASTVisitor; 26 27 public class SQLExplainStatement : SQLStatementImpl { 28 private string type; 29 protected SQLStatement statement; 30 private List!SQLCommentHint hints; 31 32 public this() { 33 34 } 35 36 public this(string dbType) { 37 super (dbType); 38 } 39 40 public SQLStatement getStatement() { 41 return statement; 42 } 43 44 public void setStatement(SQLStatement statement) { 45 if (statement !is null) { 46 statement.setParent(this); 47 } 48 this.statement = statement; 49 } 50 51 public string getType() { 52 return type; 53 } 54 55 public void setType(string type) { 56 this.type = type; 57 } 58 59 60 override protected void accept0(SQLASTVisitor visitor) { 61 if (visitor.visit(this)) { 62 acceptChild(visitor, statement); 63 } 64 visitor.endVisit(this); 65 } 66 67 public List!SQLCommentHint getHints() { 68 return hints; 69 } 70 71 public void setHints(List!SQLCommentHint hints) { 72 this.hints = hints; 73 } 74 75 override 76 public List!SQLObject getChildren() { 77 List!SQLObject children = new ArrayList!SQLObject(); 78 if (statement !is null) { 79 children.add(statement); 80 } 81 return children; 82 } 83 }