Esempio n. 1
0
        private void DumpUnionGroupInfo(StringBuilder stringBuilder, string indent, UnionGroup unionGroup)
        {
            QueryBase[] children = GetUnionChildren(unionGroup);

            foreach (QueryBase child in children)
            {
                if (stringBuilder.Length > 0)
                {
                    stringBuilder.AppendLine("<br />");
                }

                if (child is UnionSubQuery)
                {
                    // UnionSubQuery is a leaf node of query structure.
                    // It represent a single SELECT statement in the tree of unions
                    DumpUnionSubQueryInfo(stringBuilder, indent, (UnionSubQuery)child);
                }
                else
                {
                    // UnionGroup is a tree node.
                    // It contains one or more leafs of other tree nodes.
                    // It represent a root of the subquery of the union tree or a
                    // parentheses in the union tree.
                    unionGroup = (UnionGroup)child;

                    stringBuilder.AppendLine(indent + unionGroup.UnionOperatorFull + "group: [");
                    DumpUnionGroupInfo(stringBuilder, indent + "&nbsp;&nbsp;&nbsp;&nbsp;", unionGroup);
                    stringBuilder.AppendLine(indent + "]<br />");
                }
            }
        }
Esempio n. 2
0
        private QueryBase[] GetUnionChildren(UnionGroup unionGroup)
        {
            ArrayList result = new ArrayList();

            for (int i = 0; i < unionGroup.Count; i++)
            {
                result.Add(unionGroup[i]);
            }

            return((QueryBase[])result.ToArray(typeof(QueryBase)));
        }
        private static IEnumerable <QueryBase> GetUnionChildren(UnionGroup unionGroup)
        {
            var result = new ArrayList();

            for (var i = 0; i < unionGroup.Count; i++)
            {
                result.Add(unionGroup[i]);
            }

            return((QueryBase[])result.ToArray(typeof(QueryBase)));
        }
 private void ReplaceWhereInGroup(UnionGroup unionGroup, string newWhere)
 {
     for (int i = 0; i < unionGroup.Count; i++)
     {
         if (unionGroup[i] is UnionGroup)
         {
             ReplaceWhereInGroup((UnionGroup)unionGroup[i], newWhere);
         }
         else
         {
             Debug.Assert(unionGroup[i] is UnionSubQuery);
             ReplaceWhereAccess((UnionSubQuery)unionGroup[i], newWhere);
         }
     }
 }