Example #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RawTraceReader"/> class.
        /// </summary>
        /// <param name="con">The con.</param>
        public RawTraceReader(SqlConnection con)
        {
            this.connection = con;
            SetEventDelegate evtInt      = this.SetIntColumn;
            SetEventDelegate evtLong     = this.SetLongColumn;
            SetEventDelegate evtString   = this.SetStringColumn;
            SetEventDelegate evtByte     = this.SetByteColumn;
            SetEventDelegate evtDateTime = this.SetDateTimeColumn;
            SetEventDelegate evtGuid     = SetGuidColumn;

            this.EventDelegates[ProfilerEventColumns.TextData]          = evtString;
            this.EventDelegates[ProfilerEventColumns.BinaryData]        = evtByte;
            this.EventDelegates[ProfilerEventColumns.DatabaseID]        = evtInt;
            this.EventDelegates[ProfilerEventColumns.TransactionID]     = evtLong;
            this.EventDelegates[ProfilerEventColumns.LineNumber]        = evtInt;
            this.EventDelegates[ProfilerEventColumns.NTUserName]        = evtString;
            this.EventDelegates[ProfilerEventColumns.NTDomainName]      = evtString;
            this.EventDelegates[ProfilerEventColumns.HostName]          = evtString;
            this.EventDelegates[ProfilerEventColumns.ClientProcessID]   = evtInt;
            this.EventDelegates[ProfilerEventColumns.ApplicationName]   = evtString;
            this.EventDelegates[ProfilerEventColumns.LoginName]         = evtString;
            this.EventDelegates[ProfilerEventColumns.SPID]              = evtInt;
            this.EventDelegates[ProfilerEventColumns.Duration]          = evtLong;
            this.EventDelegates[ProfilerEventColumns.StartTime]         = evtDateTime;
            this.EventDelegates[ProfilerEventColumns.EndTime]           = evtDateTime;
            this.EventDelegates[ProfilerEventColumns.Reads]             = evtLong;
            this.EventDelegates[ProfilerEventColumns.Writes]            = evtLong;
            this.EventDelegates[ProfilerEventColumns.CPU]               = evtInt;
            this.EventDelegates[ProfilerEventColumns.Permissions]       = evtLong;
            this.EventDelegates[ProfilerEventColumns.Severity]          = evtInt;
            this.EventDelegates[ProfilerEventColumns.EventSubClass]     = evtInt;
            this.EventDelegates[ProfilerEventColumns.ObjectID]          = evtInt;
            this.EventDelegates[ProfilerEventColumns.Success]           = evtInt;
            this.EventDelegates[ProfilerEventColumns.IndexID]           = evtInt;
            this.EventDelegates[ProfilerEventColumns.IntegerData]       = evtInt;
            this.EventDelegates[ProfilerEventColumns.ServerName]        = evtString;
            this.EventDelegates[ProfilerEventColumns.EventClass]        = evtInt;
            this.EventDelegates[ProfilerEventColumns.ObjectType]        = evtInt;
            this.EventDelegates[ProfilerEventColumns.NestLevel]         = evtInt;
            this.EventDelegates[ProfilerEventColumns.State]             = evtInt;
            this.EventDelegates[ProfilerEventColumns.Error]             = evtInt;
            this.EventDelegates[ProfilerEventColumns.Mode]              = evtInt;
            this.EventDelegates[ProfilerEventColumns.Handle]            = evtInt;
            this.EventDelegates[ProfilerEventColumns.ObjectName]        = evtString;
            this.EventDelegates[ProfilerEventColumns.DatabaseName]      = evtString;
            this.EventDelegates[ProfilerEventColumns.FileName]          = evtString;
            this.EventDelegates[ProfilerEventColumns.OwnerName]         = evtString;
            this.EventDelegates[ProfilerEventColumns.RoleName]          = evtString;
            this.EventDelegates[ProfilerEventColumns.TargetUserName]    = evtString;
            this.EventDelegates[ProfilerEventColumns.DBUserName]        = evtString;
            this.EventDelegates[ProfilerEventColumns.LoginSid]          = evtByte;
            this.EventDelegates[ProfilerEventColumns.TargetLoginName]   = evtString;
            this.EventDelegates[ProfilerEventColumns.TargetLoginSid]    = evtByte;
            this.EventDelegates[ProfilerEventColumns.ColumnPermissions] = evtInt;
            this.EventDelegates[ProfilerEventColumns.LinkedServerName]  = evtString;
            this.EventDelegates[ProfilerEventColumns.ProviderName]      = evtString;
            this.EventDelegates[ProfilerEventColumns.MethodName]        = evtString;
            this.EventDelegates[ProfilerEventColumns.RowCounts]         = evtLong;
            this.EventDelegates[ProfilerEventColumns.RequestID]         = evtInt;
            this.EventDelegates[ProfilerEventColumns.XactSequence]      = evtLong;
            this.EventDelegates[ProfilerEventColumns.EventSequence]     = evtLong;
            this.EventDelegates[ProfilerEventColumns.BigintData1]       = evtLong;
            this.EventDelegates[ProfilerEventColumns.BigintData2]       = evtLong;
            this.EventDelegates[ProfilerEventColumns.GUID]              = evtGuid;
            this.EventDelegates[ProfilerEventColumns.IntegerData2]      = evtInt;
            this.EventDelegates[ProfilerEventColumns.ObjectID2]         = evtLong;
            this.EventDelegates[ProfilerEventColumns.Type]              = evtInt;
            this.EventDelegates[ProfilerEventColumns.OwnerID]           = evtInt;
            this.EventDelegates[ProfilerEventColumns.ParentName]        = evtString;
            this.EventDelegates[ProfilerEventColumns.IsSystem]          = evtInt;
            this.EventDelegates[ProfilerEventColumns.Offset]            = evtInt;
            this.EventDelegates[ProfilerEventColumns.SourceDatabaseID]  = evtInt;
            this.EventDelegates[ProfilerEventColumns.SqlHandle]         = evtByte;
            this.EventDelegates[ProfilerEventColumns.SessionLoginName]  = evtString;
            this.EventDelegates[ProfilerEventColumns.PlanHandle]        = evtByte;
        }
