Esempio n. 1
0
        public void To_String()
        {
            IAlias person = sql.Alias("person");
            IOver  over   = sql.Over
                            .PartitionBy(x => x.Add(person["DepartmentId"]));

            Assert.Equal("OVER(PARTITION BY person.DepartmentId)", over.ToString());
        }
Esempio n. 2
0
        public void To_String_OrderBy()
        {
            IAlias person = sql.Alias("person");
            IOver  over   = sql.Over
                            .PartitionBy(x => x.Add(person["DepartmentId"]))
                            .OrderBy(x => x.Add(person["Name"]).Asc);

            Assert.Equal("OVER(PARTITION BY person.DepartmentId ORDER BY person.Name ASC)", over.ToString());
        }
Esempio n. 3
0
        public void Over()
        {
            IOver over = sql.Over;

            QueryResult result = engine.Compile(over);

            Assert.Equal("OVER()", result.Sql);
            Assert.Equal(new Dictionary <string, object>(), result.Parameters);
        }
Esempio n. 4
0
        public void Over_PartitionBy_Raw()
        {
            IAlias person = sql.Alias("person");
            IOver  over   = sql.Over.PartitionBy(sql.Raw("{0}", person["DepartmentId"]));

            QueryResult result = engine.Compile(over);

            Assert.Equal("OVER(PARTITION BY \"person\".\"DepartmentId\")", result.Sql);
            Assert.Equal(new Dictionary <string, object>(), result.Parameters);
        }
Esempio n. 5
0
        public void Over_PartitionBy_OrderBy_Raw()
        {
            IAlias person = sql.Alias("person");
            IOver  over   = sql.Over
                            .PartitionBy(x => x.Add(person["DepartmentId"]))
                            .OrderBy(sql.Raw("ORDER BY {0} ASC", person["Name"]));

            QueryResult result = engine.Compile(over);

            Assert.Equal("OVER(PARTITION BY \"person\".\"DepartmentId\" ORDER BY \"person\".\"Name\" ASC)", result.Sql);
        }
Esempio n. 6
0
        public void Over_PartitionBy_OrderBy_Range()
        {
            IAlias person = sql.Alias("person");
            IOver  over   = sql.Over
                            .PartitionBy(x => x.Add(person["DepartmentId"]))
                            .OrderBy(x => x.Add(person["Name"]).Asc)
                            .Range(sql.Raw("ROWS 5 PRECEDING"));

            QueryResult result = engine.Compile(over);

            Assert.Equal("OVER(PARTITION BY \"person\".\"DepartmentId\" ORDER BY \"person\".\"Name\" ASC ROWS 5 PRECEDING)",
                         engine.Compile(over).Sql);
        }