Пример #1
0
        public void AndLess()
        {
            WhereList w = new WhereList(global::SqlBuilder.Format.MsSQL);

            w.Less("a", "b", "c");
            string result = w.GetSql();
            string sql    = "[a]<@a AND [b]<@b AND [c]<@c";

            Assert.AreEqual(sql, result);
        }
Пример #2
0
        public void AndEqualSimple1()
        {
            WhereList w = new WhereList(global::SqlBuilder.Format.MsSQL);

            w.Equal("a", "b", "c");
            string result = w.GetSql();
            string sql    = "[a]=@a AND [b]=@b AND [c]=@c";

            Assert.AreEqual(sql, result);
        }
Пример #3
0
        public void IsNotNullSimple()
        {
            WhereList w = new WhereList(global::SqlBuilder.Format.MsSQL);

            w.IsNotNULL("a", "b", "c");
            string result = w.GetSql();
            string sql    = "[a] IS NOT NULL AND [b] IS NOT NULL AND [c] IS NOT NULL";

            Assert.AreEqual(sql, result);
        }
Пример #4
0
        public void InSimple3()
        {
            WhereList w = new WhereList(global::SqlBuilder.Format.MsSQL);

            w.In("id_user", "SELECT id FROM tab_users");
            string result = w.GetSql();
            string sql    = "[id_user] IN (SELECT id FROM tab_users)";

            Assert.AreEqual(sql, result);
        }
Пример #5
0
        public void RawSimple1()
        {
            WhereList w = new WhereList(global::SqlBuilder.Format.MsSQL);

            w.Raw("[a] IS NULL AND [b]=2 AND [c] NOT LIKE '%text%'");
            string result = w.GetSql();
            string sql    = "[a] IS NULL AND [b]=2 AND [c] NOT LIKE '%text%'";

            Assert.AreEqual(sql, result);
        }
Пример #6
0
        public void WhereParenthesis4()
        {
            WhereList w = new WhereList(global::SqlBuilder.Format.MsSQL);

            w.RawParenthesis("[a] IS NULL OR [b] IS NULL");
            string result = w.GetSql();
            string sql    = "([a] IS NULL OR [b] IS NULL)";

            Assert.AreEqual(sql, result);
        }
Пример #7
0
        public void ComboAndGreaterAndLess()
        {
            WhereList w = new WhereList(global::SqlBuilder.Format.MsSQL);

            w.Greater("a");
            w.Less("b");
            string result = w.GetSql();
            string sql    = "[a]>@a AND [b]<@b";

            Assert.AreEqual(sql, result);
        }
Пример #8
0
        public void RawSimple2()
        {
            WhereList w = new WhereList(global::SqlBuilder.Format.MsSQL);

            w.Raw("[a] NOT LIKE '%text%'");
            w.Equal("id");
            string result = w.GetSql();
            string sql    = "[a] NOT LIKE '%text%' AND [id]=@id";

            Assert.AreEqual(sql, result);
        }
Пример #9
0
        public void ComboAndEqualAndNotEqual()
        {
            WhereList w = new WhereList(global::SqlBuilder.Format.MsSQL);

            w.EqualValue("a", "1");
            w.NotEqualValue("b", "2");
            string result = w.GetSql();
            string sql    = "[a]=1 AND [b]!=2";

            Assert.AreEqual(sql, result);
        }
Пример #10
0
        public void AndNotEqualParamValue()
        {
            WhereList w = new WhereList(global::SqlBuilder.Format.MsSQL);

            w.NotEqualValue("a", "1");
            w.NotEqualValue("b", "2");
            w.NotEqualValue("c", "3");
            string result = w.GetSql();
            string sql    = "[a]!=1 AND [b]!=2 AND [c]!=3";

            Assert.AreEqual(sql, result);
        }
Пример #11
0
        public void IsNullSimple()
        {
            SuperSql.DefaultFormatter = FormatterLibrary.MsSql;

            var w = new WhereList(SuperSql.DefaultFormatter);

            w.IsNULL("a", "b", "c");
            var result = w.GetSql();
            var sql    = "[a] IS NULL AND [b] IS NULL AND [c] IS NULL";

            Assert.Equal(sql, result);
        }
