Exemplo n.º 1
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = _lastRunSeconds.GetHashCode();
         hashCode = (hashCode * 397) ^ Sort.GetHashCode();
         hashCode = (hashCode * 397) ^ MinExecs.GetHashCode();
         hashCode = (hashCode * 397) ^ MinExecsPerMin.GetHashCode();
         hashCode = (hashCode * 397) ^ (Search?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ MaxResultCount.GetHashCode();
         hashCode = (hashCode * 397) ^ Database.GetHashCode();
         return(hashCode);
     }
 }
            public string ToSQLWhere()
            {
                var clauses = new List <string>();

                if (MinExecs.GetValueOrDefault(0) > 0)
                {
                    clauses.Add("execution_count >= @MinExecs");
                }
                if (MinExecsPerMin.GetValueOrDefault(0) > 0)
                {
                    clauses.Add("(Case When DATEDIFF(mi, creation_time, qs.last_execution_time) > 0 Then CAST((1.00 * execution_count / DATEDIFF(mi, creation_time, qs.last_execution_time)) AS money) Else Null End) >= @MinExecsPerMin");
                }
                if (MinLastRunDate.HasValue)
                {
                    clauses.Add("qs.last_execution_time >= @MinLastRunDate");
                }
                if (Database.HasValue)
                {
                    clauses.Add("Cast(pa.value as Int) = @Database");
                }

                return(clauses.Any() ? "\n       And " + string.Join("\n       And ", clauses) : "");
            }
Exemplo n.º 3
0
            public string ToSQLWhere()
            {
                var clauses = new List <string>();

                if (MinExecs.GetValueOrDefault(0) > 0)
                {
                    clauses.Add("execution_count >= @MinExecs");
                }
                if (MinExecsPerMin.GetValueOrDefault(0) > 0)
                {
                    clauses.Add("(Case When DATEDIFF(mi, creation_time, qs.last_execution_time) > 0 Then CAST((1.00 * execution_count / DATEDIFF(mi, creation_time, qs.last_execution_time)) AS money) Else Null End) >= @MinExecsPerMin");
                }
                if (Search.HasValue())
                {
                    clauses.Add("SUBSTRING(st.text, ( qs.statement_start_offset / 2 ) + 1, ( ( CASE qs.statement_end_offset WHEN -1 THEN DATALENGTH(st.text) ELSE qs.statement_end_offset END - qs.statement_start_offset ) / 2 ) + 1) Like '%' + @Search + '%'");
                }
                if (MinLastRunDate.HasValue)
                {
                    clauses.Add("qs.last_execution_time >= @MinLastRunDate");
                }

                return(clauses.Any() ? " WHERE " + string.Join("\n  AND ", clauses) : "");
            }