001package gudusoft.gsqlparser.stmt.teradata; 002 003 004import gudusoft.gsqlparser.*; 005import gudusoft.gsqlparser.nodes.*; 006import gudusoft.gsqlparser.nodes.teradata.TCollectColumnIndex; 007 008import java.util.ArrayList; 009 010public class TTeradataCollectStatistics extends TCustomSqlStatement { 011 012 private TTable table = null; 013 014 private TObjectName tableName = null; 015 016 public TTeradataCollectStatistics(EDbVendor dbvendor) { 017 super(dbvendor); 018 sqlstatementtype = ESqlStatementType.sstteradatacollectstatistics; 019 } 020 021 public TObjectName getTableName() { 022 return tableName; 023 } 024 025 026 027 private ArrayList<TCollectColumnIndex> columnIndexList; 028 public ArrayList<TCollectColumnIndex> getColumnIndexList() { 029 return columnIndexList; 030 } 031 032 public int doParseStatement(TCustomSqlStatement psql) { 033 if (rootNode == null) return -1; 034 super.doParseStatement(psql); 035 TCollectStatisticsSqlNode collectStatisticsSqlNode = (TCollectStatisticsSqlNode)rootNode; 036 tableName = collectStatisticsSqlNode.getTableName(); 037 038 table = new TTable(); 039 table.setTableName(tableName); 040 table.setTableType(ETableSource.objectname); 041 tables.addTable(table); 042 043 columnIndexList = collectStatisticsSqlNode.getColumnIndexList(); 044 if (columnIndexList != null){ 045 for(int i=0;i<columnIndexList.size();i++){ 046 columnIndexList.get(i).doParse(this,ESqlClause.index); 047 } 048 } 049 050 051 return 0; 052 } 053 054 public void accept(TParseTreeVisitor v){ 055 v.preVisit(this); 056 v.postVisit(this); 057 } 058 059 public void acceptChildren(TParseTreeVisitor v){ 060 v.preVisit(this); 061 if (columnIndexList != null) { 062 for(TCollectColumnIndex collectColumnIndex:columnIndexList){ 063 collectColumnIndex.acceptChildren(v); 064 } 065 } 066 v.postVisit(this); 067 } 068 069 public void setTable(TTable table) { 070 this.table = table; 071 } 072 073 public void setTableName(TObjectName tableName) { 074 this.tableName = tableName; 075 } 076 077 public void setColumnIndexList(ArrayList<TCollectColumnIndex> columnIndexList) { 078 this.columnIndexList = columnIndexList; 079 } 080}