Esempio n. 1
0
        public void TestDeleteSentenceBuilder1()
        {
            var          dsb = new DeleteStatementBuilder("UserTable");
            const string s   = "DELETE FROM [UserTable];";

            TesterHelper.AssertSqlSentenceEqual(dsb.ToSqlStatement(dd, null).SqlCommandText, s);
        }
Esempio n. 2
0
        public void TestDeleteSentenceBuilder2()
        {
            var dsb = new DeleteStatementBuilder("UserTable");

            dsb.Where.Conditions = new OrClause("ID", 3, 1);
            const string Exp = "DELETE FROM [UserTable] WHERE ([ID] = @ID_0) OR ([ID] = @ID_1);\n<Text><30>(@ID_0=3:Int32,@ID_1=1:Int32)";

            TesterHelper.AssertSqlSentenceEqual(Exp, dsb.ToSqlStatement(dd, null).ToString());
        }
Esempio n. 3
0
        public void TestSelectSentenceBuilder2()
        {
            var ssb = new SelectStatementBuilder("UserTable", null, new Range(1, 10));

            ssb.Keys.Add(new KeyValuePair <string, string>("a", null));
            ssb.Where.Conditions = new OrClause("ID", 5, 3, 2);
            const string s = "SELECT TOP 10 [a] FROM [UserTable] WHERE ([ID] = @ID_0) OR ([ID] = @ID_1) OR ([ID] = @ID_2);\n<Text><60>(@ID_0=5:Int32,@ID_1=3:Int32,@ID_2=2:Int32)";

            TesterHelper.AssertSqlSentenceEqual(s, ssb.ToSqlStatement(dd, null).ToString());
        }
Esempio n. 4
0
        public void TestSelectSentenceBuilder3()
        {
            var ssb = new SelectStatementBuilder("UserTable", null, new Range(1, 10));

            ssb.Keys.Add(new KeyValuePair <string, string>("a", null));
            ssb.Where.Conditions = new OrClause("ID", 5, 3, 2);
            ssb.Where.Conditions = new AndClause(ssb.Where.Conditions, new KeyValueClause("UserName", "l'lf", CompareOpration.Equal, ColumnFunction.None));
            const string s = "SELECT TOP 10 [a] FROM [UserTable] WHERE (([ID] = @ID_0) OR ([ID] = @ID_1) OR ([ID] = @ID_2)) AND ([UserName] = @UserName_3);\n<Text><60>(@ID_0=5:Int32,@ID_1=3:Int32,@ID_2=2:Int32,@UserName_3=l'lf:String)";

            TesterHelper.AssertSqlSentenceEqual(s, ssb.ToSqlStatement(dd, null).ToString());
        }