Skip to content

Commit 2b23a85

Browse files
committed
SqlStatementLogger: Also print parameter scale and precision. NH-3920.
1 parent 38719fb commit 2b23a85

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

src/NHibernate.Test/NHSpecificTest/Futures/FutureQueryFixture.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,9 @@ public void CanExecuteMultipleQueryWithSameParameterName()
138138
Assert.AreEqual(1, events.Length);
139139
var wholeLog = logSpy.GetWholeLog();
140140
string paramPrefix = ((DriverBase) Sfi.ConnectionProvider.Driver).NamedPrefix;
141-
Assert.That(wholeLog.Contains(paramPrefix + "p0 = 1 [Type: Int32 (0)], " + paramPrefix + "p1 = 2 [Type: Int32 (0)]"), Is.True);
141+
Assert.That(
142+
wholeLog,
143+
Is.StringContaining(paramPrefix + "p0 = 1 [Type: Int32 (0:0:0)], " + paramPrefix + "p1 = 2 [Type: Int32 (0:0:0)]"));
142144
}
143145
}
144146
}

src/NHibernate.Test/NHSpecificTest/Futures/LinqFutureFixture.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,9 +353,11 @@ public void CanExecuteMultipleQueriesOnSameExpression()
353353
Assert.AreEqual(1, events.Length);
354354
var wholeLog = logSpy.GetWholeLog();
355355
string paramPrefix = ((DriverBase)Sfi.ConnectionProvider.Driver).NamedPrefix;
356-
Assert.That(wholeLog.Contains(paramPrefix + "p0 = 1 [Type: Int32 (0)], " + paramPrefix + "p1 = 2 [Type: Int32 (0)]"), Is.True);
356+
Assert.That(
357+
wholeLog,
358+
Is.StringContaining(paramPrefix + "p0 = 1 [Type: Int32 (0:0:0)], " + paramPrefix + "p1 = 2 [Type: Int32 (0:0:0)]"));
357359
}
358360
}
359361
}
360362
}
361-
}
363+
}

src/NHibernate.Test/SqlTest/Identity/MsSQL/MSSQLIdentityInsertWithStoredProcsTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ protected override bool AppliesTo(Dialect.Dialect dialect)
1414

1515
protected override string GetExpectedInsertOrgLogStatement(string orgName)
1616
{
17-
return string.Format("exec nh_organization_native_id_insert @p0;@p0 = '{0}' [Type: String (4000)]", orgName);
17+
return string.Format("exec nh_organization_native_id_insert @p0;@p0 = '{0}' [Type: String (4000:0:0)]", orgName);
1818
}
1919

2020
protected override IList Mappings
2121
{
2222
get { return new[] { "SqlTest.Identity.MsSQL.MSSQLIdentityInsertWithStoredProcs.hbm.xml" }; }
2323
}
2424
}
25-
}
25+
}

src/NHibernate/AdoNet/Util/SqlStatementLogger.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ private static string GetParameterLoggableType(IDataParameter dataParameter)
107107
{
108108
var p = dataParameter as IDbDataParameter;
109109
if (p != null)
110-
return p.DbType + " (" + p.Size + ")";
110+
return p.DbType + " (" + p.Size + ":" + p.Scale + ":" + p.Precision + ")";
111111
return dataParameter.DbType.ToString();
112112
}
113113

0 commit comments

Comments
 (0)