001package gudusoft.gsqlparser.stmt.oceanbase; 002 003import gudusoft.gsqlparser.EDbVendor; 004import gudusoft.gsqlparser.ESqlStatementType; 005import gudusoft.gsqlparser.TCustomSqlStatement; 006import gudusoft.gsqlparser.nodes.TObjectName; 007import gudusoft.gsqlparser.nodes.TObjectNameList; 008import gudusoft.gsqlparser.nodes.TParseTreeVisitor; 009import gudusoft.gsqlparser.nodes.TPartitionDefinition; 010import gudusoft.gsqlparser.nodes.oceanbase.TOceanbaseAlterTablegroupSqlNode; 011import gudusoft.gsqlparser.nodes.oceanbase.TOceanbaseTablegroupOption; 012 013import java.util.ArrayList; 014 015/** 016 * OceanBase {@code ALTER TABLEGROUP} statement (Phase 4 Batch 6). 017 * 018 * <p>Tagged {@link ESqlStatementType#sstoceanbase_alter_tablegroup}. 019 * 020 * @since 4.0.1.4 021 */ 022public class TAlterTablegroupSqlStatement extends TCustomSqlStatement { 023 024 private TOceanbaseAlterTablegroupSqlNode.EAction action = 025 TOceanbaseAlterTablegroupSqlNode.EAction.SET_OPTIONS; 026 private TObjectName tablegroupName; 027 private ArrayList<TOceanbaseTablegroupOption> tablegroupOptions 028 = new ArrayList<TOceanbaseTablegroupOption>(); 029 private TObjectNameList addTableList; 030 private ArrayList<TPartitionDefinition> addPartitionDefinitions; 031 private TObjectNameList partitionNameList; 032 033 public TAlterTablegroupSqlStatement(EDbVendor dbvendor) { 034 super(dbvendor); 035 this.sqlstatementtype = ESqlStatementType.sstoceanbase_alter_tablegroup; 036 } 037 038 public TOceanbaseAlterTablegroupSqlNode.EAction getAction() { 039 return action; 040 } 041 042 public TObjectName getTablegroupName() { 043 return tablegroupName; 044 } 045 046 public ArrayList<TOceanbaseTablegroupOption> getTablegroupOptions() { 047 return tablegroupOptions; 048 } 049 050 public TObjectNameList getAddTableList() { 051 return addTableList; 052 } 053 054 public ArrayList<TPartitionDefinition> getAddPartitionDefinitions() { 055 return addPartitionDefinitions; 056 } 057 058 public TObjectNameList getPartitionNameList() { 059 return partitionNameList; 060 } 061 062 @Override 063 public int doParseStatement(TCustomSqlStatement psql) { 064 if (rootNode == null) return -1; 065 super.doParseStatement(psql); 066 TOceanbaseAlterTablegroupSqlNode node = 067 (TOceanbaseAlterTablegroupSqlNode) rootNode; 068 this.action = node.getAction(); 069 this.tablegroupName = node.getTablegroupName(); 070 this.tablegroupOptions = node.getTablegroupOptions(); 071 this.addTableList = node.getAddTableList(); 072 this.addPartitionDefinitions = node.getAddPartitionDefinitions(); 073 this.partitionNameList = node.getPartitionNameList(); 074 return 0; 075 } 076 077 @Override 078 public void accept(TParseTreeVisitor v) { 079 v.preVisit(this); 080 v.postVisit(this); 081 } 082 083 @Override 084 public void acceptChildren(TParseTreeVisitor v) { 085 v.preVisit(this); 086 v.postVisit(this); 087 } 088}