internal override string ToString(string indent)
        {
            StringBuilder sb = new StringBuilder(128);

            sb.AppendFormat("{0}DELETE NODE", indent);
            if (TopRowFilter != null)
            {
                if (TopRowFilter.OneLine())
                {
                    sb.Append(TopRowFilter.ToString(""));
                }
                else
                {
                    sb.Append("\r\n");
                    sb.Append(TopRowFilter.ToString(indent + "  "));
                }
            }
            sb.AppendFormat(" FROM {0}", Target.ToString());

            if (FromClause != null)
            {
                sb.Append("\r\n");
                sb.Append(FromClause.ToString(indent));
            }

            if (WhereClause != null && WhereClause.SearchCondition != null)
            {
                sb.Append("\r\n");
                sb.Append(WhereClause.ToString(indent));
            }

            return(sb.ToString());
        }
示例#2
0
        internal override string ToString(string indent)
        {
            var sb = new StringBuilder(1024);

            if (WithPathClause2 != null)
            {
                sb.Append(WithPathClause2.ToString(indent));
            }

            sb.AppendFormat("{0}SELECT ", indent);

            if (TopRowFilter != null)
            {
                if (TopRowFilter.OneLine())
                {
                    sb.AppendFormat("{0} ", TopRowFilter.ToString(""));
                }
                else
                {
                    sb.Append("\r\n");
                    sb.AppendFormat("{0} ", TopRowFilter.ToString(indent));
                }
            }

            switch (UniqueRowFilter)
            {
            case UniqueRowFilter.All:
                sb.Append("ALL ");
                break;

            case UniqueRowFilter.Distinct:
                sb.Append("DISTINCT ");
                break;
            }

            for (var i = 0; i < SelectElements.Count; i++)
            {
                if (i > 0)
                {
                    sb.Append(", ");
                }

                if (SelectElements[i].OneLine())
                {
                    sb.Append(SelectElements[i].ToString(""));
                }
                else
                {
                    sb.Append("\r\n");
                    sb.Append(SelectElements[i].ToString(indent + " "));
                }
            }

            if (Into != null)
            {
                sb.AppendFormat(" INTO {0} ", Into);
            }

            if (FromClause != null)
            {
                sb.Append("\r\n");
                sb.Append(FromClause.ToString(indent));
            }

            if (MatchClause != null)
            {
                sb.Append("\r\n");
                sb.Append(MatchClause.ToString(indent));
            }

            if (WhereClause != null && (WhereClause.SearchCondition != null || !string.IsNullOrEmpty(WhereClause.GhostString)))
            {
                sb.Append("\r\n");
                sb.Append(WhereClause.ToString(indent));
            }

            if (GroupByClause != null)
            {
                sb.Append("\r\n");
                sb.Append(GroupByClause.ToString(indent));
            }

            if (HavingClause != null)
            {
                sb.Append("\r\n");
                sb.Append(HavingClause.ToString(indent));
            }

            if (OrderByClause != null)
            {
                sb.Append("\r\n");
                sb.Append(OrderByClause.ToString(indent));
            }

            return(sb.ToString());
        }