Пример #12
0
        public void RawSimple1()
        {
            SuperSql.DefaultFormatter = FormatterLibrary.MsSql;

            var w = new WhereList(SuperSql.DefaultFormatter);

            w.Raw("[a] IS NULL AND [b]=2 AND [c] NOT LIKE '%text%'");
            var result = w.GetSql();
            var sql    = "[a] IS NULL AND [b]=2 AND [c] NOT LIKE '%text%'";

            Assert.Equal(sql, result);
        }
Пример #13
0
        public void InSimple2()
        {
            SuperSql.DefaultFormatter = FormatterLibrary.MsSql;

            var w = new WhereList(SuperSql.DefaultFormatter);

            w.In("id_user", "SELECT id FROM tab_users");
            var result = w.GetSql();
            var sql    = "[id_user] IN (SELECT id FROM tab_users)";

            Assert.Equal(sql, result);
        }
Пример #14
0
        public void AndLessParam()
        {
            WhereList w = new WhereList(global::SqlBuilder.Format.MsSQL);

            w.LessValue("a", "1");
            w.LessValue("b", "2");
            w.LessValue("c", "3");
            string result = w.GetSql();
            string sql    = "[a]<1 AND [b]<2 AND [c]<3";

            Assert.AreEqual(sql, result);
        }
Пример #15
0
        public void AndGreaterParam()
        {
            WhereList w = new WhereList(global::SqlBuilder.Format.MsSQL);

            w.GreaterValue("a", "1");
            w.GreaterValue("b", "2");
            w.GreaterValue("c", "3");
            string result = w.GetSql();
            string sql    = "[a]>1 AND [b]>2 AND [c]>3";

            Assert.AreEqual(sql, result);
        }
Пример #16
0
        public void WhereParenthesis4()
        {
            SuperSql.DefaultFormatter = FormatterLibrary.MsSql;

            var w = new WhereList(SuperSql.DefaultFormatter);

            w.RawParenthesis("[a] IS NULL OR [b] IS NULL");
            var result = w.GetSql();
            var sql    = "([a] IS NULL OR [b] IS NULL)";

            Assert.Equal(sql, result);
        }
Пример #17
0
        public void InSimple1()
        {
            WhereList w = new WhereList(global::SqlBuilder.Format.MsSQL);

            w.Equal("a");
            w.In("b", "1", "2", "3");
            w.Equal("c");
            string result = w.GetSql();
            string sql    = "[a]=@a AND [b] IN (1, 2, 3) AND [c]=@c";

            Assert.AreEqual(sql, result);
        }
Пример #18
0
        public void AndEqualGreater()
        {
            SuperSql.DefaultFormatter = FormatterLibrary.MsSql;

            var w = new WhereList(SuperSql.DefaultFormatter);

            w.EqualGreater("a", "b", "c");
            var result = w.GetSql();
            var sql    = "[a]>=@a AND [b]>=@b AND [c]>=@c";

            Assert.Equal(sql, result);
        }
Пример #19
0
        public void AndEqualSimple2()
        {
            SuperSql.DefaultFormatter = FormatterLibrary.MsSql;

            var w = new WhereList(SuperSql.DefaultFormatter);

            w.Equal("a", "b", "c");
            var result = w.GetSql("t");
            var sql    = "[t].[a]=@a AND [t].[b]=@b AND [t].[c]=@c";

            Assert.Equal(sql, result);
        }
Пример #20
0
        public void AndEqualSimple1()
        {
            SqlBuilder.DefaultFormatter = FormatterLibrary.MsSql;

            WhereList w = new WhereList(SqlBuilder.DefaultFormatter);

            w.Equal("a", "b", "c");
            string result = w.GetSql();
            string sql    = "[a]=@a AND [b]=@b AND [c]=@c";

            Assert.AreEqual(sql, result);
        }
Пример #21
0
        public void AndNotEqualSimple()
        {
            SuperSql.DefaultFormatter = FormatterLibrary.MsSql;

            var w = new WhereList(SuperSql.DefaultFormatter);

            w.NotEqual("a", "b", "c");
            var result = w.GetSql();
            var sql    = "[a]!=@a AND [b]!=@b AND [c]!=@c";

            Assert.Equal(sql, result);
        }
