Beispiel #1
0
        public void GroupByAggregation1()
        {
            ColumnsListAggregation c = new ColumnsListAggregation(global::SqlBuilder.Format.MsSQL);
            GroupByList            g = new GroupByList(global::SqlBuilder.Format.MsSQL, c);

            g.FuncMax("sm");

            string result1 = g.GetSql();
            string sql1    = "[sm]";
            string result2 = c.GetSql();
            string sql2    = "MAX([sm])";

            Assert.AreEqual(sql1, result1);
            Assert.AreEqual(sql2, result2);
            Assert.AreEqual(c.Count, g.Count);
        }
Beispiel #2
0
        public void GroupByAggregation1()
        {
            SqlBuilder.DefaultFormatter = FormatterLibrary.MsSql;

            ColumnsListAggregation c = new ColumnsListAggregation(SqlBuilder.DefaultFormatter);
            GroupByList            g = new GroupByList(SqlBuilder.DefaultFormatter, c);

            g.FuncMax("sm");

            string result1 = g.GetSql();
            string sql1    = "[sm]";
            string result2 = c.GetSql();
            string sql2    = "MAX([sm])";

            Assert.AreEqual(sql1, result1);
            Assert.AreEqual(sql2, result2);
            Assert.AreEqual(c.Count, g.Count);
        }
Beispiel #3
0
        public void GroupByAggregationMany()
        {
            ColumnsListAggregation c = new ColumnsListAggregation(global::SqlBuilder.Format.MsSQL);
            GroupByList            g = new GroupByList(global::SqlBuilder.Format.MsSQL, c);

            g.FuncSum("sm", "asm");
            g.FuncMax("mx", "amx");
            g.FuncMin("mn", "amn");

            string result1 = g.GetSql();
            string sql1    = "[sm], [mx], [mn]";
            string result2 = c.GetSql();
            string sql2    = "SUM([sm]) as 'asm', MAX([mx]) as 'amx', MIN([mn]) as 'amn'";

            Assert.AreEqual(sql1, result1);
            Assert.AreEqual(sql2, result2);
            Assert.AreEqual(c.Count, g.Count);
        }
Beispiel #4
0
        public void GroupByAggregation1()
        {
            NKnife.Storages.SQL.Common.SuperSql.DefaultFormatter = FormatterLibrary.MsSql;

            ColumnsListAggregation c = new ColumnsListAggregation(NKnife.Storages.SQL.Common.SuperSql.DefaultFormatter);
            GroupByList            g = new GroupByList(NKnife.Storages.SQL.Common.SuperSql.DefaultFormatter, c);

            g.FuncMax("sm");

            string result1 = g.GetSql();
            string sql1    = "[sm]";
            string result2 = c.GetSql();
            string sql2    = "MAX([sm])";

            Assert.Equal(sql1, result1);
            Assert.Equal(sql2, result2);
            Assert.Equal(c.Count, g.Count);
        }
Beispiel #5
0
        public void GroupByAggregationMany()
        {
            SqlBuilder.DefaultFormatter = FormatterLibrary.MsSql;

            ColumnsListAggregation c = new ColumnsListAggregation(SqlBuilder.DefaultFormatter);
            GroupByList            g = new GroupByList(SqlBuilder.DefaultFormatter, c);

            g.FuncSum("sm", "asm");
            g.FuncMax("mx", "amx");
            g.FuncMin("mn", "amn");
            g.FuncCount("fg", "acn");

            string result1 = g.GetSql();
            string sql1    = "[sm], [mx], [mn], [fg]";
            string result2 = c.GetSql();
            string sql2    = "SUM([sm]) as 'asm', MAX([mx]) as 'amx', MIN([mn]) as 'amn', COUNT([fg]) as 'acn'";

            Assert.AreEqual(sql1, result1);
            Assert.AreEqual(sql2, result2);
            Assert.AreEqual(c.Count, g.Count);
        }