Exemplo n.º 1
0
        public void ColumnsSimple1()
        {
            ColumnsListSimple c = new ColumnsListSimple(global::SqlBuilder.Format.MsSQL);

            c.Append("a", "b", "c");
            string result = c.GetSql();
            string sql    = "[a], [b], [c]";

            Assert.AreEqual(sql, result);
        }
Exemplo n.º 2
0
        public void ColumnsSimple3()
        {
            ColumnsListSimple c = new ColumnsListSimple(global::SqlBuilder.Format.MsSQL);

            c.Append("column1").Append("column2");
            string result = c.GetSql();
            string sql    = "[column1], [column2]";

            Assert.AreEqual(sql, result);
        }
Exemplo n.º 3
0
        public void ColumnsSimpleEmpty()
        {
            ColumnsListSimple c = new ColumnsListSimple(global::SqlBuilder.Format.MsSQL);

            c.Append();
            string result = c.GetSql();
            string sql    = "*";

            Assert.AreEqual(sql, result);
        }
Exemplo n.º 4
0
        public void ColumnsSimpleAlias2()
        {
            ColumnsListSimple c = new ColumnsListSimple(global::SqlBuilder.Format.MsSQL);

            c.AppendAlias("last_name", "l");
            c.AppendAlias("first_name", "f");
            string result = c.GetSql("tbl");
            string sql    = "[tbl].[last_name] as 'l', [tbl].[first_name] as 'f'";

            Assert.AreEqual(sql, result);
        }
Exemplo n.º 5
0
        public void ColumnsSimple3()
        {
            SqlBuilder.DefaultFormatter = FormatterLibrary.MsSql;

            ColumnsListSimple c = new ColumnsListSimple(SqlBuilder.DefaultFormatter);

            c.Append("column1").Append("column2");
            string result = c.GetSql();
            string sql    = "[column1], [column2]";

            Assert.AreEqual(sql, result);
        }
Exemplo n.º 6
0
        public void ColumnsSimpleEmpty()
        {
            SqlBuilder.DefaultFormatter = FormatterLibrary.MsSql;

            ColumnsListSimple c = new ColumnsListSimple(SqlBuilder.DefaultFormatter);

            c.Append();
            string result = c.GetSql();
            string sql    = "*";

            Assert.AreEqual(sql, result);
        }
Exemplo n.º 7
0
        public void ColumnsSimple1()
        {
            SqlBuilder.DefaultFormatter = FormatterLibrary.MsSql;

            ColumnsListSimple c = new ColumnsListSimple(SqlBuilder.DefaultFormatter);

            c.Append("a", "b", "c");
            string result = c.GetSql();
            string sql    = "[a], [b], [c]";

            Assert.AreEqual(sql, result);
        }
Exemplo n.º 8
0
        public void ColumnsSimple2()
        {
            SuperSql.DefaultFormatter = FormatterLibrary.MsSql;

            var c = new ColumnsListSimple(SuperSql.DefaultFormatter);

            c.Append("column");
            var result = c.GetSql();
            var sql    = "[column]";

            Assert.Equal(sql, result);
        }
Exemplo n.º 9
0
        public void ColumnsSimpleAlias2()
        {
            SqlBuilder.DefaultFormatter = FormatterLibrary.MsSql;

            ColumnsListSimple c = new ColumnsListSimple(SqlBuilder.DefaultFormatter);

            c.AppendAlias("last_name", "l");
            c.AppendAlias("first_name", "f");
            string result = c.GetSql("tbl");
            string sql    = "[tbl].[last_name] as 'l', [tbl].[first_name] as 'f'";

            Assert.AreEqual(sql, result);
        }
Exemplo n.º 10
0
        public void ColumnsSimpleAlias2()
        {
            SuperSql.DefaultFormatter = FormatterLibrary.MsSql;

            var c = new ColumnsListSimple(SuperSql.DefaultFormatter);

            c.AppendAlias("last_name", "l");
            c.AppendAlias("first_name", "f");
            var result = c.GetSql("tbl");
            var sql    = "[tbl].[last_name] as 'l', [tbl].[first_name] as 'f'";

            Assert.Equal(sql, result);
        }
Exemplo n.º 11
0
        public void ColumnsListSimpleRaw()
        {
            ColumnsListSimple c = new ColumnsListSimple(global::SqlBuilder.Format.MsSQL);

            c.Append("a", "b", "c");
            c.AppendAlias("last_name", "l");
            c.Raw("(SELECT NOW())");
            c.Raw("(SELECT 'abc')", "lll");
            c.Append("d");
            string result = c.GetSql("tbl");
            string sql    = "[tbl].[a], [tbl].[b], [tbl].[c], [tbl].[last_name] as 'l', (SELECT NOW()), (SELECT 'abc') as 'lll', [tbl].[d]";

            Assert.AreEqual(sql, result);
        }
Exemplo n.º 12
0
        public void ColumnsListSimpleRaw()
        {
            SqlBuilder.DefaultFormatter = FormatterLibrary.MsSql;

            ColumnsListSimple c = new ColumnsListSimple(SqlBuilder.DefaultFormatter);

            c.Append("a", "b", "c");
            c.AppendAlias("last_name", "l");
            c.RawValue("(SELECT NOW())");
            c.RawValue("(SELECT 'abc')", "lll");
            c.Append("d");
            string result = c.GetSql("tbl");
            string sql    = "[tbl].[a], [tbl].[b], [tbl].[c], [tbl].[last_name] as 'l', (SELECT NOW()), (SELECT 'abc') as 'lll', [tbl].[d]";

            Assert.AreEqual(sql, result);
        }
Exemplo n.º 13
0
        public void ColumnsListTableAlias2()
        {
            SqlBuilder.DefaultFormatter = FormatterLibrary.MsSql;

            ColumnsListSimple c = new ColumnsListSimple(SqlBuilder.DefaultFormatter);

            c.Append("a");
            c.SetTableAlias("t1");
            c.Append("b");
            c.SetTableAlias("t2");
            c.Append("c");
            c.SetTableAlias("");
            c.RawValue("(SELECT NOW())");
            c.Append("d");
            string result = c.GetSql();
            string sql    = "[a], [t1].[b], [t2].[c], (SELECT NOW()), [d]";

            Assert.AreEqual(sql, result);
        }
Exemplo n.º 14
0
        public void ColumnsListTableAlias2()
        {
            SuperSql.DefaultFormatter = FormatterLibrary.MsSql;

            var c = new ColumnsListSimple(SuperSql.DefaultFormatter);

            c.Append("a");
            c.SetTableAlias("t1");
            c.Append("b");
            c.SetTableAlias("t2");
            c.Append("c");
            c.SetTableAlias();
            c.RawValue("(SELECT NOW())");
            c.Append("d");
            var result = c.GetSql();
            var sql    = "[a], [t1].[b], [t2].[c], (SELECT NOW()), [d]";

            Assert.Equal(sql, result);
        }