protected override void AppendTo(SqlStringBuilder builder)
        {
            var orReplace = ReplaceIfExists ? "OR REPLACE" : "";

            builder.AppendFormat("CREATE {0}FUNCTION ", orReplace);
            FunctionName.AppendTo(builder);

            builder.Append("(");
            if (Parameters != null && Parameters.Length > 0)
            {
                for (int i = 0; i < Parameters.Length; i++)
                {
                    Parameters[i].AppendTo(builder);

                    if (i < Parameters.Length - 1)
                    {
                        builder.Append(", ");
                    }
                }
            }

            builder.Append(")");

            builder.Append(" RETURN ");
            ReturnType.AppendTo(builder);
            builder.AppendLine(" IS");

            builder.Indent();

            Body.AppendTo(builder);

            builder.DeIndent();
        }
Ejemplo n.º 2
0
        protected override void AppendTo(SqlStringBuilder builder)
        {
            FunctionName.AppendTo(builder);
            builder.Append("(");

            for (int i = 0; i < Arguments.Length; i++)
            {
                Arguments[i].AppendTo(builder);

                if (i < Arguments.Length - 1)
                {
                    builder.Append(", ");
                }
            }

            builder.Append(")");
        }