Пример #1
0
        public void Batch_Should_Build_Batched_SQL()
        {
            BatchQuery qry = new BatchQuery(provider);

            qry.Queue(new Select(provider).From("Products").Where("ProductID").IsEqualTo(1));
            qry.Queue(new Select(provider).From("Products").Where("ProductID").IsEqualTo(2));
            qry.Queue(new Select(provider).From("Products").Where("ProductID").IsEqualTo(3));

            string sql = qry.BuildSqlStatement();

            Assert.Equal(3, sql.FindMatches("SELECT").Count);
        }
Пример #2
0
        public void Batch_Should_Build_Batched_SQL()
        {
            BatchQuery qry = new BatchQuery(provider);

            qry.Queue(new Select(provider).From("Products").Where("ProductID").IsEqualTo(1));
            qry.Queue(new Select(provider).From("Products").Where("ProductID").IsEqualTo(2));
            qry.Queue(new Select(provider).From("Products").Where("ProductID").IsEqualTo(3));

            string sql = qry.BuildSqlStatement();

            Assert.Equal(3, sql.FindMatches("SELECT").Count);
        }
Пример #3
0
        public void Batch_Should_Build_Batched_SQL_Using_Linq()
        {
            BatchQuery qry    = new BatchQuery(provider);
            var        pquery = new Query <Product>(provider);

            qry.Queue(from p in pquery where p.ProductID == 1 select p);
            qry.Queue(from p in pquery where p.ProductID == 2 select p);
            qry.Queue(from p in pquery where p.ProductID == 3 select p);

            string sql = qry.BuildSqlStatement();

            Assert.Equal(3, sql.FindMatches("SELECT").Count);
        }
Пример #4
0
        public void Batch_Should_Build_Batched_SQL_With_Replaced_SQL_Parameters()
        {
            BatchQuery qry = new BatchQuery(provider);
            qry.Queue(new Select(provider).From("Products").Where("ProductID").IsEqualTo(1));
            qry.Queue(new Select(provider).From("Products").Where("ProductID").IsEqualTo(2));
            qry.Queue(new Select(provider).From("Products").Where("ProductID").IsEqualTo(3));

            string sql = qry.BuildSqlStatement();

            Assert.True(sql.FindMatches("@0").Count == 1);
            Assert.True(sql.FindMatches("@1").Count == 1);
            Assert.True(sql.FindMatches("@2").Count == 1);
        }
Пример #5
0
        public void Batch_Should_Build_Batched_SQL_With_Replaced_SQL_Parameters()
        {
            BatchQuery qry = new BatchQuery(provider);

            qry.Queue(new Select(provider).From("Products").Where("ProductID").IsEqualTo(1));
            qry.Queue(new Select(provider).From("Products").Where("ProductID").IsEqualTo(2));
            qry.Queue(new Select(provider).From("Products").Where("ProductID").IsEqualTo(3));

            string sql = qry.BuildSqlStatement();

            Assert.True(sql.FindMatches("@0").Count == 1);
            Assert.True(sql.FindMatches("@1").Count == 1);
            Assert.True(sql.FindMatches("@2").Count == 1);
        }
Пример #6
0
        public void Batch_Should_Build_Batched_SQL_Using_Linq()
        {
            BatchQuery qry = new BatchQuery(provider);
            var pquery = new Query<Product>(provider);

            qry.Queue(from p in pquery where p.ProductID == 1 select p);
            qry.Queue(from p in pquery where p.ProductID == 2 select p);
            qry.Queue(from p in pquery where p.ProductID == 3 select p);

            string sql = qry.BuildSqlStatement();

            Assert.Equal(3, sql.FindMatches("SELECT").Count);
        }