コード例 #1
0
ファイル: SqlSectionTests.cs プロジェクト: zz110/AntJob
        public void ParseQuery()
        {
            var tt = @"/*use his*/
select * from t1 where time between '{Start}' and '{End}'
";

            var section = new SqlSection();

            section.Parse(tt);

            Assert.Equal("his", section.ConnName);
            Assert.Equal(SqlActions.Query, section.Action);
            Assert.Equal("select * from t1 where time between '{Start}' and '{End}'", section.Sql);
        }
コード例 #2
0
ファイル: SqlSectionTests.cs プロジェクト: zz110/AntJob
        public void ParseDelete()
        {
            var tt = @"/*use his*/
delete from t2 where time between '{Start}' and '{End}';
";

            var section = new SqlSection();

            section.Parse(tt);

            Assert.Equal("his", section.ConnName);
            Assert.Equal(SqlActions.Execute, section.Action);
            Assert.Equal("delete from t2 where time between '{Start}' and '{End}'", section.Sql);
        }
コード例 #3
0
ファイル: SqlSectionTests.cs プロジェクト: zz110/AntJob
        public void ParseUpdate()
        {
            var tt = @"/*use his*/
update t1 set c1=v1, c2=v2 where id=123;
";

            var section = new SqlSection();

            section.Parse(tt);

            Assert.Equal("his", section.ConnName);
            Assert.Equal(SqlActions.Execute, section.Action);
            Assert.Equal("update t1 set c1=v1, c2=v2 where id=123", section.Sql);
        }
コード例 #4
0
ファイル: SqlSectionTests.cs プロジェクト: zz110/AntJob
        public void ParseInsert()
        {
            var tt = @"/*use his*/
insert into t1 (c1, c2) values(v1, v2);
";

            var section = new SqlSection();

            section.Parse(tt);

            Assert.Equal("his", section.ConnName);
            Assert.Equal(SqlActions.Execute, section.Action);
            Assert.Equal("insert into t1 (c1, c2) values(v1, v2)", section.Sql);
        }
コード例 #5
0
ファイル: SqlSectionTests.cs プロジェクト: zz110/AntJob
        public void ParseBatchInsert()
        {
            var tt = @"/*use his_bak*/
insert t2;

";

            var section = new SqlSection();

            section.Parse(tt);

            Assert.Equal("his_bak", section.ConnName);
            Assert.Equal(SqlActions.Insert, section.Action);
            Assert.Equal("insert t2", section.Sql);
        }