Exemplo n.º 1
0
        protected override void AppendTo(SqlStringBuilder builder)
        {
            builder.Append("SELECT ");
            if (Distinct)
            {
                builder.Append("DISTINCT ");
            }

            for (int i = 0; i < Items.Count; i++)
            {
                Items[i].AppendTo(builder);

                if (i < Items.Count - 1)
                {
                    builder.Append(", ");
                }
            }

            if (!From.IsEmpty)
            {
                builder.AppendLine();
                builder.Indent();
                From.AppendTo(builder);

                if (Where != null)
                {
                    builder.AppendLine();
                    builder.Append("WHERE ");
                    Where.AppendTo(builder);
                }
                else if (Having != null)
                {
                    builder.AppendLine();
                    builder.Append("HAVING ");
                    Having.AppendTo(builder);
                }
            }

            // TODO: continue
        }