From: <aye...@us...> - 2010-01-08 06:57:38
|
Revision: 4914 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4914&view=rev Author: ayenderahien Date: 2010-01-08 06:57:28 +0000 (Fri, 08 Jan 2010) Log Message: ----------- Adding parameter type information for SQL log, that allow to detect issues with parameter types and length Modified Paths: -------------- trunk/nhibernate/src/NHibernate/AdoNet/Util/SqlStatementLogger.cs trunk/nhibernate/src/NHibernate.Test/SqlTest/Identity/MsSQL/MSSQLIdentityInsertWithStoredProcsTest.cs Property Changed: ---------------- trunk/nhibernate/ Property changes on: trunk/nhibernate ___________________________________________________________________ Modified: svn:mergeinfo - /branches/2.1.x/nhibernate:4690-4691,4696-4697,4711,4715-4716 + /branches/2.1.x/nhibernate:4690-4691,4696-4697,4711,4715-4716,4905-4908 Modified: trunk/nhibernate/src/NHibernate/AdoNet/Util/SqlStatementLogger.cs =================================================================== --- trunk/nhibernate/src/NHibernate/AdoNet/Util/SqlStatementLogger.cs 2010-01-06 22:32:59 UTC (rev 4913) +++ trunk/nhibernate/src/NHibernate/AdoNet/Util/SqlStatementLogger.cs 2010-01-08 06:57:28 UTC (rev 4914) @@ -93,14 +93,23 @@ } appendComma = true; p = (IDataParameter)command.Parameters[i]; - output.Append(string.Format("{0} = {1}", p.ParameterName, GetParameterLogableValue(p))); + output.Append(string.Format("{0} = {1} [Type: {2}]", p.ParameterName, GetParameterLogableValue(p), GetParameterLogableType(p))); } outputText = output.ToString(); } return outputText; } - public string GetParameterLogableValue(IDataParameter parameter) + private static string GetParameterLogableType(IDataParameter dataParameter) + { + var p = dataParameter as IDbDataParameter; + if (p != null) + return p.DbType + " (" + p.Size + ")"; + return p.DbType.ToString(); + + } + + public string GetParameterLogableValue(IDataParameter parameter) { if (parameter.Value == null || DBNull.Value.Equals(parameter.Value)) { Modified: trunk/nhibernate/src/NHibernate.Test/SqlTest/Identity/MsSQL/MSSQLIdentityInsertWithStoredProcsTest.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/SqlTest/Identity/MsSQL/MSSQLIdentityInsertWithStoredProcsTest.cs 2010-01-06 22:32:59 UTC (rev 4913) +++ trunk/nhibernate/src/NHibernate.Test/SqlTest/Identity/MsSQL/MSSQLIdentityInsertWithStoredProcsTest.cs 2010-01-08 06:57:28 UTC (rev 4914) @@ -14,7 +14,7 @@ protected override string GetExpectedInsertOrgLogStatement(string orgName) { - return string.Format("exec nh_organization_native_id_insert @p0;@p0 = '{0}'", orgName); + return string.Format("exec nh_organization_native_id_insert @p0;@p0 = '{0}' [Type: String ({1})]", orgName, orgName.Length); } protected override IList Mappings This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |