|
From: <fab...@us...> - 2009-10-15 18:21:43
|
Revision: 4759
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4759&view=rev
Author: fabiomaulo
Date: 2009-10-15 18:21:31 +0000 (Thu, 15 Oct 2009)
Log Message:
-----------
Merge r4758 (fix NH-1979)
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/SqlGenerator.cs
trunk/nhibernate/src/NHibernate.Test/HQL/HQLFunctions.cs
Modified: trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/SqlGenerator.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/SqlGenerator.cs 2009-10-15 18:19:47 UTC (rev 4758)
+++ trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/SqlGenerator.cs 2009-10-15 18:21:31 UTC (rev 4759)
@@ -397,7 +397,14 @@
public void Parameter()
{
- args.Add(new SqlString(SqlCommand.Parameter.Placeholder));
+ if (argInd == args.Count)
+ {
+ args.Add(new SqlString(SqlCommand.Parameter.Placeholder));
+ }
+ else
+ {
+ args[argInd] = args[argInd].Append(new SqlString(SqlCommand.Parameter.Placeholder));
+ }
}
public void CommaBetweenParameters(string comma)
Modified: trunk/nhibernate/src/NHibernate.Test/HQL/HQLFunctions.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/HQL/HQLFunctions.cs 2009-10-15 18:19:47 UTC (rev 4758)
+++ trunk/nhibernate/src/NHibernate.Test/HQL/HQLFunctions.cs 2009-10-15 18:21:31 UTC (rev 4759)
@@ -736,6 +736,23 @@
}
}
+ [Test]
+ public void CastNH1979()
+ {
+ IgnoreIfNotSupported("cast");
+ using (ISession s = OpenSession())
+ {
+ Animal a1 = new Animal("abcdef", 1.3f);
+ s.Save(a1);
+ s.Flush();
+ }
+ using (ISession s = OpenSession())
+ {
+ string hql = "select cast(((a.BodyWeight + 50) / :divisor) as int) from Animal a";
+ IList l = s.CreateQuery(hql).SetInt32("divisor", 2).List();
+ Assert.AreEqual(1, l.Count);
+ }
+ }
[Test]
public void Current_TimeStamp()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|