public void Add(string op, SelectStmt newstmt) { List <string> allowed = new List <string> { "union", "unionall", "except", "exceptall", "intersect", "intersectall" }; Debug.Assert(allowed.Contains(op) || op is null); Debug.Assert(newstmt != null); if (IsLeaf()) { left_ = new SetOpTree(stmt_); stmt_ = null; right_ = new SetOpTree(newstmt); op_ = op; } else { left_ = (SetOpTree)this.MemberwiseClone(); right_ = new SetOpTree(newstmt); op_ = op; } Debug.Assert(!IsLeaf()); }
public SelectStmt( // setops ok fields List <Expr> selection, List <TableRef> from, Expr where, List <Expr> groupby, Expr having, // top query only fields List <CteExpr> ctes, SetOpTree setqs, List <OrderTerm> orders, Expr limit, string text) : base(text) { selection_ = selection; from_ = from; where_ = where; having_ = having; groupby_ = groupby; ctes_ = ctes; setops_ = setqs; if (orders != null) { orders_ = (from x in orders select x.orderby_()).ToList(); descends_ = (from x in orders select x.descend_).ToList(); } limit_ = limit; }