Esempio n. 1
0
 public void NameTest()
 {
     Schema schema = new Schema("test");
     Assert.IsNotNull(schema);
     string expected = "test";
     Assert.IsNotNull(schema.Name);
     Assert.IsTrue(schema.Name.Length > 0);
     string actual = schema.Name;
     Assert.AreEqual(expected, actual);
 }
Esempio n. 2
0
        public void TestInterface()
        {
            var schema = new Schema("s");
            var table = new Table(schema, "t");

            Sql.From(table)
                .GroupBy(table["c0"])
                .Having(table["c1"].Equal(57))
                .OrderBy(table["c2"].Desc()
            );
        }
Esempio n. 3
0
 public void TestExample1()
 {
     var nolock = new TableHint(TableHints.NoLock);
     var s = new Schema("s");
 }
Esempio n. 4
0
        public void TestNestedScalarSelect()
        {
            TableHint nolock = new TableHint(TableHints.NoLock);

            var schema = new Schema("s");
            var t0 = new Table("b", "b", null, nolock);
            var t1 = new Table("mb", "mb", null, nolock);

            var t2 = new Table(schema, "s", "s0", null, nolock);
            var t3 = new Table(schema, "s", "s1", null, nolock);
            var t4 = new Table(schema, "p", "p", null, nolock);

            var table = Sql.From(
                    t0
                    .Join.Inner(t1, t0["mb_id"].Equal(t1["id"]))
                    .Join.Left(t2, t0["sid"].Equal(t2["sid"])
                        .And(t2["f0"].Equal("Y"))
                        .And(t2["f1"].Equal("N"))
                        .And(t2["dtm"].Equal(
                            Sql.From(
                                t3
                                .Join.Inner(t4, t4["gid"].Equal(t3["gid"])
                                    .And(t4["n0"].In("YYZ", "ABC")
                                    .And(t4["n1"].Equal("XYZ")))))
                                    .Where(
                                        t3["sid"].Equal(t2["sid"])
                                            .And(t3["f0"].Equal("Y")
                                            .And(t3["f1"].Equal("N"))))
                                    .ScalarSelect(
                                        new Max(t3["dtm"])
                                )
                            )
                        )
                    )
                )
                .Where(
                    t0["mb_id"].Equal("id")
                    .And(t0["seq"].GreaterThanOrEqual(1))
                    .And(t0["seq"].LessThanOrEqual(5))
                )
                .Select(
                    t0["sid"], t0["gid"], t1["eval_usr_nm"], t2["gid"]
                );

            AssertClause(table, @"SELECT b.sid, b.gid, mb.eval_usr_nm, s0.gid
              FROM [b] AS [b] WITH (NOLOCK)
            INNER JOIN [mb] AS [mb] WITH (NOLOCK) ON b.mb_id = mb.id
            LEFT OUTER JOIN [s].[s] AS [s0] WITH (NOLOCK) ON b.sid = s0.sid AND s0.f0 = 'Y' AND s0.f1 = 'N' AND s0.dtm =
              (SELECT MAX(s1.dtm)
              FROM [s].[s] AS [s1] WITH (NOLOCK)
            INNER JOIN [s].[p] AS [p] WITH (NOLOCK) ON p.gid = s1.gid AND p.n0 IN ('YYZ', 'ABC') AND p.n1 = 'XYZ'
              WHERE s1.sid = s0.sid AND s1.f0 = 'Y' AND s1.f1 = 'N')
              WHERE b.mb_id = 'id' AND b.seq >= 1 AND b.seq <= 5;");
        }
Esempio n. 5
0
 public Table(Schema schema, string name, string alias, ClauseTableSample tableSampleClause, TableHint tableHints)
     : this(schema, name, alias, tableSampleClause)
 {
     TableHints = tableHints;
 }
Esempio n. 6
0
 public Table(Schema schema, string name, string alias, ClauseTableSample tableSampleClause)
     : this(schema, name, alias)
 {
     SampleClause = tableSampleClause;
 }
Esempio n. 7
0
 public Table(Schema schema, string name, string alias)
     : this(schema, name)
 {
     Alias = alias;
 }
Esempio n. 8
0
 public Table(Schema schema, string name)
 {
     Name = name;
     Schema = schema;
 }
Esempio n. 9
0
 public Table(Schema schema, string name, string alias, TableHint tableHints)
     : this(schema, name, alias, null, tableHints)
 {
     //
 }
Esempio n. 10
0
 public void SchemaConstructorTest()
 {
     string name = string.Empty; // TODO: Initialize to an appropriate value
     Schema target = new Schema(name);
     Assert.IsNotNull(target);
 }