示例#1
0
        public override IBatch End()
        {
            IBatch        batch = new SqlServerBatch();
            StringBuilder sb    = new StringBuilder();
            String        query = ConvertToQuery(Reduce.GetQuery());
            String        table = ConvertToTable(Reduce.GetTable());

            String where = ConvertToWhere(Reduce.GetWhere());
            sb.Append($"select {query} ");
            sb.Append($"from {table} ");
            if (!String.IsNullOrEmpty(where))
            {
                sb.Append($"where {where} ");
            }
            if (Reduce.GetTop() != null)
            {
                sb.Append($" limit 0, @{Reduce.GetTop().ColumnName} ");
            }
            batch.SqlBuilder        = sb.ToString();
            batch.DynamicParameters = Reduce.Parameters;
            return(batch);
        }