Exemplo n.º 1
0
        public AddTraceFilterErrorCode AddTraceFilter <T>(TraceField traceField, LogicalOperator logicalOp, ComparisonOperator compOp, T value)
        {
            if (traceId == 0)
            {
                throw new NotInitializedProfilerException();
            }

            SqlCommand cmd = MsSqlUtil.NewStoredProcedure("sp_trace_setfilter");

            MsSqlUtil.AddInParam(cmd, "@traceid", traceId);
            MsSqlUtil.AddInParam(cmd, "@columnid", (int)traceField);
            MsSqlUtil.AddInParam(cmd, "@logical_operator", (int)logicalOp);
            MsSqlUtil.AddInParam(cmd, "@comparison_operator", (int)compOp);
            MsSqlUtil.AddInParam(cmd, "@value", value);
            return((AddTraceFilterErrorCode)MsSqlUtil.ExecuteStoredProcedure(cmd, connInfo.CreateConnectionObject()));
        }
Exemplo n.º 2
0
        public static int ExecuteStoredProcedure(SqlCommand cmd, IDbConnection conn)
        {
            SqlParameter ret = MsSqlUtil.AddReturnParam(cmd);

            cmd.Connection = (SqlConnection)conn;
            conn.Open();

            try
            {
                cmd.ExecuteNonQuery();
                return(Convert.ToInt32(ret.Value));
            }
            finally
            {
                conn.Close();
            }
        }
Exemplo n.º 3
0
        public AddTraceEventErrorCode AddTraceEvent(TraceEvent traceEvent, params TraceField[] traceFields)
        {
            if (traceId == 0)
            {
                throw new NotInitializedProfilerException();
            }

            foreach (TraceField field in traceFields)
            {
                SqlCommand cmd = MsSqlUtil.NewStoredProcedure("sp_trace_setevent");
                MsSqlUtil.AddInParam(cmd, "@traceid", traceId);
                MsSqlUtil.AddInParam(cmd, "@eventid", (int)traceEvent);
                MsSqlUtil.AddInParam(cmd, "@columnid", (int)field);
                MsSqlUtil.AddInParam(cmd, "@on", true);
                MsSqlUtil.ExecuteStoredProcedure(cmd, connInfo.CreateConnectionObject());

                if (!this.traceFields.Contains(field.ToString()))
                {
                    this.traceFields.Add(field.ToString());
                }
            }

            return(AddTraceEventErrorCode.NoError);
        }