Example #1
0
 public void IndexValuesTest()
 {
     TableHint target = new TableHint(); // TODO: Initialize to an appropriate value
     List<string> actual;
     actual = target.IndexValues;
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
Example #2
0
 public void TestExample1()
 {
     var nolock = new TableHint(TableHints.NoLock);
     var s = new Schema("s");
 }
Example #3
0
 private void AssertExpression(TableHint hint, string expectedOutput)
 {
     using (var writer = new IndentedTextWriter(new StringWriter(), "  "))
     {
         using (var tsql = new TSqlCodeProvider())
         {
             tsql.GenerateCodeFromCodeObject(hint, writer, new CodeGeneratorOptions());
             var output = writer.InnerWriter.ToString();
             Assert.IsTrue(output == expectedOutput);
         }
     }
 }
Example #4
0
        public void TestSqlTableHint()
        {
            var hint = new TableHint(TableHints.Index | TableHints.NoLock);
            hint.IndexValues.Add("t1");
            hint.IndexValues.Add("t2");

            AssertExpression(hint, "INDEX (t1, t2), NOLOCK");
        }
Example #5
0
        public void TestOrderBy()
        {
            TableHint nolock = new TableHint(TableHints.NoLock);
            var man_batch = new Table("mb", "mb", null, nolock);

            var table = new OrderBy.OrderBy(man_batch["foo"].Asc());

            AssertClause(table, "ORDER BY mb.foo");
        }
Example #6
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;");
        }
Example #7
0
 public Table(Schema schema, string name, string alias, ClauseTableSample tableSampleClause, TableHint tableHints)
     : this(schema, name, alias, tableSampleClause)
 {
     TableHints = tableHints;
 }
Example #8
0
 public Table(string name, string alias, TableHint tableHints)
     : this(name, alias)
 {
     TableHints = tableHints;
 }
Example #9
0
 public Table(string name, string alias, ClauseTableSample tableSampleClause, TableHint tableHints)
     : this(Schema.Dbo, name, alias, tableSampleClause, tableHints)
 {
     //
 }
Example #10
0
 public static Table Default(string name, string alias, ClauseTableSample tableSampleClause, TableHint tableHints)
 {
     return new Table(name, alias, tableSampleClause, tableHints);
 }
Example #11
0
 public Table(Schema schema, string name, string alias, TableHint tableHints)
     : this(schema, name, alias, null, tableHints)
 {
     //
 }
Example #12
0
 public void TableHintConstructorTest1()
 {
     TableHints hints = new TableHints(); // TODO: Initialize to an appropriate value
     TableHint target = new TableHint(hints);
     Assert.Inconclusive("TODO: Implement code to verify target");
 }
Example #13
0
 public void TableHintConstructorTest()
 {
     TableHint target = new TableHint();
     Assert.Inconclusive("TODO: Implement code to verify target");
 }