|
From: <ric...@us...> - 2009-08-14 17:06:48
|
Revision: 4693
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4693&view=rev
Author: ricbrown
Date: 2009-08-14 17:06:41 +0000 (Fri, 14 Aug 2009)
Log Message:
-----------
Merge r4692 (Fix NH-1920)
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Loader/QueryLoader.cs
trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
Added Paths:
-----------
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1920/
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1920/Fixture.cs
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1920/Mappings.hbm.xml
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1920/Model.cs
Modified: trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Loader/QueryLoader.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Loader/QueryLoader.cs 2009-08-14 16:53:29 UTC (rev 4692)
+++ trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Loader/QueryLoader.cs 2009-08-14 17:06:41 UTC (rev 4693)
@@ -106,21 +106,6 @@
return dialect.ApplyLocksToSql(sql, aliasedLockModes, keyColumnNames);
}
- protected override int BindParameterValues(IDbCommand statement, QueryParameters queryParameters, int startIndex,
- ISessionImplementor session)
- {
- int position = startIndex;
-
- IList<IParameterSpecification> parameterSpecs = _queryTranslator.CollectedParameterSpecifications;
-
- foreach (var spec in parameterSpecs)
- {
- position += spec.Bind(statement, queryParameters, session, position);
- }
-
- return position - startIndex;
- }
-
protected override string[] Aliases
{
get { return _sqlAliases; }
Property changes on: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1920
___________________________________________________________________
Added: bugtraq:url
+ http://jira.nhibernate.org/browse/%BUGID%
Added: bugtraq:logregex
+ NH-\d+
Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1920/Fixture.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1920/Fixture.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1920/Fixture.cs 2009-08-14 17:06:41 UTC (rev 4693)
@@ -0,0 +1,68 @@
+using System;
+using System.Collections.Generic;
+using NUnit.Framework;
+
+namespace NHibernate.Test.NHSpecificTest.NH1920
+{
+ [TestFixture]
+ public class Fixture : BugTestCase
+ {
+
+ [Test]
+ public void Can_Query_Without_Collection_Size_Condition()
+ {
+ using (ISession sess = OpenSession())
+ using (ITransaction tx = sess.BeginTransaction())
+ {
+ sess.SaveOrUpdate(new Customer() { IsDeleted = false });
+ tx.Commit();
+ }
+ using (ISession sess = OpenSession())
+ using (ITransaction tx = sess.BeginTransaction())
+ {
+ sess.EnableFilter("state").SetParameter("deleted", false);
+ var result = sess
+ .CreateQuery("from Customer c join c.Orders o where c.id > :cid")
+ .SetParameter("cid", 0)
+ .List();
+ Assert.That(result.Count == 0);
+ tx.Commit();
+ }
+ using (ISession sess = OpenSession())
+ using (ITransaction tx = sess.BeginTransaction())
+ {
+ sess.Delete("from System.Object");
+ tx.Commit();
+ }
+ }
+
+ [Test]
+ public void Can_Query_With_Collection_Size_Condition()
+ {
+ using (ISession sess = OpenSession())
+ using (ITransaction tx = sess.BeginTransaction())
+ {
+ sess.SaveOrUpdate(new Customer() { IsDeleted = false });
+ tx.Commit();
+ }
+ using (ISession sess = OpenSession())
+ using (ITransaction tx = sess.BeginTransaction())
+ {
+ sess.EnableFilter("state").SetParameter("deleted", false);
+ var result = sess
+ .CreateQuery("from Customer c join c.Orders o where c.id > :cid and c.Orders.size > 0")
+ .SetParameter("cid", 0)
+ .List();
+ Assert.That(result.Count == 0);
+ tx.Commit();
+ }
+ using (ISession sess = OpenSession())
+ using (ITransaction tx = sess.BeginTransaction())
+ {
+ sess.Delete("from System.Object");
+ tx.Commit();
+ }
+ }
+
+ }
+}
Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1920/Mappings.hbm.xml
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1920/Mappings.hbm.xml (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1920/Mappings.hbm.xml 2009-08-14 17:06:41 UTC (rev 4693)
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
+ assembly="NHibernate.Test"
+ namespace="NHibernate.Test.NHSpecificTest.NH1920">
+
+ <class name="Customer" table="Customers">
+ <id name="Id">
+ <generator class="native" />
+ </id>
+ <bag name="Orders">
+ <key column="Customer_Id" />
+ <one-to-many class="Order" />
+ <filter name="state" condition=":deleted = IsDeleted" />
+ </bag>
+ <property name="IsDeleted" not-null="true" />
+ </class>
+
+ <class name="Order" table="Orders">
+ <id name="Id">
+ <generator class="native" />
+ </id>
+ <property name="IsDeleted" not-null="true" />
+ <property name="Memo" not-null="false" />
+ <many-to-one name="Customer" class="Customer" column="Customer_Id" />
+ <filter name="state" condition=":deleted = IsDeleted" />
+ </class>
+
+ <filter-def name="state" condition=":deleted = IsDeleted">
+ <filter-param name="deleted" type="Boolean"/>
+ </filter-def>
+
+</hibernate-mapping>
Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1920/Model.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1920/Model.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1920/Model.cs 2009-08-14 17:06:41 UTC (rev 4693)
@@ -0,0 +1,28 @@
+using System;
+using System.Xml.Serialization;
+using System.Collections;
+using System.Collections.Generic;
+using System.Text;
+
+using NHibernate;
+using NHibernate.Classic;
+
+namespace NHibernate.Test.NHSpecificTest.NH1920
+{
+
+ public class Customer
+ {
+ public virtual int Id { get; set; }
+ public virtual bool IsDeleted { get; set; }
+ public virtual IList<Order> Orders { get; set; }
+ }
+
+ public class Order
+ {
+ public virtual int Id { get; set; }
+ public virtual bool IsDeleted { get; set; }
+ public virtual string Memo { get; set; }
+ public virtual Customer Customer { get; set; }
+ }
+
+}
Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-08-14 16:53:29 UTC (rev 4692)
+++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-08-14 17:06:41 UTC (rev 4693)
@@ -581,6 +581,8 @@
<Compile Include="NHSpecificTest\NH1908\Model.cs" />
<Compile Include="NHSpecificTest\NH1914\Fixture.cs" />
<Compile Include="NHSpecificTest\NH1914\Model.cs" />
+ <Compile Include="NHSpecificTest\NH1920\Fixture.cs" />
+ <Compile Include="NHSpecificTest\NH1920\Model.cs" />
<Compile Include="NHSpecificTest\NH473\Child.cs" />
<Compile Include="NHSpecificTest\NH473\Fixture.cs" />
<Compile Include="NHSpecificTest\NH473\Parent.cs" />
@@ -1994,6 +1996,7 @@
<EmbeddedResource Include="Criteria\Lambda\Mappings.hbm.xml" />
<EmbeddedResource Include="CfgTest\Loquacious\EntityToCache.hbm.xml" />
<Content Include="DynamicEntity\package.html" />
+ <EmbeddedResource Include="NHSpecificTest\NH1920\Mappings.hbm.xml" />
<EmbeddedResource Include="Linq\Mappings\Customer.hbm.xml" />
<EmbeddedResource Include="Linq\Mappings\Employee.hbm.xml" />
<EmbeddedResource Include="Linq\Mappings\Order.hbm.xml" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|