Exemplo n.º 1
0
        /// <summary>已重写。获取本Builder所分析的SQL语句</summary>
        /// <returns></returns>
        public override String ToString()
        {
            var sb = new StringBuilder();

            sb.Append("Select ");
            sb.Append(ColumnOrDefault);
            sb.Append(" From ");
            sb.Append(Table);
            if (!Where.IsNullOrEmpty())
            {
                sb.Append(" Where " + Where);
            }
            if (!GroupBy.IsNullOrEmpty())
            {
                sb.Append(" Group By " + GroupBy);
            }
            if (!Having.IsNullOrEmpty())
            {
                sb.Append(" Having " + Having);
            }
            if (!OrderBy.IsNullOrEmpty())
            {
                sb.Append(" Order By " + OrderBy);
            }
            if (!Limit.IsNullOrEmpty())
            {
                sb.Append(Limit.EnsureStart(" "));
            }

            return(sb.ToString());
        }