Esempio n. 1
0
        // Equivalent to TSQL PRINT statement -- sends an info-only message.
        public void Send(string message)
        {
            ADP.CheckArgumentNull(message, "message");

            if (SmiMetaData.MaxUnicodeCharacters < message.Length)
            {
                throw SQL.SqlPipeMessageTooLong(message.Length);
            }

            SetPipeBusy( );
            try {
                EnsureNormalSendValid("Send");

                _smiContext.SendMessageToPipe(message, _eventSink);

                // Handle any errors that are reported.
                _eventSink.ProcessMessagesAndThrow();
            }
            catch {
                _eventSink.CleanMessages();
                throw;
            }
            finally {
                ClearPipeBusy( );
                Debug.Assert(_eventSink.HasMessages == false, "There should be no messages left in _eventsink at the end of the Send message!");
            }
        }
        internal void CleanMessages()
        {
            SmiEventSink_Default parent = (SmiEventSink_Default)_parent;

            if (null != parent)
            {
                parent.CleanMessages();
            }
            else
            {
                _errors   = null;
                _warnings = null;
            }
        }