/// <summary> /// Tracks when 'command' is started. /// </summary> public void ExecuteStartImpl(IDbCommand command, SqlExecuteType type) { var id = Tuple.Create((object)command, type); var sqlTiming = new SqlTiming(command, type, Profiler); _inProgress[id] = sqlTiming; }
public string FormatSql(SqlTiming timing) { var sqlFormatter = new SqlServerFormatter(); var sqlFormat = sqlFormatter.FormatSql(timing); var poorMansFormatter = new TSqlStandardFormatter(); var fullFormatter = new SqlFormattingManager(poorMansFormatter); return fullFormatter.Format(sqlFormat); }
/// <summary> /// Adds the parameter <c>sqlTiming</c> to this Timing's <c>SqlTimings</c> collection. /// </summary> /// <param name="sqlTiming">A SQL statement profiling that was executed in this Timing step.</param> /// <remarks>Used outside this assembly for custom deserialization when creating an <see cref="Storage.IStorage"/> implementation.</remarks> public void AddSqlTiming(SqlTiming sqlTiming) { if (SqlTimings == null) { SqlTimings = new List <SqlTiming>(); } SqlTimings.Add(sqlTiming); sqlTiming.ParentTiming = this; }
/// <summary> /// Adds <paramref name="stats"/> to the current <see cref="Timing"/>. /// </summary> internal void AddSqlTiming(SqlTiming stats) { if (Head == null) { return; } int count; stats.IsDuplicate = _sqlExecutionCounts.TryGetValue(stats.CommandString, out count); _sqlExecutionCounts[stats.CommandString] = count + 1; HasSqlTimings = true; if (stats.IsDuplicate) { HasDuplicateSqlTimings = true; } Head.AddSqlTiming(stats); }
/// <summary> /// Adds <paramref name="stats"/> to the current <see cref="Timing"/>. /// </summary> internal void AddSqlTiming(SqlTiming stats) { if (Head == null) return; int count; stats.IsDuplicate = _sqlExecutionCounts.TryGetValue(stats.CommandString, out count); _sqlExecutionCounts[stats.CommandString] = count + 1; HasSqlTimings = true; if (stats.IsDuplicate) { HasDuplicateSqlTimings = true; } Head.AddSqlTiming(stats); }
/// <summary> /// Adds the parameter 'sqlTiming' to this Timing's SqlTimings collection. /// </summary> /// <param name="sqlTiming">A sql statement profiling that was executed in this Timing step.</param> /// <remarks> /// Used outside this assembly for custom deserialization when creating an <see cref="Storage.IStorage"/> implementation. /// </remarks> public void AddSqlTiming(SqlTiming sqlTiming) { if (SqlTimings == null) SqlTimings = new List<SqlTiming>(); SqlTimings.Add(sqlTiming); sqlTiming.ParentTiming = this; }
private void LogCommandAsError(Exception exception, ExecuteType type) { var formatter = new SqlServerFormatter(); SqlTiming timing = new SqlTiming(this, type, null); exception.Data["SQL"] = formatter.FormatSql(timing); }