|
From: <fab...@us...> - 2011-05-30 17:31:45
|
Revision: 5888
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5888&view=rev
Author: fabiomaulo
Date: 2011-05-30 17:31:39 +0000 (Mon, 30 May 2011)
Log Message:
-----------
Fixed NH-2318 for HQL and LINQ
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Dialect/Function/AnsiTrimEmulationFunction.cs
trunk/nhibernate/src/NHibernate/Param/PositionalParameterSpecification.cs
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2318/Fixture.cs
Modified: trunk/nhibernate/src/NHibernate/Dialect/Function/AnsiTrimEmulationFunction.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Dialect/Function/AnsiTrimEmulationFunction.cs 2011-05-30 16:50:30 UTC (rev 5887)
+++ trunk/nhibernate/src/NHibernate/Dialect/Function/AnsiTrimEmulationFunction.cs 2011-05-30 17:31:39 UTC (rev 5888)
@@ -111,7 +111,7 @@
// are present and "do the right thing"
bool leading = true; // should leading trim-characters be trimmed?
bool trailing = true; // should trailing trim-characters be trimmed?
- string trimCharacter = null; // the trim-character
+ object trimCharacter = null; // the trim-character
object trimSource = null; // the trim-source
// potentialTrimCharacterArgIndex = 1 assumes that a
@@ -147,7 +147,7 @@
}
else
{
- trimCharacter = potentialTrimCharacter.ToString();
+ trimCharacter = potentialTrimCharacter;
if (StringHelper.EqualsCaseInsensitive("from", args[potentialTrimCharacterArgIndex + 1].ToString()))
{
trimSource = args[potentialTrimCharacterArgIndex + 2];
@@ -158,9 +158,7 @@
}
}
- IList argsToUse = new List<object>();
- argsToUse.Add(trimSource);
- argsToUse.Add(trimCharacter);
+ IList argsToUse = new List<object> {trimSource, trimCharacter};
if (trimCharacter.Equals("' '"))
{
Modified: trunk/nhibernate/src/NHibernate/Param/PositionalParameterSpecification.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Param/PositionalParameterSpecification.cs 2011-05-30 16:50:30 UTC (rev 5887)
+++ trunk/nhibernate/src/NHibernate/Param/PositionalParameterSpecification.cs 2011-05-30 17:31:39 UTC (rev 5888)
@@ -56,8 +56,11 @@
object value = queryParameters.PositionalParameterValues[hqlPosition];
string backTrackId = GetIdsForBackTrack(session.Factory).First(); // just the first because IType suppose the oders in certain sequence
- int position = sqlQueryParametersList.GetEffectiveParameterLocations(backTrackId).Single(); // an HQL positional parameter can't appear more than once
- type.NullSafeSet(command, value, position, session);
+ // an HQL positional parameter can appear more than once because a custom HQL-Function can duplicate it
+ foreach (int position in sqlQueryParametersList.GetEffectiveParameterLocations(backTrackId))
+ {
+ type.NullSafeSet(command, value, position, session);
+ }
}
public override void SetEffectiveType(QueryParameters queryParameters)
Modified: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2318/Fixture.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2318/Fixture.cs 2011-05-30 16:50:30 UTC (rev 5887)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2318/Fixture.cs 2011-05-30 17:31:39 UTC (rev 5888)
@@ -70,7 +70,6 @@
}
[Test]
- [Ignore]
public void LinqTrimFunctionsWithParameters()
{
AddObjects();
@@ -94,7 +93,6 @@
}
[Test]
- [Ignore]
public void HqlTrimFunctionsWithParameters()
{
AddObjects();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|