/// <summary>
        /// Renderiza o resultado da condição no <see cref="IndentedTextWriter"/> especificado.
        /// </summary>
        /// <param name="tw">O <see cref="IndentedTextWriter"/></param>
        public override void Render(IndentedTextWriter tw)
        {
            tw.WriteLine("NOT (");
            tw.Indent++;

            cond.Render(tw);

            tw.Indent--;

            tw.WriteLine(")");
        }
Beispiel #2
0
        /// <summary>
        /// Renderiza a consulta.
        /// </summary>
        /// <param name="tw">O <see cref="IndentedTextWriter"/></param>
        public void Render(IndentedTextWriter tw)
        {
            tw.Write("SELECT ");
            if (distinct)
            {
                tw.Write("DISTINCT ");
            }
            if (!String.IsNullOrEmpty(Top))
            {
                tw.WriteLine("TOP {0}", Top);
            }
            tw.WriteLine();
            tw.Indent++;

            int i = 0, l = fields.Count;

            foreach (SqlField field in fields)
            {
                tw.WriteLine("{0}{1}", field, ++i >= l ? "" : ", ");
            }

            if (l == 0)
            {
                tw.WriteLine("*");
            }

            tw.Indent--;

            if (source != null)
            {
                tw.WriteLine("FROM");
                tw.Indent++;
                tw.WriteLine(source);
                tw.Indent--;
            }

            if (condition != null)
            {
                tw.WriteLine("WHERE");
                tw.Indent++;
                condition.Render(tw);
                tw.Indent--;
            }

            if (Order != null)
            {
                tw.WriteLine("ORDER BY");
                tw.Indent++;
                Order.Render(tw);
                tw.Indent--;
            }
        }