Beispiel #1
0
        /// <returns>argument itself if there is no union</returns>
        /// <exception cref="System.SqlSyntaxErrorException" />
        protected virtual DmlQueryStatement BuildUnionSelect(DmlSelectStatement select)
        {
            if (lexer.Token() != MySqlToken.KwUnion)
            {
                return(select);
            }
            var union = new DmlSelectUnionStatement(select);

            for (; lexer.Token() == MySqlToken.KwUnion;)
            {
                lexer.NextToken();
                var isAll = false;
                switch (lexer.Token())
                {
                case MySqlToken.KwAll:
                {
                    isAll = true;
                    goto case MySqlToken.KwDistinct;
                }

                case MySqlToken.KwDistinct:
                {
                    lexer.NextToken();
                    break;
                }
                }
                select = SelectPrimary();
                union.AddSelect(select, isAll);
            }
            union.SetOrderBy(OrderBy()).SetLimit(Limit());
            return(union);
        }
Beispiel #2
0
 public virtual void Visit(DmlSelectUnionStatement node)
 {
     VisitInternal(node.Limit);
     VisitInternal(node.OrderBy);
     VisitInternal(node.SelectStmtList);
 }
Beispiel #3
0
 public void Visit(DmlSelectUnionStatement node)
 {
     VisitChild(2, false, false, node.OrderBy);
     VisitChild(2, false, false, node.SelectStmtList);
 }