Exemple #1
0
        /// <summary>
        /// Renders the clause in textual representation.
        /// </summary>
        /// <param name="writer">to output to</param>
        /// <param name="formatter">for NewLine-whitespace formatting</param>
        /// <param name="isTopLevel">to indicate if this select-clause is inside other clauses.</param>
        /// <param name="andDelete">indicator whether select and delete.</param>
        public void ToEPL(
            TextWriter writer,
            EPStatementFormatter formatter,
            bool isTopLevel,
            bool andDelete)
        {
            formatter.BeginSelect(writer, isTopLevel);
            writer.Write("select ");
            if (andDelete)
            {
                writer.Write("and delete ");
            }

            if (IsDistinct)
            {
                writer.Write("distinct ");
            }

            if (_streamSelector == StreamSelector.ISTREAM_ONLY)
            {
                // the default, no action
            }
            else if (_streamSelector == StreamSelector.RSTREAM_ONLY)
            {
                writer.Write("rstream ");
            }
            else if (_streamSelector == StreamSelector.RSTREAM_ISTREAM_BOTH)
            {
                writer.Write("irstream ");
            }

            if (_selectList != null && !_selectList.IsEmpty())
            {
                string delimiter = "";
                foreach (SelectClauseElement element in _selectList)
                {
                    writer.Write(delimiter);
                    element.ToEPLElement(writer);
                    delimiter = ", ";
                }
            }
            else
            {
                writer.Write('*');
            }
        }