Skip to content

Commit

Permalink
Revert ISqlFormatter to old API signature (#68).
Browse files Browse the repository at this point in the history
Extensions to ISqlFormatter and VerboseSqlFormatter from #48 postponed to v3.1.
Nuget to v3.0.12
  • Loading branch information
yellis committed Jun 8, 2014
1 parent 590352a commit 1382da6
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 12 deletions.
4 changes: 2 additions & 2 deletions MiniProfiler.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
<package>
<metadata>
<id>MiniProfiler</id>
<version>3.0.11</version>
<version>3.0.12</version>
<authors>Marc Gravell, Jarrod Dixon, Yaakov Ellis, Nick Craver</authors>
<owners>Marc Gravell, Jarrod Dixon, Yaakov Ellis, Nick Craver</owners>
<description>Lightweight mini-profiler, in particular designed for ASP.NET MVC sites</description>
<projectUrl>http://miniprofiler.com</projectUrl>
<licenseUrl>http://www.apache.org/licenses/LICENSE-2.0</licenseUrl>
<tags>profiler sql mvc asp.net performance profiling timing</tags>
<language>en-US</language>
<releaseNotes>See https://github.com/MiniProfiler/dotnet/releases for more info</releaseNotes>
<releaseNotes>Restores API signature for ISqlFormatter (see issue #68). VerboseSql and enhanced stored procedures pushed to v3.1. See https://github.com/MiniProfiler/dotnet/releases for more info</releaseNotes>
</metadata>
<files>
<file src="StackExchange.Profiling\bin\Release\MiniProfiler.*" target="lib\net40" />
Expand Down
6 changes: 4 additions & 2 deletions StackExchange.Profiling.Tests/SqlFormatterTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ private void CreateDbCommand(CommandType commandType)
private string GenerateOutput()
{
var sqlParameters = SqlTiming.GetCommandParameters(_dbCommand);
var output = _formatter.FormatSql(_commandText, sqlParameters, _dbCommand);
var output = _formatter.FormatSql(_commandText, sqlParameters);
return output;
}

Expand Down Expand Up @@ -99,6 +99,8 @@ private static DbType GetDbType(Type type)
return _dbTypeMap[type.TypeHandle];
}

// Code being removed for v3.0.x to maintain semver versioning. Will be present in v3.1+
/*
[Test]
public void EnsureVerboseSqlServerFormatterOnlyAddsInformation()
{
Expand All @@ -114,7 +116,7 @@ public void EnsureVerboseSqlServerFormatterOnlyAddsInformation()
// assert
Assert.AreEqual(expectedOutput, actualOutput);
}
}*/

[Test]
public void TabelQueryWithoutParameters()
Expand Down
2 changes: 1 addition & 1 deletion StackExchange.Profiling/SqlFormatters/ISqlFormatter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ public interface ISqlFormatter
/// <summary>
/// Return SQL the way you want it to look on the in the trace. Usually used to format parameters.
/// </summary>
string FormatSql(string commandText, List<SqlTimingParameter> parameters, IDbCommand command = null);
string FormatSql(string commandText, List<SqlTimingParameter> parameters);
}
}
2 changes: 1 addition & 1 deletion StackExchange.Profiling/SqlFormatters/InlineFormatter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public InlineFormatter(bool includeTypeInfo = false)
/// Formats the SQL in a generic friendly format, including the parameter type information
/// in a comment if it was specified in the InlineFormatter constructor
/// </summary>
public string FormatSql(string commandText, List<SqlTimingParameter> parameters, IDbCommand command = null)
public string FormatSql(string commandText, List<SqlTimingParameter> parameters)
{
if (parameters == null || parameters.Count == 0)
{
Expand Down
9 changes: 6 additions & 3 deletions StackExchange.Profiling/SqlFormatters/SqlServerFormatter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ static SqlServerFormatter()
/// <summary>
/// Formats the SQL in a SQL-Server friendly way, with DECLARE statements for the parameters up top.
/// </summary>
public virtual string FormatSql(string commandText, List<SqlTimingParameter> parameters, IDbCommand command = null)
public virtual string FormatSql(string commandText, List<SqlTimingParameter> parameters)
{
StringBuilder buffer = new StringBuilder();

Expand All @@ -72,15 +72,18 @@ public virtual string FormatSql(string commandText, List<SqlTimingParameter> par
.AppendLine();
}

// Code being removed for v3.0.x to maintain semver versioning. Will be present in v3.1+

// only treat 'StoredProcedure' differently since 'Text' may contain 'TableDirect' or 'StoredProcedure'
if (command != null && command.CommandType == CommandType.StoredProcedure)
/*if (command != null && command.CommandType == CommandType.StoredProcedure)
{
GenerateStoreProcedureCall(commandText, parameters, buffer);
}
else
{
buffer.Append(commandText);
}
}*/
buffer.Append(commandText);

string formattedText = TerminateSqlStatement(buffer.ToString());
return formattedText;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@

namespace StackExchange.Profiling.SqlFormatters
{
/// <summary>
// Code being removed for v3.0.x to maintain semver versioning. Will be present in v3.1+

/*/// <summary>
/// Formats SQL server queries with a DECLARE up top for parameter values
/// </summary>
///
public class VerboseSqlServerFormatter : SqlServerFormatter
{
/// <summary>
Expand All @@ -33,5 +36,5 @@ public override string FormatSql(string commandText, List<SqlTimingParameter> pa
return buffer.ToString();
}
}
}*/
}
2 changes: 1 addition & 1 deletion StackExchange.Profiling/SqlTiming.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public SqlTiming(IDbCommand command, SqlExecuteType type, MiniProfiler profiler)

if (MiniProfiler.Settings.SqlFormatter != null)
{
commandText = MiniProfiler.Settings.SqlFormatter.FormatSql(commandText, parameters, command);
commandText = MiniProfiler.Settings.SqlFormatter.FormatSql(commandText, parameters);
}

_customTiming = profiler.CustomTiming("sql", commandText, type.ToString());
Expand Down

0 comments on commit 1382da6

Please sign in to comment.