Esempio n. 1
0
        internal override StringBuilder AsEsql(StringBuilder builder, bool isTopLevel, int indentLevel)
        {
            // The SELECT/DISTINCT part.
            StringUtil.IndentNewLine(builder, indentLevel);
            builder.Append("SELECT ");
            if (m_selectDistinct == CellQuery.SelectDistinct.Yes)
            {
                builder.Append("DISTINCT ");
            }
            GenerateProjectionEsql(builder, m_nodeTableAlias, true, indentLevel, isTopLevel);

            // Get the FROM part.
            builder.Append("FROM ");
            CqlWriter.AppendEscapedQualifiedName(builder, m_extent.EntityContainer.Name, m_extent.Name);
            builder.Append(" AS ").Append(m_nodeTableAlias);

            // Get the WHERE part only when the expression is not simply TRUE.
            if (!BoolExpression.EqualityComparer.Equals(WhereClause, BoolExpression.True))
            {
                StringUtil.IndentNewLine(builder, indentLevel);
                builder.Append("WHERE ");
                WhereClause.AsEsql(builder, m_nodeTableAlias);
            }

            return(builder);
        }
 internal override StringBuilder AsEsql(
     StringBuilder builder,
     bool isTopLevel,
     int indentLevel)
 {
     StringUtil.IndentNewLine(builder, indentLevel);
     builder.Append("SELECT ");
     if (this.m_selectDistinct == CellQuery.SelectDistinct.Yes)
     {
         builder.Append("DISTINCT ");
     }
     this.GenerateProjectionEsql(builder, this.m_nodeTableAlias, true, indentLevel, isTopLevel);
     builder.Append("FROM ");
     CqlWriter.AppendEscapedQualifiedName(builder, this.m_extent.EntityContainer.Name, this.m_extent.Name);
     builder.Append(" AS ").Append(this.m_nodeTableAlias);
     if (!BoolExpression.EqualityComparer.Equals(this.WhereClause, BoolExpression.True))
     {
         StringUtil.IndentNewLine(builder, indentLevel);
         builder.Append("WHERE ");
         this.WhereClause.AsEsql(builder, this.m_nodeTableAlias);
     }
     return(builder);
 }