Exemple #1
0
 public override object VisitUdfFunctionCall([NotNull] PostgresParser.UdfFunctionCallContext context)
 {
     var res = new ScalarFunction((Identifier)Visit(context.uid()));
     if (context.functionArgs() != null)
         foreach (var exp in (List<Expression>)Visit(context.functionArgs()))
             res.AddChild(exp);
     return res;
 }
Exemple #2
0
        public void FunctionEquals()
        {
            var func1 = new ScalarFunction("func");

            func1.AddChild(new IntConstant(1));
            func1.AddChild(new StringConstant("abc"));

            var func2 = new ScalarFunction("func");

            func2.AddChild(new IntConstant(1));
            func2.AddChild(new StringConstant("abc"));
            Assert.Equal(func1, func2);

            var func3 = new ScalarFunction("func");

            func3.AddChild(new StringConstant("abc"));
            func3.AddChild(new IntConstant(1));
            Assert.NotEqual(func1, func3);

            var func4 = (ScalarFunction)func2.Clone();

            func4.SetChild(0, new StringConstant("123"));

            Assert.NotEqual(func2, func4);

            var func5 = new ScalarFunction("func");

            Assert.NotEqual(func1, func5);

            var func6 = new ScalarFunction("func");

            func6.AddChild(new IntConstant(1));
            Assert.NotEqual(func1, func6);

            var func7 = new ScalarFunction("func");

            func7.AddChild(new ColumnRef("tt", "col"));
            Assert.Single(func7.GetColumns());
            Assert.Equal(new ColumnRef("tt", "col"), func7.GetColumns()[0]);
        }