Esempio n. 1
0
        public void JoinPrimitives2()
        {
            Join j = new Join(global::SqlBuilder.Format.MsSQL, "users", "u", Enums.JoinType.INNER);

            j.Append("id_user", "id").Append("id_admin", "id");

            string result = j.GetSql("t");
            string sql    = "INNER JOIN [users] as [u] ON [t].[id_user]=[u].[id] AND [t].[id_admin]=[u].[id]";

            Assert.AreEqual(result, sql);
        }
Esempio n. 2
0
        public void JoinPrimitivesFull()
        {
            Join j = new Join(global::SqlBuilder.Format.MsSQL, "users", type: Enums.JoinType.FULL);

            j.Append("id_user", "id");

            string result = j.GetSql("t");
            string sql    = "FULL JOIN [users] ON [t].[id_user]=[users].[id]";

            Assert.AreEqual(result, sql);
        }
Esempio n. 3
0
        public void JoinPrimitivesInner()
        {
            Join j = new Join(global::SqlBuilder.Format.MsSQL, "users");

            j.Append("id_user", "id");

            string result = j.GetSql("t");
            string sql    = "INNER JOIN [users] ON [t].[id_user]=[users].[id]";

            Assert.AreEqual(result, sql);
        }
Esempio n. 4
0
        public void JoinPrimitives2()
        {
            NKnife.Storages.SQL.Common.SuperSql.DefaultFormatter = FormatterLibrary.MsSql;

            Join j = new Join("users", "u");

            j.Append("id_user", "id").Append("id_admin", "id");

            string result = j.GetSql("t");
            string sql    = "INNER JOIN [users] as [u] ON [t].[id_user]=[u].[id] AND [t].[id_admin]=[u].[id]";

            Assert.Equal(result, sql);
        }
Esempio n. 5
0
        public void JoinPrimitivesFull()
        {
            NKnife.Storages.SQL.Common.SuperSql.DefaultFormatter = FormatterLibrary.MsSql;

            Join j = new Join("users", type: JoinType.FULL);

            j.Append("id_user", "id");

            string result = j.GetSql("t");
            string sql    = "FULL JOIN [users] ON [t].[id_user]=[users].[id]";

            Assert.Equal(result, sql);
        }
Esempio n. 6
0
        public void JoinPrimitives2()
        {
            SqlBuilder.DefaultFormatter = FormatterLibrary.MsSql;

            Join j = new Join("users", "u");

            j.Append("id_user", "id").Append("id_admin", "id");

            string result = j.GetSql("t");
            string sql    = "INNER JOIN [users] as [u] ON [t].[id_user]=[u].[id] AND [t].[id_admin]=[u].[id]";

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

            Join j = new Join("users", type: Enums.JoinType.FULL);

            j.Append("id_user", "id");

            string result = j.GetSql("t");
            string sql    = "FULL JOIN [users] ON [t].[id_user]=[users].[id]";

            Assert.AreEqual(result, sql);
        }
Esempio n. 8
0
        public void JoinSimpleTwoTables()
        {
            JoinList list = new JoinList(NKnife.Storages.SQL.Common.SuperSql.DefaultFormatter);

            Join j1 = new Join("users");

            j1.Append("id_user", "id").Append("id_admin", "id");
            list.Append(j1);

            Join j2 = new Join("profiles", "p", JoinType.LEFT);

            j2.Append("id_profile", "id");
            list.Append(j2);

            string result = list.GetSql("t");
            string sql    = "INNER JOIN [users] ON [t].[id_user]=[users].[id] AND [t].[id_admin]=[users].[id] LEFT JOIN [profiles] as [p] ON [t].[id_profile]=[p].[id]";

            Assert.Equal(result, sql);
        }
Esempio n. 9
0
        public void JoinSimpleTwoTables()
        {
            JoinList list = new JoinList(global::SqlBuilder.Format.MsSQL);

            Join j1 = new Join(global::SqlBuilder.Format.MsSQL, "users");

            j1.Append("id_user", "id").Append("id_admin", "id");
            list.Append(j1);

            Join j2 = new Join(global::SqlBuilder.Format.MsSQL, "profiles", "p", Enums.JoinType.LEFT);

            j2.Append("id_profile", "id");
            list.Append(j2);

            string result = list.GetSql("t");
            string sql    = "INNER JOIN [users] ON [t].[id_user]=[users].[id] AND [t].[id_admin]=[users].[id] LEFT JOIN [profiles] as [p] ON [t].[id_profile]=[p].[id]";

            Assert.AreEqual(result, sql);
        }