From: <pa...@us...> - 2011-06-04 05:53:36
|
Revision: 5904 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5904&view=rev Author: patearl Date: 2011-06-04 05:53:30 +0000 (Sat, 04 Jun 2011) Log Message: ----------- Don't try to set parameter locations for parameters that have been removed from the SQL. Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Param/ParametersBackTrackExtensions.cs Modified: trunk/nhibernate/src/NHibernate/Param/ParametersBackTrackExtensions.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Param/ParametersBackTrackExtensions.cs 2011-06-04 05:07:45 UTC (rev 5903) +++ trunk/nhibernate/src/NHibernate/Param/ParametersBackTrackExtensions.cs 2011-06-04 05:53:30 UTC (rev 5904) @@ -52,13 +52,16 @@ { string firstParameterId = specification.GetIdsForBackTrack(factory).First(); int[] effectiveParameterLocations = sqlQueryParametersList.GetEffectiveParameterLocations(firstParameterId).ToArray(); - int firstParamNameIndex = effectiveParameterLocations.First(); - foreach (int location in effectiveParameterLocations) + if (effectiveParameterLocations.Length > 0) // Parameters previously present might have been removed from the SQL at a later point. { - int parameterSpan = specification.ExpectedType.GetColumnSpan(factory); - for (int j = 0; j < parameterSpan; j++) + int firstParamNameIndex = effectiveParameterLocations.First(); + foreach (int location in effectiveParameterLocations) { - sqlQueryParametersList[location + j].ParameterPosition = firstParamNameIndex + j; + int parameterSpan = specification.ExpectedType.GetColumnSpan(factory); + for (int j = 0; j < parameterSpan; j++) + { + sqlQueryParametersList[location + j].ParameterPosition = firstParamNameIndex + j; + } } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |