コード例 #1
0
        internal override StringBuilder AsEsql(
            StringBuilder builder,
            bool isTopLevel,
            int indentLevel)
        {
            StringUtil.IndentNewLine(builder, indentLevel);
            builder.Append("SELECT ");
            this.GenerateProjectionEsql(builder, (string)null, false, indentLevel, isTopLevel);
            StringUtil.IndentNewLine(builder, indentLevel);
            builder.Append("FROM ");
            int num = 0;

            foreach (CqlBlock child in this.Children)
            {
                if (num > 0)
                {
                    StringUtil.IndentNewLine(builder, indentLevel + 1);
                    builder.Append(OpCellTreeNode.OpToEsql(this.m_opType));
                }
                builder.Append(" (");
                child.AsEsql(builder, false, indentLevel + 1);
                builder.Append(") AS ").Append(child.CqlAlias);
                if (num > 0)
                {
                    StringUtil.IndentNewLine(builder, indentLevel + 1);
                    builder.Append("ON ");
                    this.m_onClauses[num - 1].AsEsql(builder);
                }
                ++num;
            }
            return(builder);
        }
コード例 #2
0
        internal override StringBuilder AsEsql(StringBuilder builder, bool isTopLevel, int indentLevel)
        {
            // The SELECT part.
            StringUtil.IndentNewLine(builder, indentLevel);
            builder.Append("SELECT ");
            GenerateProjectionEsql(
                builder,
                null,

                /* There is no single input, so the blockAlias is null. ProjectedSlot objects will have to carry their own input block info:
                 * see QualifiedSlot and QualifiedCellIdBoolean for more info. */
                false,
                indentLevel,
                isTopLevel);
            StringUtil.IndentNewLine(builder, indentLevel);

            // The FROM part by joining all the children using ON Clauses.
            builder.Append("FROM ");
            var i = 0;

            foreach (var child in Children)
            {
                if (i > 0)
                {
                    StringUtil.IndentNewLine(builder, indentLevel + 1);
                    builder.Append(OpCellTreeNode.OpToEsql(m_opType));
                }
                builder.Append(" (");
                child.AsEsql(builder, false, indentLevel + 1);
                builder.Append(") AS ")
                .Append(child.CqlAlias);

                // The ON part.
                if (i > 0)
                {
                    StringUtil.IndentNewLine(builder, indentLevel + 1);
                    builder.Append("ON ");
                    m_onClauses[i - 1].AsEsql(builder);
                }
                i++;
            }
            return(builder);
        }
コード例 #3
0
        internal override StringBuilder AsEsql(
            StringBuilder builder,
            bool isTopLevel,
            int indentLevel)
        {
            bool flag = true;

            foreach (CqlBlock child in this.Children)
            {
                if (!flag)
                {
                    StringUtil.IndentNewLine(builder, indentLevel + 1);
                    builder.Append(OpCellTreeNode.OpToEsql(CellTreeOpType.Union));
                }
                flag = false;
                builder.Append(" (");
                child.AsEsql(builder, isTopLevel, indentLevel + 1);
                builder.Append(')');
            }
            return(builder);
        }
コード例 #4
0
        internal override StringBuilder AsEsql(StringBuilder builder, bool isTopLevel, int indentLevel)
        {
            Debug.Assert(this.Children.Count > 0, "UnionCqlBlock: Children collection must not be empty");

            // Simply get the Cql versions of the children and add the union operator between them.
            bool isFirst = true;

            foreach (CqlBlock child in Children)
            {
                if (false == isFirst)
                {
                    StringUtil.IndentNewLine(builder, indentLevel + 1);
                    builder.Append(OpCellTreeNode.OpToEsql(CellTreeOpType.Union));
                }
                isFirst = false;

                builder.Append(" (");
                child.AsEsql(builder, isTopLevel, indentLevel + 1);
                builder.Append(')');
            }
            return(builder);
        }