Esempio n. 1
0
 public void ColumnTest()
 {
     Table target = new Table(); // TODO: Initialize to an appropriate value
     string columnName = string.Empty; // TODO: Initialize to an appropriate value
     Column expected = null; // TODO: Initialize to an appropriate value
     Column actual;
     actual = target.Column(columnName);
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
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 GroupByTest()
 {
     var table = new Table("test");
     From.From target = new From.From(table);
     List<Column> items = null; // TODO: Initialize to an appropriate value
     GroupBy.GroupBy expected = null; // TODO: Initialize to an appropriate value
     GroupBy.GroupBy actual;
     actual = target.GroupBy(items);
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
Esempio n. 4
0
 public void OrderByTest()
 {
     var table = new Table("test");
     var from = new From.From(table);
     var exp = table["foo"].Equal(table["bar"]);
     Where.Where target = new Where.Where(from, exp);
     OrderByExpression[] orderByExpressions = null; // TODO: Initialize to an appropriate value
     OrderBy.OrderBy expected = null; // TODO: Initialize to an appropriate value
     OrderBy.OrderBy actual;
     actual = target.OrderBy(orderByExpressions);
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
Esempio n. 5
0
 public TableJoin(Table table)
 {
     this.LeftTable = table;
 }
Esempio n. 6
0
 public void TableConstructorTest9()
 {
     string name = string.Empty; // TODO: Initialize to an appropriate value
     string alias = string.Empty; // TODO: Initialize to an appropriate value
     Table target = new Table(name, alias);
     Assert.Inconclusive("TODO: Implement code to verify target");
 }
Esempio n. 7
0
 public Table Right(Table rightTable, Expression expression)
 {
     this.JoinType = JoinType.Right;
     this.RightTable = rightTable;
     this.SearchCondition = expression;
     return this;
 }
Esempio n. 8
0
 public void SelectTest9()
 {
     var table = new Table("test");
     From.From target = new From.From(table);
     Expression selectItem = null; // TODO: Initialize to an appropriate value
     Where.Where where = null; // TODO: Initialize to an appropriate value
     GroupBy.GroupBy groupBy = null; // TODO: Initialize to an appropriate value
     Select.Select expected = null; // TODO: Initialize to an appropriate value
     Select.Select actual;
     actual = target.Select(selectItem, where, groupBy);
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
Esempio n. 9
0
 public void WhereTest()
 {
     var table = new Table("test");
     From.From target = new From.From(table);
     Expression expression = null; // TODO: Initialize to an appropriate value
     Where.Where expected = null; // TODO: Initialize to an appropriate value
     Where.Where actual;
     actual = target.Where(expression);
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
Esempio n. 10
0
 public void TableConstructorTest1()
 {
     Table target = new Table();
     Assert.Inconclusive("TODO: Implement code to verify target");
 }
Esempio n. 11
0
 public void SelectTest4()
 {
     var table = new Table("test");
     From.From target = new From.From(table);
     Select.Select expected = null; // TODO: Initialize to an appropriate value
     Select.Select actual;
     actual = target.Select();
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
Esempio n. 12
0
 public From(Table table)
     : this()
 {
     _tables.Add(table);
 }
Esempio n. 13
0
 private void GenerateCodeFromTableSourceExpression(Table tableSource, TextWriter writer, CodeGeneratorOptions options)
 {
     if (tableSource.Schema != null)
     {
         if (!string.IsNullOrEmpty(tableSource.Schema.Name))
         {
             if (string.Compare(tableSource.Schema.Name.Trim(), "dbo", true) != 0)
             {
                 writer.Write(string.Concat("[", tableSource.Schema.Name, "]."));
             }
             else
             {
                 // DBO schema...
             }
         }
         else
         {
             throw new Exception("Schema name cannot be NULL or empty.");
         }
     }
     if (!string.IsNullOrEmpty(tableSource.Name))
     {
         writer.Write(string.Concat("[", tableSource.Name, "]"));
     }
     if (!string.IsNullOrEmpty(tableSource.Alias))
     {
         writer.Write(string.Concat(" AS ", "[", tableSource.Alias, "]"));
     }
     if (tableSource.SampleClause != null)
     {
         writer.Write(tableSource.SampleClause.ToString());
     }
     if (tableSource.TableHints != null)
     {
         writer.Write(" WITH (");
         GenerateCodeFromCodeObject(tableSource.TableHints, writer, options);
         writer.Write(")");
     }
 }
Esempio n. 14
0
 public Column(ISchema schema, Table table, string name, string alias)
     : this(table, name, alias)
 {
     Schema = schema;
 }
Esempio n. 15
0
 public Column(IDatabase db, ISchema schema, Table table, string name, string alias)
     : this(schema, table, name, alias)
 {
     Database = db;
 }
Esempio n. 16
0
 public Column(Table table, string name, string alias)
     : this(name, alias)
 {
     Table = table;
 }
Esempio n. 17
0
 public Column(Table table, string name)
     : this(name)
 {
     Table = table;
 }
Esempio n. 18
0
 public void TableConstructorTest5()
 {
     string name = string.Empty; // TODO: Initialize to an appropriate value
     string alias = string.Empty; // TODO: Initialize to an appropriate value
     ClauseTableSample tableSampleClause = null; // TODO: Initialize to an appropriate value
     TableHint tableHints = null; // TODO: Initialize to an appropriate value
     Table target = new Table(name, alias, tableSampleClause, tableHints);
     Assert.Inconclusive("TODO: Implement code to verify target");
 }
Esempio n. 19
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. 20
0
 public void SelectTest18()
 {
     var table = new Table("test");
     var from = new From.From(table);
     var exp = table["foo"].Equal(table["bar"]);
     Where.Where target = new Where.Where(from, exp);
     Expression selectItem = null; // TODO: Initialize to an appropriate value
     OrderBy.OrderBy orderBy = null; // TODO: Initialize to an appropriate value
     Select.Select expected = null; // TODO: Initialize to an appropriate value
     Select.Select actual;
     actual = target.Select(selectItem, orderBy);
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
Esempio n. 21
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");
        }
Esempio n. 22
0
 public void SelectTest7()
 {
     var table = new Table("test");
     var from = new From.From(table);
     var exp = table["foo"].Equal(table["bar"]);
     Where.Where target = new Where.Where(from, exp);
     Top top = null; // TODO: Initialize to an appropriate value
     List<Expression> selectList = null; // TODO: Initialize to an appropriate value
     GroupBy.GroupBy groupBy = null; // TODO: Initialize to an appropriate value
     Select.Select expected = null; // TODO: Initialize to an appropriate value
     Select.Select actual;
     actual = target.Select(top, selectList, groupBy);
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
Esempio n. 23
0
 public void OrderByTest3()
 {
     var table = new Table("test");
     From.From target = new From.From(table);
     List<OrderByExpression> orderByExpressions = null; // TODO: Initialize to an appropriate value
     OrderBy.OrderBy expected = null; // TODO: Initialize to an appropriate value
     OrderBy.OrderBy actual;
     actual = target.OrderBy(orderByExpressions);
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
Esempio n. 24
0
 public void ItemTest()
 {
     Table target = new Table(); // TODO: Initialize to an appropriate value
     string columnName = string.Empty; // TODO: Initialize to an appropriate value
     Column actual;
     actual = target[columnName];
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
Esempio n. 25
0
 public void SelectTest7()
 {
     var table = new Table("test");
     From.From target = new From.From(table);
     Top top = null; // TODO: Initialize to an appropriate value
     List<Expression> selectList = null; // TODO: Initialize to an appropriate value
     Where.Where where = null; // TODO: Initialize to an appropriate value
     Select.Select expected = null; // TODO: Initialize to an appropriate value
     Select.Select actual;
     actual = target.Select(top, selectList, where);
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
Esempio n. 26
0
 public void ScalarSelectTest()
 {
     var table = new Table("test");
     var from = new From.From(table);
     var exp = table["foo"].Equal(table["bar"]);
     Where.Where target = new Where.Where(from, exp);
     Top top = null; // TODO: Initialize to an appropriate value
     Scalar selectedItem = null; // TODO: Initialize to an appropriate value
     ScalarSelect expected = null; // TODO: Initialize to an appropriate value
     ScalarSelect actual;
     actual = target.ScalarSelect(top, selectedItem);
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
Esempio n. 27
0
 public void TablesTest()
 {
     var table = new Table("test");
     From.From target = new From.From(table);
     List<Table> actual;
     actual = target.Tables;
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
Esempio n. 28
0
 public static From.From From(Table tableSource)
 {
     return new From.From(tableSource);
 }
Esempio n. 29
0
        public void OrderByConstructorTest()
        {
            var table = new Table("test");
            var orderByExpression = table["foo"].Asc();

            List<OrderByExpression> orderByExpressions = new List<OrderByExpression>() { orderByExpression };
            From.From from = null; // TODO: Initialize to an appropriate value
            Where.Where where = null; // TODO: Initialize to an appropriate value
            /*OrderBy_Accessor target = new OrderBy_Accessor(orderByExpressions, from, where);*/
            Assert.Inconclusive("TODO: Implement code to verify target");
        }
Esempio n. 30
0
 public void TableConstructorTest7()
 {
     Schema schema = null; // TODO: Initialize to an appropriate value
     string name = string.Empty; // TODO: Initialize to an appropriate value
     Table target = new Table(schema, name);
     Assert.Inconclusive("TODO: Implement code to verify target");
 }