Exemple #1
0
        /// <summary>
        ///     Renders the clause in textual representation.
        /// </summary>
        /// <param name="writer">to output to</param>
        /// <param name="optionalWhereClause">where clause if present, or null</param>
        /// <param name="formatter">for newline-whitespace formatting</param>
        public void ToEPL(
            TextWriter writer,
            Expression optionalWhereClause,
            EPStatementFormatter formatter)
        {
            formatter.BeginMerge(writer);
            writer.Write("merge ");
            writer.Write(WindowName);

            if (OptionalAsName != null)
            {
                writer.Write(" as ");
                writer.Write(OptionalAsName);
            }

            if (InsertNoMatch != null)
            {
                writer.Write(" ");
                InsertNoMatch.ToEPL(writer);
            }
            else
            {
                if (optionalWhereClause != null)
                {
                    formatter.BeginMergeWhere(writer);
                    writer.Write("where ");
                    optionalWhereClause.ToEPL(writer, ExpressionPrecedenceEnum.MINIMUM);
                }

                foreach (var item in MatchItems)
                {
                    item.ToEPL(writer, formatter);
                }
            }
        }