public static SqlFunctionCallScalarExpression Create(
            string name,
            bool isUdf,
            IReadOnlyList <SqlScalarExpression> arguments)
        {
            if (!SqlFunctionCallScalarExpression.FunctionIdentifiers.TryGetValue(name, out SqlIdentifier sqlIdentifier))
            {
                sqlIdentifier = SqlIdentifier.Create(name);
            }

            return(SqlFunctionCallScalarExpression.Create(sqlIdentifier, isUdf, arguments));
        }
        public override SqlObject Visit(SqlFunctionCallScalarExpression sqlFunctionCallScalarExpression)
        {
            SqlScalarExpression[] items = new SqlScalarExpression[sqlFunctionCallScalarExpression.Arguments.Count];
            for (int i = 0; i < sqlFunctionCallScalarExpression.Arguments.Count; i++)
            {
                items[i] = sqlFunctionCallScalarExpression.Arguments[i].Accept(this) as SqlScalarExpression;
            }

            return(SqlFunctionCallScalarExpression.Create(
                       sqlFunctionCallScalarExpression.Name,
                       sqlFunctionCallScalarExpression.IsUdf,
                       items));
        }
        public static SqlFunctionCallScalarExpression Create(
            string name,
            bool isUdf,
            params SqlScalarExpression[] arguments)
        {
            SqlIdentifier sqlIdentifier;

            if (!SqlFunctionCallScalarExpression.FunctionIdentifiers.TryGetValue(name, out sqlIdentifier))
            {
                sqlIdentifier = SqlIdentifier.Create(name);
            }

            return(SqlFunctionCallScalarExpression.Create(sqlIdentifier, isUdf, arguments));
        }
예제 #4
0
        public override int Visit(SqlFunctionCallScalarExpression sqlFunctionCallScalarExpression)
        {
            int hashCode = SqlFunctionCallScalarExpressionHashCode;

            if (sqlFunctionCallScalarExpression.IsUdf)
            {
                hashCode = CombineHashes(hashCode, SqlFunctionCallScalarExpressionUdfHashCode);
            }

            hashCode = CombineHashes(hashCode, sqlFunctionCallScalarExpression.Name.Accept(this));
            for (int i = 0; i < sqlFunctionCallScalarExpression.Arguments.Count; i++)
            {
                hashCode = CombineHashes(hashCode, sqlFunctionCallScalarExpression.Arguments[i].Accept(this));
            }

            return(hashCode);
        }
        public override void Visit(SqlFunctionCallScalarExpression sqlFunctionCallScalarExpression)
        {
            if (sqlFunctionCallScalarExpression.IsUdf)
            {
                this.writer.Write("udf.");
            }

            sqlFunctionCallScalarExpression.Name.Accept(this);
            this.writer.Write("(");
            for (int i = 0; i < sqlFunctionCallScalarExpression.Arguments.Count; i++)
            {
                if (i > 0)
                {
                    this.writer.Write(", ");
                }

                sqlFunctionCallScalarExpression.Arguments[i].Accept(this);
            }

            this.writer.Write(")");
        }
        public override void Visit(SqlFunctionCallScalarExpression sqlFunctionCallScalarExpression)
        {
            if (sqlFunctionCallScalarExpression.IsUdf)
            {
                this.writer.Write("udf.");
            }

            sqlFunctionCallScalarExpression.Name.Accept(this);
            int numberOfArguments = sqlFunctionCallScalarExpression.Arguments.Count();

            if (numberOfArguments == 0)
            {
                this.writer.Write("()");
            }
            else if (numberOfArguments == 1)
            {
                this.writer.Write("(");
                sqlFunctionCallScalarExpression.Arguments[0].Accept(this);
                this.writer.Write(")");
            }
            else
            {
                this.WriteStartContext("(");

                for (int i = 0; i < sqlFunctionCallScalarExpression.Arguments.Count; i++)
                {
                    if (i > 0)
                    {
                        this.WriteDelimiter(",");
                    }

                    sqlFunctionCallScalarExpression.Arguments[i].Accept(this);
                }

                this.WriteEndContext(")");
            }
        }
 public static SqlFunctionCallScalarExpression CreateBuiltin(SqlIdentifier name, params SqlScalarExpression[] arguments)
 {
     return(SqlFunctionCallScalarExpression.Create(name, false, arguments));
 }
 public static SqlFunctionCallScalarExpression CreateBuiltin(SqlIdentifier name, IReadOnlyList <SqlScalarExpression> arguments)
 {
     return(SqlFunctionCallScalarExpression.Create(name, false, arguments));
 }
 public abstract void Visit(SqlFunctionCallScalarExpression scalarExpression);
 public static SqlFunctionCallScalarExpression CreateBuiltin(
     string name,
     params SqlScalarExpression[] arguments) => SqlFunctionCallScalarExpression.Create(name, false, arguments);
 public static SqlFunctionCallScalarExpression CreateBuiltin(
     string name,
     IReadOnlyList <SqlScalarExpression> arguments) => SqlFunctionCallScalarExpression.Create(name, false, arguments);
 protected abstract SqlScalarExpression Visit(SqlFunctionCallScalarExpression expression);