Пример #22
0
        public void WhereParenthesis4()
        {
            SqlBuilder.DefaultFormatter = FormatterLibrary.MsSql;

            WhereList w = new WhereList(SqlBuilder.DefaultFormatter);

            w.RawParenthesis("[a] IS NULL OR [b] IS NULL");
            string result = w.GetSql();
            string sql    = "([a] IS NULL OR [b] IS NULL)";

            Assert.AreEqual(sql, result);
        }
Пример #23
0
        public void InSimple2()
        {
            SqlBuilder.DefaultFormatter = FormatterLibrary.MsSql;

            WhereList w = new WhereList(SqlBuilder.DefaultFormatter);

            w.In("id_user", "SELECT id FROM tab_users");
            string result = w.GetSql();
            string sql    = "[id_user] IN (SELECT id FROM tab_users)";

            Assert.AreEqual(sql, result);
        }
Пример #24
0
        public void RawSimple1()
        {
            SqlBuilder.DefaultFormatter = FormatterLibrary.MsSql;

            WhereList w = new WhereList(SqlBuilder.DefaultFormatter);

            w.Raw("[a] IS NULL AND [b]=2 AND [c] NOT LIKE '%text%'");
            string result = w.GetSql();
            string sql    = "[a] IS NULL AND [b]=2 AND [c] NOT LIKE '%text%'";

            Assert.AreEqual(sql, result);
        }
Пример #25
0
        public void IsNotNullSimple()
        {
            SqlBuilder.DefaultFormatter = FormatterLibrary.MsSql;

            WhereList w = new WhereList(SqlBuilder.DefaultFormatter);

            w.IsNotNULL("a", "b", "c");
            string result = w.GetSql();
            string sql    = "[a] IS NOT NULL AND [b] IS NOT NULL AND [c] IS NOT NULL";

            Assert.AreEqual(sql, result);
        }
Пример #26
0
        public void ComboAndGreaterAndLess()
        {
            SqlBuilder.DefaultFormatter = FormatterLibrary.MsSql;

            WhereList w = new WhereList(SqlBuilder.DefaultFormatter);

            w.Greater("a");
            w.Less("b");
            string result = w.GetSql();
            string sql    = "[a]>@a AND [b]<@b";

            Assert.AreEqual(sql, result);
        }
Пример #27
0
        public void RawSimple2()
        {
            SqlBuilder.DefaultFormatter = FormatterLibrary.MsSql;

            WhereList w = new WhereList(SqlBuilder.DefaultFormatter);

            w.Raw("[a] NOT LIKE '%text%'");
            w.Equal("id");
            string result = w.GetSql();
            string sql    = "[a] NOT LIKE '%text%' AND [id]=@id";

            Assert.AreEqual(sql, result);
        }
Пример #28
0
        public void ComboAndEqualAndNotEqual()
        {
            SqlBuilder.DefaultFormatter = FormatterLibrary.MsSql;

            WhereList w = new WhereList(SqlBuilder.DefaultFormatter);

            w.EqualValue("a", "1");
            w.NotEqualValue("b", "2");
            string result = w.GetSql();
            string sql    = "[a]=1 AND [b]!=2";

            Assert.AreEqual(sql, result);
        }
Пример #29
0
        public void RawSimple2()
        {
            SuperSql.DefaultFormatter = FormatterLibrary.MsSql;

            var w = new WhereList(SuperSql.DefaultFormatter);

            w.Raw("[a] NOT LIKE '%text%'");
            w.Equal("id");
            var result = w.GetSql();
            var sql    = "[a] NOT LIKE '%text%' AND [id]=@id";

            Assert.Equal(sql, result);
        }
Пример #30
0
        public void WhereParenthesis1()
        {
            WhereList w = new WhereList(global::SqlBuilder.Format.MsSQL);

            w.OpenParenthesis();
            w.Or();
            w.IsNULL("a", "b", "c");
            w.CloseParenthesis();
            string result = w.GetSql();
            string sql    = "([a] IS NULL OR [b] IS NULL OR [c] IS NULL)";

            Assert.AreEqual(sql, result);
        }