001package gudusoft.gsqlparser.nodes; 002 003import gudusoft.gsqlparser.ESqlClause; 004import gudusoft.gsqlparser.TCustomSqlStatement; 005 006/** 007 * The ROLLUP operation in the simple_grouping_clause groups the selected rows based on the values of the first n, n-1, n-2, ... 0 expressions in the GROUP 008 * BY specification, and returns a single row of summary for each group. 009 * 010 * <p>The CUBE operation in the simple_grouping_clause groups the selected rows based on the values of all possible combinations of expressions in the specification. 011 * It returns a single row of summary information for each group. 012*/ 013public class TRollupCube extends TParseTreeNode { 014 015 public final static int rollup = 1; 016 public final static int cube = 2; 017 public final static int grouping_sets = 3; 018 019 private int operation = rollup; 020 021 public void setOperation(int operation) { 022 this.operation = operation; 023 } 024 025 /** 026 * @return rollup or cube operation. 027 */ 028 public int getOperation() { 029 030 return operation; 031 } 032 033 /** 034 * 035 * @return grouping expression list 036 * @see TExpressionList 037 */ 038 public TExpressionList getItems() { 039 return items; 040 } 041 042 private TExpressionList items = null; 043 044 public void init(Object arg1) 045 { 046 items = (TExpressionList)arg1; 047 } 048 049 public void doParse(TCustomSqlStatement psql, ESqlClause plocation){ 050 if (items != null){ 051 items.doParse(psql,plocation); 052 } 053 } 054 055 public void accept(TParseTreeVisitor v){ 056 v.preVisit(this); 057 v.postVisit(this); 058 } 059 060 public void acceptChildren(TParseTreeVisitor v){ 061 v.preVisit(this); 062 v.postVisit(this); 063 } 064 065 public void setItems(TExpressionList items) { 066 this.items = items; 067 } 068}