예제 #1
0
        public void SimpleIncompleteDynamicTest()
        {
            int    count = 0;
            string text  = "\"select * from testtable where txre_info = 3";

            foreach (var fragment in SqlStatementExtractor.ExtractStatements(text))
            {
                Assert.IsTrue(fragment != null);
                Assert.IsTrue(fragment.FragmentLength > 0);
                string txt = fragment.GetText();
                int    i   = 0;
                count++;
            }
            Assert.IsTrue(count == 1);
        }
예제 #2
0
        public void EmbeddedMultilineStaticTest3()
        {
            int    count = 0;
            string text  = "if(n == 1) then\nlet n = 2\nend if\nselect arbh_bill_dt1, arbh_bill_dt2, arbh_bill_dt3, arbh_bill_dt4\n into gr_arbilhdr.arbh_bill_dt1, gr_arbilhdr.arbh_bill_dt2,\n gr_arbilhdr.arbh_bill_dt3, gr_arbilhdr.arbh_bill_dt4\n from arbilhdr\n where arbh_year = gr_tmpfnd.tp_year and\n arbh_ar_cat = gr_tmpfnd.ar_cat and\n arbh_bill = gr_tmpfnd.bill\n   \n if (gr_arbilhdr.arbh_bill_dt1 IS NOT NULL) and";

            foreach (var fragment in SqlStatementExtractor.ExtractStatements(text))
            {
                Assert.IsTrue(fragment != null);
                Assert.IsTrue(fragment.FragmentLength > 0);
                string txt = fragment.GetText();
                int    i   = 0;
                count++;
            }
            Assert.IsTrue(count == 1);
        }
예제 #3
0
        public void EmbeddedMultilineMultiresultDynamicTest()
        {
            int    count = 0;
            string text  = "if(n == 1) then\nlet n = 2\nend if\nlet prepare = \"select * from testtable inner join othertable\",\n    \" on testtable.txre_id = othertable.arbq_id\",\n   \" where txre_info = ? and txre_mult = ?\"\ndisplay record\nupdate othertable set arbq_id = 1\nlet x = 0";

            foreach (var fragment in SqlStatementExtractor.ExtractStatements(text))
            {
                Assert.IsTrue(fragment != null);
                Assert.IsTrue(fragment.FragmentLength > 0);
                string txt = fragment.GetText();
                int    i   = 0;
                count++;
            }
            Assert.IsTrue(count == 2);
        }
예제 #4
0
        public void EmbeddedMultilineStaticTest()
        {
            int    count = 0;
            string text  = "if(n == 1) then\nlet n = 2\nend if\nselect * from testtable where txre_info = 3\n and txre_mult = 4\ndisplay record";

            foreach (var fragment in SqlStatementExtractor.ExtractStatements(text))
            {
                Assert.IsTrue(fragment != null);
                Assert.IsTrue(fragment.FragmentLength > 0);
                string txt = fragment.GetText();
                int    i   = 0;
                count++;
            }
            Assert.IsTrue(count == 1);
        }