Example #2
0
        public RawTraceReader(SqlConnection con)
        {
            this.m_Conn = con;
            SetEventDelegate evtInt      = this.SetIntColumn;
            SetEventDelegate evtLong     = this.SetLongColumn;
            SetEventDelegate evtString   = this.SetStringColumn;
            SetEventDelegate evtByte     = this.SetByteColumn;
            SetEventDelegate evtDateTime = this.SetDateTimeColumn;
            SetEventDelegate evtGuid     = SetGuidColumn;

            /*
             *          select 'm_Delegates[ProfilerEventColumns.'+Name+'] = evt'+
             *          case Type_Name
             *                                  when 'text' then 'String'
             *                                  when 'int' then 'Int'
             *                                  when 'bigint' then 'Long'
             *                                  when 'nvarchar' then 'String'
             *                                  when 'datetime' then 'DateTime'
             *                                  when 'image' then 'Byte'
             *                                  when 'uniqueidentifier' then 'Guid'
             *                          end+';'
             *
             *          from sys.trace_columns
             *          order by trace_column_id
             *
             */
            this.m_Delegates[ProfilerEventColumns.TextData]          = evtString;
            this.m_Delegates[ProfilerEventColumns.BinaryData]        = evtByte;
            this.m_Delegates[ProfilerEventColumns.DatabaseID]        = evtInt;
            this.m_Delegates[ProfilerEventColumns.TransactionID]     = evtLong;
            this.m_Delegates[ProfilerEventColumns.LineNumber]        = evtInt;
            this.m_Delegates[ProfilerEventColumns.NTUserName]        = evtString;
            this.m_Delegates[ProfilerEventColumns.NTDomainName]      = evtString;
            this.m_Delegates[ProfilerEventColumns.HostName]          = evtString;
            this.m_Delegates[ProfilerEventColumns.ClientProcessID]   = evtInt;
            this.m_Delegates[ProfilerEventColumns.ApplicationName]   = evtString;
            this.m_Delegates[ProfilerEventColumns.LoginName]         = evtString;
            this.m_Delegates[ProfilerEventColumns.SPID]              = evtInt;
            this.m_Delegates[ProfilerEventColumns.Duration]          = evtLong;
            this.m_Delegates[ProfilerEventColumns.StartTime]         = evtDateTime;
            this.m_Delegates[ProfilerEventColumns.EndTime]           = evtDateTime;
            this.m_Delegates[ProfilerEventColumns.Reads]             = evtLong;
            this.m_Delegates[ProfilerEventColumns.Writes]            = evtLong;
            this.m_Delegates[ProfilerEventColumns.CPU]               = evtInt;
            this.m_Delegates[ProfilerEventColumns.Permissions]       = evtLong;
            this.m_Delegates[ProfilerEventColumns.Severity]          = evtInt;
            this.m_Delegates[ProfilerEventColumns.EventSubClass]     = evtInt;
            this.m_Delegates[ProfilerEventColumns.ObjectID]          = evtInt;
            this.m_Delegates[ProfilerEventColumns.Success]           = evtInt;
            this.m_Delegates[ProfilerEventColumns.IndexID]           = evtInt;
            this.m_Delegates[ProfilerEventColumns.IntegerData]       = evtInt;
            this.m_Delegates[ProfilerEventColumns.ServerName]        = evtString;
            this.m_Delegates[ProfilerEventColumns.EventClass]        = evtInt;
            this.m_Delegates[ProfilerEventColumns.ObjectType]        = evtInt;
            this.m_Delegates[ProfilerEventColumns.NestLevel]         = evtInt;
            this.m_Delegates[ProfilerEventColumns.State]             = evtInt;
            this.m_Delegates[ProfilerEventColumns.Error]             = evtInt;
            this.m_Delegates[ProfilerEventColumns.Mode]              = evtInt;
            this.m_Delegates[ProfilerEventColumns.Handle]            = evtInt;
            this.m_Delegates[ProfilerEventColumns.ObjectName]        = evtString;
            this.m_Delegates[ProfilerEventColumns.DatabaseName]      = evtString;
            this.m_Delegates[ProfilerEventColumns.FileName]          = evtString;
            this.m_Delegates[ProfilerEventColumns.OwnerName]         = evtString;
            this.m_Delegates[ProfilerEventColumns.RoleName]          = evtString;
            this.m_Delegates[ProfilerEventColumns.TargetUserName]    = evtString;
            this.m_Delegates[ProfilerEventColumns.DBUserName]        = evtString;
            this.m_Delegates[ProfilerEventColumns.LoginSid]          = evtByte;
            this.m_Delegates[ProfilerEventColumns.TargetLoginName]   = evtString;
            this.m_Delegates[ProfilerEventColumns.TargetLoginSid]    = evtByte;
            this.m_Delegates[ProfilerEventColumns.ColumnPermissions] = evtInt;
            this.m_Delegates[ProfilerEventColumns.LinkedServerName]  = evtString;
            this.m_Delegates[ProfilerEventColumns.ProviderName]      = evtString;
            this.m_Delegates[ProfilerEventColumns.MethodName]        = evtString;
            this.m_Delegates[ProfilerEventColumns.RowCounts]         = evtLong;
            this.m_Delegates[ProfilerEventColumns.RequestID]         = evtInt;
            this.m_Delegates[ProfilerEventColumns.XactSequence]      = evtLong;
            this.m_Delegates[ProfilerEventColumns.EventSequence]     = evtLong;
            this.m_Delegates[ProfilerEventColumns.BigintData1]       = evtLong;
            this.m_Delegates[ProfilerEventColumns.BigintData2]       = evtLong;
            this.m_Delegates[ProfilerEventColumns.GUID]              = evtGuid;
            this.m_Delegates[ProfilerEventColumns.IntegerData2]      = evtInt;
            this.m_Delegates[ProfilerEventColumns.ObjectID2]         = evtLong;
            this.m_Delegates[ProfilerEventColumns.Type]              = evtInt;
            this.m_Delegates[ProfilerEventColumns.OwnerID]           = evtInt;
            this.m_Delegates[ProfilerEventColumns.ParentName]        = evtString;
            this.m_Delegates[ProfilerEventColumns.IsSystem]          = evtInt;
            this.m_Delegates[ProfilerEventColumns.Offset]            = evtInt;
            this.m_Delegates[ProfilerEventColumns.SourceDatabaseID]  = evtInt;
            this.m_Delegates[ProfilerEventColumns.SqlHandle]         = evtByte;
            this.m_Delegates[ProfilerEventColumns.SessionLoginName]  = evtString;
            this.m_Delegates[ProfilerEventColumns.PlanHandle]        = evtByte;
        }