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.SQLDescribeStatement; 17 18 import hunt.sql.ast.SQLExpr; 19 import hunt.sql.ast.SQLName; 20 import hunt.sql.ast.SQLObject; 21 import hunt.sql.ast.SQLStatementImpl; 22 import hunt.sql.visitor.SQLASTVisitor; 23 import hunt.sql.ast.statement.SQLObjectType; 24 25 26 import hunt.collection; 27 28 public class SQLDescribeStatement : SQLStatementImpl { 29 30 protected SQLName object; 31 32 protected SQLName column; 33 34 // for odps 35 protected SQLObjectType objectType; 36 protected List!SQLExpr partition; 37 38 this() 39 { 40 partition = new ArrayList!SQLExpr(); 41 } 42 43 public SQLName getObject() { 44 return object; 45 } 46 47 public void setObject(SQLName object) { 48 this.object = object; 49 } 50 51 public SQLName getColumn() { 52 return column; 53 } 54 55 public void setColumn(SQLName column) { 56 if (column !is null) { 57 column.setParent(this); 58 } 59 this.column = column; 60 } 61 62 public List!SQLExpr getPartition() { 63 return partition; 64 } 65 66 public void setPartition(List!SQLExpr partition) { 67 this.partition = partition; 68 } 69 70 public SQLObjectType getObjectType() { 71 return objectType; 72 } 73 74 public void setObjectType(SQLObjectType objectType) { 75 this.objectType = objectType; 76 } 77 78 79 override protected void accept0(SQLASTVisitor visitor) { 80 if (visitor.visit(this)) { 81 acceptChild(visitor, object); 82 acceptChild(visitor, column); 83 } 84 visitor.endVisit(this); 85 } 86 87 override 88 public List!SQLObject getChildren() { 89 // return Arrays.asList(this.object, column); 90 List!SQLObject ls = new ArrayList!SQLObject(); 91 ls.add(this.object); 92 ls.add(column); 93 return ls; 94 } 95 }