Inheritance: IAstNode
 /// <exception cref="System.SqlSyntaxErrorException" />
 public DmlSelectStatement(SelectOption option,
                           IList<Pair<IExpression, string>> selectExprList,
                           TableReferences tables,
                           IExpression where,
                           GroupBy group,
                           IExpression having,
                           OrderBy order,
                           Limit limit)
 {
     if (option == null)
     {
         throw new ArgumentException("argument 'option' is null");
     }
     Option = option;
     if (selectExprList == null || selectExprList.IsEmpty())
     {
         this.selectExprList = new List<Pair<IExpression, string>>(0);
     }
     else
     {
         this.selectExprList = EnsureListType(selectExprList);
     }
     Tables = tables;
     Where = where;
     Group = group;
     Having = having;
     Order = order;
     Limit = limit;
 }
        public DmlUpdateStatement(bool lowPriority,
                                  bool ignore,
                                  TableReferences tableRefs,
                                  IList<Pair<Identifier, IExpression>> values,
                                  IExpression where, OrderBy orderBy,
                                  Limit limit)
        {
            IsLowPriority = lowPriority;
            IsIgnore = ignore;
            if (tableRefs == null)
            {
                throw new ArgumentException("argument tableRefs is null for update stmt");
            }

            TableRefs = tableRefs;
            if (values == null || values.Count <= 0)
            {
                Values = new List<Pair<Identifier, IExpression>>(0);
            }
            else
            {
                if (!(values is List<Pair<Identifier, IExpression>>))
                {
                    Values = new List<Pair<Identifier, IExpression>>(values);
                }
                else
                {
                    Values = values;
                }
            }
            Where = where;
            OrderBy = orderBy;
            Limit = limit;
        }
 /// <exception cref="System.SqlSyntaxErrorException" />
 public DmlDeleteStatement(bool lowPriority,
                           bool quick,
                           bool ignore,
                           Identifier tableName,
                           IExpression where,
                           OrderBy orderBy,
                           Limit limit)
 {
     // ------- single-row delete------------
     IsLowPriority = lowPriority;
     IsQuick = quick;
     IsIgnore = ignore;
     tableNames = new List<Identifier>(1);
     tableNames.Add(tableName);
     TableRefs = null;
     WhereCondition = where;
     OrderBy = orderBy;
     Limit = limit;
 }
 public virtual DmlSelectUnionStatement SetOrderBy(OrderBy orderBy)
 {
     this.orderBy = orderBy;
     return this;
 }
 public virtual void Visit(OrderBy node)
 {
     VisitInternal(node.OrderByList);
 }
        /// <summary>nothing has been pre-consumed</summary>
        /// <returns>null if there is no order by</returns>
        /// <exception cref="System.SqlSyntaxErrorException" />
        protected internal virtual OrderBy OrderBy()
        {
            if (lexer.Token() != MySqlToken.KwOrder)
            {
                return null;
            }
            lexer.NextToken();
            Match(MySqlToken.KwBy);
            var expr = exprParser.Expression();
            var order = SortOrder.Asc;
            OrderBy orderBy;
            switch (lexer.Token())
            {
                case MySqlToken.KwDesc:
                {
                    order = SortOrder.Desc;
                    goto case MySqlToken.KwAsc;
                }

                case MySqlToken.KwAsc:
                {
                    if (lexer.NextToken() != MySqlToken.PuncComma)
                    {
                        return new OrderBy(expr, order);
                    }
                    goto case MySqlToken.PuncComma;
                }

                case MySqlToken.PuncComma:
                {
                    orderBy = new OrderBy();
                    orderBy.AddOrderByItem(expr, order);
                    break;
                }

                default:
                {
                    return new OrderBy(expr, order);
                }
            }
            for (; lexer.Token() == MySqlToken.PuncComma;)
            {
                lexer.NextToken();
                order = SortOrder.Asc;
                expr = exprParser.Expression();
                switch (lexer.Token())
                {
                    case MySqlToken.KwDesc:
                    {
                        order = SortOrder.Desc;
                        goto case MySqlToken.KwAsc;
                    }

                    case MySqlToken.KwAsc:
                    {
                        lexer.NextToken();
                        break;
                    }
                }
                orderBy.AddOrderByItem(expr, order);
            }
            return orderBy;
        }