public void Concat()
        {
            Person person = new Person();

            Exception ex = Assert.Throws <InvalidOperationException>(() => SqlExp.Concat(person.Name, person.SurName));

            Assert.Equal("Only for expressions.", ex.Message);
        }
Example #2
0
        public void Concat()
        {
            Person    person = null;
            IFunction func   = (IFunction)sql.Val(() => SqlExp.Concat(person.Name, person.SurName));

            QueryResult result = engine.Compile(func);

            Assert.Equal("CONCAT(`person`.`Name`, `person`.`SurName`)", result.Sql);
            Assert.Equal(new Dictionary <string, object>(), result.Parameters);
        }
        public void ConcatOr_Invalid()
        {
            engine.AddFunction(FunctionName.Concat, FunctionHelper.ConcatOr);

            IFunction func = (IFunction)sql.Val(() => SqlExp.Concat());

            Exception ex = Assert.Throws <CompileException>(() => engine.Compile(func));

            Assert.Equal("Invalid function \"CONCAT\", wrong number of parameters.", ex.Message);
        }
Example #4
0
        public void Concat()
        {
            Person    person = null;
            IFunction func   = (IFunction)sql.Val(() => SqlExp.Concat(person.Name, person.SurName));

            QueryResult result = engine.Compile(func);

            Assert.Equal("\"PERSON\".\"NAME\" || \"PERSON\".\"SURNAME\"", result.Sql);
            Assert.Equal(new Dictionary <string, object>(), result.Parameters);
        }
Example #5
0
        public void Concat_With_Or()
        {
            engine.AddFunction(FunctionName.Concat, FunctionHelper.ConcatOr);

            Person    person = null;
            IFunction func   = (IFunction)sql.Val(() => SqlExp.Concat(person.Name, person.SurName));

            QueryResult result = engine.Compile(func);

            Assert.Equal("\"person\".\"Name\" || \"person\".\"SurName\"", result.Sql);
            Assert.Equal(new Dictionary <string, object>(), result.Parameters);
        }