You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
(248) |
May
(82) |
Jun
(90) |
Jul
(177) |
Aug
(253) |
Sep
(157) |
Oct
(151) |
Nov
(143) |
Dec
(278) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(152) |
Feb
(107) |
Mar
(177) |
Apr
(133) |
May
(259) |
Jun
(81) |
Jul
(119) |
Aug
(306) |
Sep
(416) |
Oct
(240) |
Nov
(329) |
Dec
(206) |
2006 |
Jan
(466) |
Feb
(382) |
Mar
(153) |
Apr
(162) |
May
(133) |
Jun
(21) |
Jul
(18) |
Aug
(37) |
Sep
(97) |
Oct
(114) |
Nov
(110) |
Dec
(28) |
2007 |
Jan
(74) |
Feb
(65) |
Mar
(49) |
Apr
(76) |
May
(43) |
Jun
(15) |
Jul
(68) |
Aug
(55) |
Sep
(63) |
Oct
(59) |
Nov
(70) |
Dec
(66) |
2008 |
Jan
(71) |
Feb
(60) |
Mar
(120) |
Apr
(31) |
May
(48) |
Jun
(81) |
Jul
(107) |
Aug
(51) |
Sep
(80) |
Oct
(83) |
Nov
(83) |
Dec
(79) |
2009 |
Jan
(83) |
Feb
(110) |
Mar
(97) |
Apr
(91) |
May
(291) |
Jun
(250) |
Jul
(197) |
Aug
(58) |
Sep
(54) |
Oct
(122) |
Nov
(68) |
Dec
(34) |
2010 |
Jan
(50) |
Feb
(17) |
Mar
(63) |
Apr
(61) |
May
(84) |
Jun
(81) |
Jul
(138) |
Aug
(144) |
Sep
(78) |
Oct
(26) |
Nov
(30) |
Dec
(61) |
2011 |
Jan
(33) |
Feb
(35) |
Mar
(166) |
Apr
(221) |
May
(109) |
Jun
(76) |
Jul
(27) |
Aug
(37) |
Sep
(1) |
Oct
(4) |
Nov
(2) |
Dec
(1) |
2012 |
Jan
|
Feb
|
Mar
(2) |
Apr
(2) |
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
(1) |
Oct
|
Nov
(1) |
Dec
|
2013 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(1) |
Sep
(3) |
Oct
(2) |
Nov
|
Dec
(1) |
2014 |
Jan
(1) |
Feb
(1) |
Mar
(3) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <aye...@us...> - 2009-09-16 02:11:26
|
Revision: 4716 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4716&view=rev Author: ayenderahien Date: 2009-09-16 02:11:15 +0000 (Wed, 16 Sep 2009) Log Message: ----------- Can now use DetachedCriteria with IStatelessSession - NH-1922 Modified Paths: -------------- branches/2.1.x/nhibernate/src/NHibernate/Criterion/DetachedCriteria.cs branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj Added Paths: ----------- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1922/ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1922/Fixture.cs branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1922/Mappings.hbm.xml branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1922/Model.cs Modified: branches/2.1.x/nhibernate/src/NHibernate/Criterion/DetachedCriteria.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Criterion/DetachedCriteria.cs 2009-09-16 01:57:36 UTC (rev 4715) +++ branches/2.1.x/nhibernate/src/NHibernate/Criterion/DetachedCriteria.cs 2009-09-16 02:11:15 UTC (rev 4716) @@ -1,4 +1,5 @@ using System; +using NHibernate.Engine; using NHibernate.Impl; using NHibernate.SqlCommand; using NHibernate.Transform; @@ -65,6 +66,15 @@ return impl; } + /// <summary> + /// Get an executable instance of <c>Criteria</c>, + /// to actually run the query.</summary> + public ICriteria GetExecutableCriteria(IStatelessSession session) + { + impl.Session = (ISessionImplementor)session; + return impl; + } + public static DetachedCriteria For(System.Type entityType) { return new DetachedCriteria(entityType); Property changes on: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1922 ___________________________________________________________________ Added: bugtraq:url + http://jira.nhibernate.org/browse/%BUGID% Added: bugtraq:logregex + NH-\d+ Added: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1922/Fixture.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1922/Fixture.cs (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1922/Fixture.cs 2009-09-16 02:11:15 UTC (rev 4716) @@ -0,0 +1,56 @@ +using System; +using NHibernate.Criterion; +using NHibernate.SqlCommand; +using NUnit.Framework; + +namespace NHibernate.Test.NHSpecificTest.NH1922 +{ + [TestFixture] + public class Fixture : BugTestCase + { protected override void OnSetUp() + { + base.OnSetUp(); + using (ISession session = OpenSession()) + { + using (ITransaction tx = session.BeginTransaction()) + { + var joe = new Customer() {ValidUntil = new DateTime(2000,1,1)}; + session.Save(joe); + + tx.Commit(); + } + } + } + + protected override void OnTearDown() + { + using (ISession session = OpenSession()) + { + using (ITransaction tx = session.BeginTransaction()) + { + session.Delete("from Customer"); + tx.Commit(); + } + } + base.OnTearDown(); + } + + + [Test] + public void CanExecuteQueryOnStatelessSessionUsingDetachedCriteria() + { + using(var stateless = sessions.OpenStatelessSession()) + { + var dc = DetachedCriteria.For<Customer>() + .Add(Restrictions.Eq("ValidUntil", new DateTime(2000,1,1))); + + var cust = dc.GetExecutableCriteria(stateless) + .UniqueResult(); + + Assert.IsNotNull(cust); + } + } + + + } +} Added: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1922/Mappings.hbm.xml =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1922/Mappings.hbm.xml (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1922/Mappings.hbm.xml 2009-09-16 02:11:15 UTC (rev 4716) @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8" ?> +<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" + assembly="NHibernate.Test" + namespace="NHibernate.Test.NHSpecificTest.NH1922"> + + <class name="Customer" > + <id name="ID" type="Int32"> + <generator class="hilo" /> + </id> + + <property name="ValidUntil" type="DateTime" /> + </class> + +</hibernate-mapping> Added: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1922/Model.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1922/Model.cs (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1922/Model.cs 2009-09-16 02:11:15 UTC (rev 4716) @@ -0,0 +1,11 @@ +using System; +using Iesi.Collections.Generic; + +namespace NHibernate.Test.NHSpecificTest.NH1922 +{ + public class Customer + { + public virtual int ID { get; private set; } + public virtual DateTime ValidUntil { get; set; } + } +} Modified: branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-09-16 01:57:36 UTC (rev 4715) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-09-16 02:11:15 UTC (rev 4716) @@ -374,6 +374,8 @@ <Compile Include="NHSpecificTest\NH1911\Model.cs" /> <Compile Include="NHSpecificTest\NH1920\Fixture.cs" /> <Compile Include="NHSpecificTest\NH1920\Model.cs" /> + <Compile Include="NHSpecificTest\NH1922\Fixture.cs" /> + <Compile Include="NHSpecificTest\NH1922\Model.cs" /> <Compile Include="NHSpecificTest\NH1927\Fixture.cs" /> <Compile Include="NHSpecificTest\NH1927\Model.cs" /> <Compile Include="NHSpecificTest\NH1928\Fixture.cs" /> @@ -1988,6 +1990,7 @@ <EmbeddedResource Include="Bytecode\Lightweight\ProductLine.hbm.xml" /> <EmbeddedResource Include="DriverTest\MultiTypeEntity.hbm.xml" /> <Content Include="DynamicEntity\package.html" /> + <EmbeddedResource Include="NHSpecificTest\NH1922\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\CriteriaQueryOnComponentCollection\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1908ThreadSafety\Mappings.hbm.xml" /> <EmbeddedResource Include="Tools\hbm2ddl\SchemaUpdate\1_Person.hbm.xml" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aye...@us...> - 2009-09-16 01:57:47
|
Revision: 4715 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4715&view=rev Author: ayenderahien Date: 2009-09-16 01:57:36 +0000 (Wed, 16 Sep 2009) Log Message: ----------- Fixing NHibernate's ability to use Criteria Queries on composites. Based in part on an unapplied patch from David Mansfield for Hibernate Modified Paths: -------------- branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/SessionFactoryHelperExtensions.cs branches/2.1.x/nhibernate/src/NHibernate/Hql/Classic/QueryTranslator.cs branches/2.1.x/nhibernate/src/NHibernate/Hql/Classic/SelectParser.cs branches/2.1.x/nhibernate/src/NHibernate/Hql/Classic/WhereParser.cs branches/2.1.x/nhibernate/src/NHibernate/Hql/QuerySplitter.cs branches/2.1.x/nhibernate/src/NHibernate/Hql/Util/SessionFactoryHelper.cs branches/2.1.x/nhibernate/src/NHibernate/Loader/Criteria/CriteriaJoinWalker.cs branches/2.1.x/nhibernate/src/NHibernate/Loader/Criteria/CriteriaQueryTranslator.cs branches/2.1.x/nhibernate/src/NHibernate/Loader/JoinWalker.cs branches/2.1.x/nhibernate/src/NHibernate/Loader/Loader.cs branches/2.1.x/nhibernate/src/NHibernate/NHibernate.csproj branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH830/AutoFlushTestFixture.cs branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj Added Paths: ----------- branches/2.1.x/nhibernate/src/NHibernate/Loader/Criteria/ComponentCollectionCriteriaInfoProvider.cs branches/2.1.x/nhibernate/src/NHibernate/Loader/Criteria/EntityCriteriaInfoProvider.cs branches/2.1.x/nhibernate/src/NHibernate/Loader/Criteria/ICriteriaInfoProvider.cs branches/2.1.x/nhibernate/src/NHibernate/Loader/Criteria/ScalarCollectionCriteriaInfoProvider.cs branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/CriteriaQueryOnComponentCollection/ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/CriteriaQueryOnComponentCollection/Employee.cs branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/CriteriaQueryOnComponentCollection/Fixture.cs branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/CriteriaQueryOnComponentCollection/Mappings.hbm.xml branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/CriteriaQueryOnComponentCollection/Money.cs Modified: branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/SessionFactoryHelperExtensions.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/SessionFactoryHelperExtensions.cs 2009-09-15 21:41:03 UTC (rev 4714) +++ branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/SessionFactoryHelperExtensions.cs 2009-09-16 01:57:36 UTC (rev 4715) @@ -17,6 +17,7 @@ { private readonly ISessionFactoryImplementor _sfi; private readonly NullableDictionary<string, IPropertyMapping> _collectionPropertyMappingByRole; + private readonly SessionFactoryHelper helper; /// <summary> /// Construct a new SessionFactoryHelperExtensions instance. @@ -25,6 +26,7 @@ public SessionFactoryHelperExtensions(ISessionFactoryImplementor sfi) { _sfi = sfi; + helper = new SessionFactoryHelper(_sfi); _collectionPropertyMappingByRole = new NullableDictionary<string, IPropertyMapping>(); } @@ -251,7 +253,7 @@ /// <returns>The defined persister for this class, or null if none found.</returns> private static IQueryable FindQueryableUsingImports(ISessionFactoryImplementor sfi, string className) { - return SessionFactoryHelper.FindQueryableUsingImports(sfi, className); + return new SessionFactoryHelper(sfi).FindQueryableUsingImports(className); } /// <summary> @@ -261,7 +263,7 @@ /// <returns>The defined persister for this entity, or null if none found.</returns> private IEntityPersister FindEntityPersisterByName(string name) { - return SessionFactoryHelper.FindEntityPersisterUsingImports(_sfi, name); + return helper.FindEntityPersisterUsingImports(name); } /// <summary> Modified: branches/2.1.x/nhibernate/src/NHibernate/Hql/Classic/QueryTranslator.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Hql/Classic/QueryTranslator.cs 2009-09-15 21:41:03 UTC (rev 4714) +++ branches/2.1.x/nhibernate/src/NHibernate/Hql/Classic/QueryTranslator.cs 2009-09-16 01:57:36 UTC (rev 4715) @@ -537,7 +537,7 @@ internal IQueryable GetPersisterUsingImports(string className) { - return SessionFactoryHelper.FindQueryableUsingImports(Factory, className); + return helper.FindQueryableUsingImports(className); } internal IQueryable GetPersister(string clazz) @@ -1320,7 +1320,7 @@ return result; } - public static string[] ConcreteQueries(string query, ISessionFactoryImplementor factory) + public string[] ConcreteQueries(string query, ISessionFactoryImplementor factory) { // TODO H3.2 check if the QuerySplitter can do the work (this method is not present in H3.2) @@ -1374,7 +1374,7 @@ ((last != null && beforeClassTokens.Contains(last)) && (next == null || !notAfterClassTokens.Contains(next))) || PathExpressionParser.EntityClass.Equals(last)) { - System.Type clazz = SessionFactoryHelper.GetImportedClass(factory, token); + System.Type clazz = helper.GetImportedClass(token); if (clazz != null) { string[] implementors = factory.GetImplementors(clazz.FullName); Modified: branches/2.1.x/nhibernate/src/NHibernate/Hql/Classic/SelectParser.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Hql/Classic/SelectParser.cs 2009-09-15 21:41:03 UTC (rev 4714) +++ branches/2.1.x/nhibernate/src/NHibernate/Hql/Classic/SelectParser.cs 2009-09-16 01:57:36 UTC (rev 4715) @@ -35,6 +35,7 @@ public void Token(string token, QueryTranslator q) { + SessionFactoryHelper helper = new SessionFactoryHelper(q.Factory); string lctoken = token.ToLowerInvariant(); if (first) @@ -55,7 +56,7 @@ if (afterNew) { afterNew = false; - holderClass = SessionFactoryHelper.GetImportedClass(q.Factory, token); + holderClass = helper.GetImportedClass(token); if (holderClass == null) { throw new QueryException("class not found: " + token); Modified: branches/2.1.x/nhibernate/src/NHibernate/Hql/Classic/WhereParser.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Hql/Classic/WhereParser.cs 2009-09-15 21:41:03 UTC (rev 4714) +++ branches/2.1.x/nhibernate/src/NHibernate/Hql/Classic/WhereParser.cs 2009-09-16 01:57:36 UTC (rev 4715) @@ -463,6 +463,7 @@ private void DoToken(string token, QueryTranslator q) { + SessionFactoryHelper helper = new SessionFactoryHelper(q.Factory); if (q.IsName(StringHelper.Root(token))) //path expression { DoPathExpression(q.Unalias(token), q); @@ -508,7 +509,7 @@ { fieldName = StringHelper.Unqualify(token); string typeName = StringHelper.Qualifier(token); - importedType = SessionFactoryHelper.GetImportedClass(q.Factory, typeName); + importedType = helper.GetImportedClass(typeName); } if (indexOfDot > -1 && importedType != null && Modified: branches/2.1.x/nhibernate/src/NHibernate/Hql/QuerySplitter.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Hql/QuerySplitter.cs 2009-09-15 21:41:03 UTC (rev 4714) +++ branches/2.1.x/nhibernate/src/NHibernate/Hql/QuerySplitter.cs 2009-09-16 01:57:36 UTC (rev 4715) @@ -46,6 +46,8 @@ //TODO: this is one of the ugliest and most fragile pieces of code in Hibernate.... + SessionFactoryHelper helper = new SessionFactoryHelper(factory); + string[] tokens = StringHelper.Split(StringHelper.WhiteSpace + "(),", query, true); if (tokens.Length == 0) { @@ -95,7 +97,7 @@ (next == null || !notAfterClassTokens.Contains(next))) || PathExpressionParser.EntityClass.Equals(last)) { - System.Type clazz = SessionFactoryHelper.GetImportedClass(factory, token); + System.Type clazz = helper.GetImportedClass(token); if (clazz != null) { string[] implementors = factory.GetImplementors(clazz.FullName); Modified: branches/2.1.x/nhibernate/src/NHibernate/Hql/Util/SessionFactoryHelper.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Hql/Util/SessionFactoryHelper.cs 2009-09-15 21:41:03 UTC (rev 4714) +++ branches/2.1.x/nhibernate/src/NHibernate/Hql/Util/SessionFactoryHelper.cs 2009-09-16 01:57:36 UTC (rev 4715) @@ -1,4 +1,8 @@ +using System; +using System.Collections.Generic; using NHibernate.Engine; +using NHibernate.Hql.Ast.ANTLR; +using NHibernate.Persister.Collection; using NHibernate.Persister.Entity; using NHibernate.Util; @@ -9,13 +13,22 @@ /// </summary> public class SessionFactoryHelper { - public static IQueryable FindQueryableUsingImports(ISessionFactoryImplementor sfi, string className) + private readonly ISessionFactoryImplementor sfi; + private readonly IDictionary<string,CollectionPropertyMapping> collectionPropertyMappingByRole = + new Dictionary<string,CollectionPropertyMapping>(); + + public SessionFactoryHelper(ISessionFactoryImplementor sfi) { - return FindEntityPersisterUsingImports(sfi, className) as IQueryable; + this.sfi = sfi; } - public static IEntityPersister FindEntityPersisterUsingImports(ISessionFactoryImplementor sfi, string className) + public IQueryable FindQueryableUsingImports(string className) { + return FindEntityPersisterUsingImports(className) as IQueryable; + } + + public IEntityPersister FindEntityPersisterUsingImports(string className) + { // NH : short cut if (string.IsNullOrEmpty(className)) { @@ -61,8 +74,75 @@ return TypeNameParser.Parse(assemblyQualifiedName).Type; } - public static System.Type GetImportedClass(ISessionFactoryImplementor sfi, string className) + + + /// <summary> + /// Locate the collection persister by the collection role. + /// </summary> + /// <param name="role">The collection role name.</param> + /// <returns>The defined CollectionPersister for this collection role, or null.</returns> + public IQueryableCollection GetCollectionPersister(String role) { + try + { + return (IQueryableCollection)sfi.GetCollectionPersister(role); + } + catch (InvalidCastException cce) + { + throw new QueryException("collection is not queryable: " + role); + } + catch (Exception e) + { + throw new QueryException("collection not found: " + role); + } + } + + /// <summary> + /// Locate the persister by class or entity name, requiring that such a persister + /// exists + /// </summary> + /// <param name="name">The class or entity name</param> + /// <returns>The defined persister for this entity</returns> + public IEntityPersister RequireClassPersister(String name) + { + IEntityPersister cp = FindEntityPersisterByName(name); + if (cp == null) + { + throw new QuerySyntaxException(name + " is not mapped"); + } + + return cp; + } + + /// <summary> + /// Locate the persister by class or entity name. + /// </summary> + /// <param name="name">The class or entity name</param> + /// <returns>The defined persister for this entity, or null if none found.</returns> + private IEntityPersister FindEntityPersisterByName(String name) + { + // First, try to get the persister using the given name directly. + try + { + return sfi.GetEntityPersister(name); + } + catch (MappingException ignore) + { + // unable to locate it using this name + } + + // If that didn't work, try using the 'import' name. + String importedClassName = sfi.GetImportedClassName(name); + if (importedClassName == null) + { + return null; + } + return sfi.GetEntityPersister(importedClassName); + } + + + public System.Type GetImportedClass(string className) + { string importedName = sfi.GetImportedClassName(className); if (importedName == null) @@ -73,5 +153,49 @@ // NH Different implementation: our sessionFactory.Imports hold AssemblyQualifiedName return System.Type.GetType(importedName, false); } + + + /// <summary> + /// Retreive a PropertyMapping describing the given collection role. + /// </summary> + /// <param name="role">The collection role for whcih to retrieve the property mapping.</param> + /// <returns>The property mapping.</returns> + public IPropertyMapping GetCollectionPropertyMapping(String role) + { + return collectionPropertyMappingByRole[role]; + } + + + /* Locate the collection persister by the collection role, requiring that + * such a persister exist. + * + * @param role The collection role name. + * @return The defined CollectionPersister for this collection role. + * @throws QueryException Indicates that the collection persister could not be found. + */ + public IQueryableCollection RequireQueryableCollection(String role) + { + try + { + IQueryableCollection queryableCollection = (IQueryableCollection)sfi + .GetCollectionPersister(role); + if (queryableCollection != null) + { + collectionPropertyMappingByRole.Add(role, + new CollectionPropertyMapping(queryableCollection)); + } + return queryableCollection; + } + catch (InvalidCastException) + { + throw new QueryException( + "collection role is not queryable: " + role); + } + catch (Exception) + { + throw new QueryException("collection role not found: " + + role); + } + } } } \ No newline at end of file Added: branches/2.1.x/nhibernate/src/NHibernate/Loader/Criteria/ComponentCollectionCriteriaInfoProvider.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Loader/Criteria/ComponentCollectionCriteriaInfoProvider.cs (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate/Loader/Criteria/ComponentCollectionCriteriaInfoProvider.cs 2009-09-16 01:57:36 UTC (rev 4715) @@ -0,0 +1,71 @@ +using System; +using System.Collections.Generic; +using NHibernate.Persister.Collection; +using NHibernate.Persister.Entity; +using NHibernate.Type; + +namespace NHibernate.Loader.Criteria +{ + public class ComponentCollectionCriteriaInfoProvider : ICriteriaInfoProvider + { + private readonly IQueryableCollection persister; + private readonly IDictionary<String, IType> subTypes = new Dictionary<string, IType>(); + + public ComponentCollectionCriteriaInfoProvider(IQueryableCollection persister) + { + this.persister = persister; + if (!persister.ElementType.IsComponentType) + { + throw new ArgumentException("persister for role " + persister.Role + " is not a collection-of-component"); + } + + var componentType = (ComponentType)persister.ElementType; + var names = componentType.PropertyNames; + var types = componentType.Subtypes; + + for (var i = 0; i < names.Length; i++) + { + subTypes.Add(names[i], types[i]); + } + + } + + public String Name + { + get + { + return persister.Role; + } + } + + public string[] Spaces + { + get + { + return persister.CollectionSpaces; + } + } + + public IPropertyMapping PropertyMapping + { + get + { + return persister; + } + } + + public IType GetType(String relativePath) + { + // TODO: can a component have a nested component? then we may need to do something more here... + if (relativePath.IndexOf('.') >= 0) + throw new ArgumentException("dotted paths not handled (yet?!) for collection-of-component"); + + IType type; + + if (subTypes.TryGetValue(relativePath, out type) == false) + throw new ArgumentException("property " + relativePath + " not found in component of collection " + Name); + + return type; + } + } +} \ No newline at end of file Modified: branches/2.1.x/nhibernate/src/NHibernate/Loader/Criteria/CriteriaJoinWalker.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Loader/Criteria/CriteriaJoinWalker.cs 2009-09-15 21:41:03 UTC (rev 4714) +++ branches/2.1.x/nhibernate/src/NHibernate/Loader/Criteria/CriteriaJoinWalker.cs 2009-09-16 01:57:36 UTC (rev 4715) @@ -1,6 +1,8 @@ using System.Collections.Generic; using Iesi.Collections.Generic; +using log4net; using NHibernate.Engine; +using NHibernate.Persister.Collection; using NHibernate.Persister.Entity; using NHibernate.SqlCommand; using NHibernate.Type; @@ -25,6 +27,8 @@ private readonly string[] userAliases; private readonly IList<string> userAliasList = new List<string>(); + private static readonly ILog logger = LogManager.GetLogger(typeof (CriteriaJoinWalker)); + public CriteriaJoinWalker(IOuterJoinLoadable persister, CriteriaQueryTranslator translator, ISessionFactoryImplementor factory, ICriteria criteria, string rootEntityName, IDictionary<string, IFilter> enabledFilters) @@ -126,8 +130,15 @@ protected override string GenerateTableAlias(int n, string path, IJoinable joinable) { - if (joinable.ConsumesEntityAlias()) + bool shouldCreateUserAlias = joinable.ConsumesEntityAlias(); + if(shouldCreateUserAlias == false && joinable.IsCollection) { + var elementType = ((ICollectionPersister)joinable).ElementType; + if (elementType != null) + shouldCreateUserAlias = elementType.IsComponentType; + } + if (shouldCreateUserAlias) + { ICriteria subcriteria = translator.GetCriteria(path); string sqlAlias = subcriteria == null ? null : translator.GetSQLAlias(subcriteria); if (sqlAlias != null) @@ -135,10 +146,8 @@ userAliasList.Add(subcriteria.Alias); //alias may be null return sqlAlias; //EARLY EXIT } - else - { - userAliasList.Add(null); - } + + userAliasList.Add(null); } return base.GenerateTableAlias(n + translator.SQLAliasCount, path, joinable); } Modified: branches/2.1.x/nhibernate/src/NHibernate/Loader/Criteria/CriteriaQueryTranslator.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Loader/Criteria/CriteriaQueryTranslator.cs 2009-09-15 21:41:03 UTC (rev 4714) +++ branches/2.1.x/nhibernate/src/NHibernate/Loader/Criteria/CriteriaQueryTranslator.cs 2009-09-16 01:57:36 UTC (rev 4715) @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Text; using Iesi.Collections.Generic; +using log4net; using NHibernate.Criterion; using NHibernate.Engine; using NHibernate.Hql.Util; @@ -24,9 +25,14 @@ private readonly CriteriaImpl rootCriteria; private readonly string rootEntityName; private readonly string rootSQLAlias; - private readonly int aliasCount = 0; + private const int aliasCount = 0; - private readonly IDictionary<ICriteria, string> criteriaEntityNames = new LinkedHashMap<ICriteria, string>(); + private readonly IDictionary<ICriteria, ICriteriaInfoProvider> criteriaInfoMap = + new Dictionary<ICriteria, ICriteriaInfoProvider>(); + + private readonly IDictionary<String, ICriteriaInfoProvider> nameCriteriaInfoMap = + new Dictionary<string, ICriteriaInfoProvider>(); + private readonly ISet<ICollectionPersister> criteriaCollectionPersisters = new HashedSet<ICollectionPersister>(); private readonly IDictionary<ICriteria, string> criteriaSQLAliasMap = new Dictionary<ICriteria, string>(); @@ -36,23 +42,26 @@ private readonly ISessionFactoryImplementor sessionFactory; private int indexForAlias = 0; + private static readonly ILog logger = LogManager.GetLogger(typeof(CriteriaQueryTranslator)); private readonly List<TypedValue> usedTypedValues = new List<TypedValue>(); + private SessionFactoryHelper helper; public CriteriaQueryTranslator(ISessionFactoryImplementor factory, CriteriaImpl criteria, string rootEntityName, - string rootSQLAlias, ICriteriaQuery outerQuery) + string rootSQLAlias, ICriteriaQuery outerQuery) : this(factory, criteria, rootEntityName, rootSQLAlias) { outerQueryTranslator = outerQuery; } public CriteriaQueryTranslator(ISessionFactoryImplementor factory, CriteriaImpl criteria, string rootEntityName, - string rootSQLAlias) + string rootSQLAlias) { rootCriteria = criteria; this.rootEntityName = rootEntityName; sessionFactory = factory; this.rootSQLAlias = rootSQLAlias; + helper = new SessionFactoryHelper(factory); CreateAliasCriteriaMap(); CreateAssociationPathCriteriaMap(); @@ -62,7 +71,7 @@ } [CLSCompliant(false)] // TODO: Why does this cause a problem in 1.1 - public string RootSQLAlias + public string RootSQLAlias { get { return rootSQLAlias; } } @@ -71,9 +80,9 @@ { ISet<string> result = new HashedSet<string>(); - foreach (string entityName in criteriaEntityNames.Values) + foreach (ICriteriaInfoProvider info in criteriaInfoMap.Values) { - result.AddAll(Factory.GetEntityPersister(entityName).QuerySpaces); + result.AddAll(info.Spaces); } foreach (ICollectionPersister collectionPersister in criteriaCollectionPersisters) @@ -131,7 +140,7 @@ return new QueryParameters(typeArray, valueArray, lockModes, selection, rootCriteria.Cacheable, rootCriteria.CacheRegion, - rootCriteria.Comment, rootCriteria.LookupByNaturalKey, rootCriteria.ResultTransformer); + rootCriteria.Comment, rootCriteria.LookupByNaturalKey, rootCriteria.ResultTransformer); } public SqlString GetGroupBy() @@ -140,7 +149,7 @@ { return rootCriteria.Projection.ToGroupSqlString(rootCriteria.ProjectionCriteria, this, - new CollectionHelper.EmptyMapClass<string, IFilter>()); + new CollectionHelper.EmptyMapClass<string, IFilter>()); } else { @@ -245,6 +254,7 @@ { ICriteria result; associationPathCriteriaMap.TryGetValue(path, out result); + logger.DebugFormat("getCriteria for path={0} crit={1}", path, result); return result; } @@ -330,33 +340,119 @@ else { // otherwise, recurse - return GetWholeAssociationPath((CriteriaImpl.Subcriteria) parent) + '.' + path; + return GetWholeAssociationPath((CriteriaImpl.Subcriteria)parent) + '.' + path; } } private void CreateCriteriaEntityNameMap() { - criteriaEntityNames[rootCriteria] = rootEntityName; + // initialize the rootProvider first + ICriteriaInfoProvider rootProvider = new EntityCriteriaInfoProvider((IQueryable)sessionFactory.GetEntityPersister(rootEntityName)); + criteriaInfoMap.Add(rootCriteria, rootProvider); + nameCriteriaInfoMap.Add(rootProvider.Name, rootProvider); + foreach (KeyValuePair<string, ICriteria> me in associationPathCriteriaMap) { - criteriaEntityNames[me.Value] = GetPathEntityName(me.Key); + ICriteriaInfoProvider info = GetPathInfo(me.Key); + criteriaInfoMap.Add(me.Value, info); + nameCriteriaInfoMap[info.Name] = info; } } - private string GetPathEntityName(string path) + + private void CreateCriteriaCollectionPersisters() { - IQueryable persister = (IQueryable) sessionFactory.GetEntityPersister(rootEntityName); + foreach (KeyValuePair<string, ICriteria> me in associationPathCriteriaMap) + { + IJoinable joinable = GetPathJoinable(me.Key); + if (joinable != null && joinable.IsCollection) + { + criteriaCollectionPersisters.Add((ICollectionPersister)joinable); + } + } + } + + private IJoinable GetPathJoinable(string path) + { + IJoinable last = (IJoinable)Factory.GetEntityPersister(rootEntityName); + IPropertyMapping lastEntity = (IPropertyMapping)last; + + string componentPath = ""; + StringTokenizer tokens = new StringTokenizer(path, ".", false); + foreach (string token in tokens) + { + componentPath += token; + IType type = lastEntity.ToType(componentPath); + if (type.IsAssociationType) + { + if(type.IsCollectionType) + { + // ignore joinables for composite collections + var collectionType = (CollectionType)type; + var persister = Factory.GetCollectionPersister(collectionType.Role); + if(persister.ElementType.IsEntityType==false) + return null; + } + IAssociationType atype = (IAssociationType)type; + + last = atype.GetAssociatedJoinable(Factory); + lastEntity = (IPropertyMapping)Factory.GetEntityPersister(atype.GetAssociatedEntityName(Factory)); + componentPath = ""; + } + else if (type.IsComponentType) + { + componentPath += '.'; + } + else + { + throw new QueryException("not an association: " + componentPath); + } + } + return last; + } + + private ICriteriaInfoProvider GetPathInfo(string path) + { + StringTokenizer tokens = new StringTokenizer(path, ".", false); string componentPath = string.Empty; + + // start with the 'rootProvider' + ICriteriaInfoProvider provider; + if (nameCriteriaInfoMap.TryGetValue(rootEntityName, out provider) == false) + throw new ArgumentException("Could not find ICriteriaInfoProvider for: " + path); + + foreach (string token in tokens) { componentPath += token; - IType type = persister.ToType(componentPath); + logger.DebugFormat("searching for {0}", componentPath); + IType type = provider.GetType(componentPath); if (type.IsAssociationType) { - IAssociationType atype = (IAssociationType) type; - persister = (IQueryable) sessionFactory.GetEntityPersister(atype.GetAssociatedEntityName(sessionFactory)); + // CollectionTypes are always also AssociationTypes - but there's not always an associated entity... + IAssociationType atype = (IAssociationType)type; + + CollectionType ctype = type.IsCollectionType ? (CollectionType)type : null; + IType elementType = (ctype != null) ? ctype.GetElementType(sessionFactory) : null; + // is the association a collection of components or value-types? (i.e a colloction of valued types?) + if (ctype != null && elementType.IsComponentType) + { + provider = new ComponentCollectionCriteriaInfoProvider(helper.GetCollectionPersister(ctype.Role)); + } + else if (ctype != null && !elementType.IsEntityType) + { + provider = new ScalarCollectionCriteriaInfoProvider(helper, ctype.Role); + } + else + { + provider = new EntityCriteriaInfoProvider((IQueryable)sessionFactory.GetEntityPersister( + atype.GetAssociatedEntityName( + sessionFactory) + )); + } + componentPath = string.Empty; } else if (type.IsComponentType) @@ -368,22 +464,27 @@ throw new QueryException("not an association: " + componentPath); } } - return persister.EntityName; + + logger.DebugFormat("returning entity name={0} for path={1} class={2}", + provider.Name, path, provider.GetType().Name); + return provider; } private void CreateCriteriaSQLAliasMap() { int i = 0; - foreach (KeyValuePair<ICriteria, string> me in criteriaEntityNames) + foreach (KeyValuePair<ICriteria, ICriteriaInfoProvider> me in criteriaInfoMap) { ICriteria crit = me.Key; string alias = crit.Alias; if (alias == null) { - alias = me.Value; // the entity name + alias = me.Value.Name; // the entity name } criteriaSQLAliasMap[crit] = StringHelper.GenerateAlias(alias, i++); + logger.DebugFormat("put criteria={0} alias={1}", + crit, criteriaSQLAliasMap[crit]); } criteriaSQLAliasMap[rootCriteria] = rootSQLAlias; } @@ -395,14 +496,17 @@ public string GetSQLAlias(ICriteria criteria) { - return criteriaSQLAliasMap[criteria]; + String alias = criteriaSQLAliasMap[criteria]; + logger.DebugFormat("returning alias={0} for criteria={1}", alias, criteria); + return alias; } public string GetEntityName(ICriteria criteria) { - string result; - criteriaEntityNames.TryGetValue(criteria, out result); - return result; + ICriteriaInfoProvider result; + if(criteriaInfoMap.TryGetValue(criteria, out result)==false) + throw new ArgumentException("Could not find a matching criteria info provider to: " + criteria); + return result.Name; } public string GetColumn(ICriteria criteria, string propertyName) @@ -442,18 +546,18 @@ public string[] GetIdentifierColumns(ICriteria subcriteria) { - string[] idcols = ((ILoadable) GetPropertyMapping(GetEntityName(subcriteria))).IdentifierColumnNames; + string[] idcols = ((ILoadable)GetPropertyMapping(GetEntityName(subcriteria))).IdentifierColumnNames; return StringHelper.Qualify(GetSQLAlias(subcriteria), idcols); } public IType GetIdentifierType(ICriteria subcriteria) { - return ((ILoadable) GetPropertyMapping(GetEntityName(subcriteria))).IdentifierType; + return ((ILoadable)GetPropertyMapping(GetEntityName(subcriteria))).IdentifierType; } public TypedValue GetTypedIdentifierValue(ICriteria subcriteria, object value) { - ILoadable loadable = (ILoadable) GetPropertyMapping(GetEntityName(subcriteria)); + ILoadable loadable = (ILoadable)GetPropertyMapping(GetEntityName(subcriteria)); return new TypedValue(loadable.IdentifierType, value, EntityMode.Poco); } @@ -518,8 +622,8 @@ // Detect discriminator values... if (value is System.Type) { - System.Type entityClass = (System.Type) value; - IQueryable q = SessionFactoryHelper.FindQueryableUsingImports(sessionFactory, entityClass.FullName); + System.Type entityClass = (System.Type)value; + IQueryable q = helper.FindQueryableUsingImports(entityClass.FullName); if (q != null) { @@ -533,7 +637,10 @@ private IPropertyMapping GetPropertyMapping(string entityName) { - return (IPropertyMapping) sessionFactory.GetEntityPersister(entityName); + ICriteriaInfoProvider info ; + if (nameCriteriaInfoMap.TryGetValue(entityName, out info)==false) + throw new InvalidOperationException("Could not find criteria info provider for: " + entityName); + return info.PropertyMapping; } public string GetEntityName(ICriteria subcriteria, string propertyName) @@ -600,49 +707,7 @@ } } - private void CreateCriteriaCollectionPersisters() - { - foreach (KeyValuePair<string, ICriteria> me in associationPathCriteriaMap) - { - IJoinable joinable = GetPathJoinable(me.Key); - if (joinable.IsCollection) - { - criteriaCollectionPersisters.Add((ICollectionPersister) joinable); - } - } - } - private IJoinable GetPathJoinable(string path) - { - IJoinable last = (IJoinable) Factory.GetEntityPersister(rootEntityName); - IPropertyMapping lastEntity = (IPropertyMapping) last; - - string componentPath = ""; - - StringTokenizer tokens = new StringTokenizer(path, ".", false); - foreach (string token in tokens) - { - componentPath += token; - IType type = lastEntity.ToType(componentPath); - if (type.IsAssociationType) - { - IAssociationType atype = (IAssociationType) type; - last = atype.GetAssociatedJoinable(Factory); - lastEntity = (IPropertyMapping) Factory.GetEntityPersister(atype.GetAssociatedEntityName(Factory)); - componentPath = ""; - } - else if (type.IsComponentType) - { - componentPath += '.'; - } - else - { - throw new QueryException("not an association: " + componentPath); - } - } - return last; - } - public SqlString GetHavingCondition(IDictionary<string, IFilter> enabledFilters) { SqlStringBuilder condition = new SqlStringBuilder(30); Added: branches/2.1.x/nhibernate/src/NHibernate/Loader/Criteria/EntityCriteriaInfoProvider.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Loader/Criteria/EntityCriteriaInfoProvider.cs (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate/Loader/Criteria/EntityCriteriaInfoProvider.cs 2009-09-16 01:57:36 UTC (rev 4715) @@ -0,0 +1,45 @@ +using System; +using NHibernate.Persister.Entity; +using NHibernate.Type; + +namespace NHibernate.Loader.Criteria +{ + public class EntityCriteriaInfoProvider : ICriteriaInfoProvider + { + readonly IQueryable persister; + + public EntityCriteriaInfoProvider(IQueryable persister) + { + this.persister = persister; + } + + public String Name + { + get + { + return persister.EntityName; + } + } + + public string[] Spaces + { + get + { + return persister.QuerySpaces; + } + } + + public IPropertyMapping PropertyMapping + { + get + { + return persister; + } + } + + public IType GetType(String relativePath) + { + return persister.ToType(relativePath); + } + } +} \ No newline at end of file Added: branches/2.1.x/nhibernate/src/NHibernate/Loader/Criteria/ICriteriaInfoProvider.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Loader/Criteria/ICriteriaInfoProvider.cs (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate/Loader/Criteria/ICriteriaInfoProvider.cs 2009-09-16 01:57:36 UTC (rev 4715) @@ -0,0 +1,14 @@ +using System; +using NHibernate.Persister.Entity; +using NHibernate.Type; + +namespace NHibernate.Loader.Criteria +{ + public interface ICriteriaInfoProvider + { + string Name { get; } + string[] Spaces { get; } + IPropertyMapping PropertyMapping { get; } + IType GetType(String relativePath); + } +} \ No newline at end of file Added: branches/2.1.x/nhibernate/src/NHibernate/Loader/Criteria/ScalarCollectionCriteriaInfoProvider.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Loader/Criteria/ScalarCollectionCriteriaInfoProvider.cs (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate/Loader/Criteria/ScalarCollectionCriteriaInfoProvider.cs 2009-09-16 01:57:36 UTC (rev 4715) @@ -0,0 +1,52 @@ +using System; +using NHibernate.Hql.Util; +using NHibernate.Persister.Collection; +using NHibernate.Persister.Entity; +using NHibernate.Type; + +namespace NHibernate.Loader.Criteria +{ + public class ScalarCollectionCriteriaInfoProvider : ICriteriaInfoProvider + { + private readonly String role; + private readonly IQueryableCollection persister; + private readonly SessionFactoryHelper helper; + public ScalarCollectionCriteriaInfoProvider(SessionFactoryHelper helper, String role) + { + this.role = role; + this.helper = helper; + this.persister = helper.RequireQueryableCollection(role); + } + + public String Name + { + get + { + return role; + } + } + + public string[] Spaces + { + get + { + return persister.CollectionSpaces; + } + } + + public IPropertyMapping PropertyMapping + { + get + { + return helper.GetCollectionPropertyMapping(role); + } + } + + public IType GetType(String relativePath) + { + //not sure what things are going to be passed here, how about 'id', maybe 'index' or 'key' or 'elements' ??? + return PropertyMapping.ToType(relativePath); + } + + } +} \ No newline at end of file Modified: branches/2.1.x/nhibernate/src/NHibernate/Loader/JoinWalker.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Loader/JoinWalker.cs 2009-09-15 21:41:03 UTC (rev 4714) +++ branches/2.1.x/nhibernate/src/NHibernate/Loader/JoinWalker.cs 2009-09-16 01:57:36 UTC (rev 4715) @@ -783,7 +783,6 @@ else { SqlStringBuilder buf = new SqlStringBuilder(associations.Count * 3); - buf.Add(StringHelper.CommaSpace); int entityAliasCount = 0; int collectionAliasCount = 0; @@ -804,16 +803,16 @@ joinable.SelectFragment(next == null ? null : next.Joinable, next == null ? null : next.RHSAlias, join.RHSAlias, entitySuffix, collectionSuffix, join.JoinType == JoinType.LeftOuterJoin); - buf.Add(selectFragment); - + if (selectFragment.Trim().Length > 0) + { + buf.Add(StringHelper.CommaSpace) + .Add(selectFragment); + } if (joinable.ConsumesEntityAlias()) entityAliasCount++; if (joinable.ConsumesCollectionAlias() && join.JoinType == JoinType.LeftOuterJoin) collectionAliasCount++; - - if (i < associations.Count - 1 && selectFragment.Trim().Length > 0) - buf.Add(StringHelper.CommaSpace); } return buf.ToSqlString().ToString(); Modified: branches/2.1.x/nhibernate/src/NHibernate/Loader/Loader.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Loader/Loader.cs 2009-09-15 21:41:03 UTC (rev 4714) +++ branches/2.1.x/nhibernate/src/NHibernate/Loader/Loader.cs 2009-09-16 01:57:36 UTC (rev 4715) @@ -13,6 +13,7 @@ using NHibernate.Engine; using NHibernate.Event; using NHibernate.Exceptions; +using NHibernate.Hql.Util; using NHibernate.Impl; using NHibernate.Persister.Collection; using NHibernate.Persister.Entity; @@ -48,10 +49,12 @@ private readonly ISessionFactoryImplementor factory; private ColumnNameCache columnNameCache; + protected SessionFactoryHelper helper; public Loader(ISessionFactoryImplementor factory) { this.factory = factory; + helper = new SessionFactoryHelper(factory); } /// <summary> Modified: branches/2.1.x/nhibernate/src/NHibernate/NHibernate.csproj =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/NHibernate.csproj 2009-09-15 21:41:03 UTC (rev 4714) +++ branches/2.1.x/nhibernate/src/NHibernate/NHibernate.csproj 2009-09-16 01:57:36 UTC (rev 4715) @@ -514,6 +514,10 @@ <Compile Include="Hql\Ast\ANTLR\Tree\InsertStatement.cs" /> <Compile Include="Hql\Ast\ANTLR\Tree\UpdateStatement.cs" /> <Compile Include="Impl\SessionIdLoggingContext.cs" /> + <Compile Include="Loader\Criteria\ComponentCollectionCriteriaInfoProvider.cs" /> + <Compile Include="Loader\Criteria\EntityCriteriaInfoProvider.cs" /> + <Compile Include="Loader\Criteria\ICriteriaInfoProvider.cs" /> + <Compile Include="Loader\Criteria\ScalarCollectionCriteriaInfoProvider.cs" /> <Compile Include="Param\AbstractExplicitParameterSpecification.cs" /> <Compile Include="Param\AggregatedIndexCollectionSelectorParameterSpecifications.cs" /> <Compile Include="Param\CollectionFilterKeyParameterSpecification.cs" /> Property changes on: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/CriteriaQueryOnComponentCollection ___________________________________________________________________ Added: bugtraq:url + http://jira.nhibernate.org/browse/%BUGID% Added: bugtraq:logregex + NH-\d+ Added: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/CriteriaQueryOnComponentCollection/Employee.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/CriteriaQueryOnComponentCollection/Employee.cs (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/CriteriaQueryOnComponentCollection/Employee.cs 2009-09-16 01:57:36 UTC (rev 4715) @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace NHibernate.Test.NHSpecificTest.CriteriaQueryOnComponentCollection +{ + public class Employee + { + public virtual int Id { get; set; } + public virtual ICollection<Money> Amounts { get; set; } + public virtual ICollection<ManagedEmployee> ManagedEmployees { get; set; } + } + + public class ManagedEmployee + { + public virtual Employee Employee { get; set; } + public virtual string Position { get; set; } + } +} Added: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/CriteriaQueryOnComponentCollection/Fixture.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/CriteriaQueryOnComponentCollection/Fixture.cs (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/CriteriaQueryOnComponentCollection/Fixture.cs 2009-09-16 01:57:36 UTC (rev 4715) @@ -0,0 +1,118 @@ +using System.Collections; +using Iesi.Collections.Generic; +using NHibernate.Cfg; +using NHibernate.Criterion; +using NHibernate.Transform; +using NUnit.Framework; + +namespace NHibernate.Test.NHSpecificTest.CriteriaQueryOnComponentCollection +{ + [TestFixture] + public class Fixture : TestCase + { + protected override void Configure(Configuration configuration) + { + configuration.SetProperty(Environment.FormatSql, "false"); + } + + protected override void OnSetUp() + { + using (var s = sessions.OpenSession()) + using (s.BeginTransaction()) + { + var parent = new Employee + { + Id = 2, + }; + var emp = new Employee + { + Id = 1, + Amounts = new HashedSet<Money> + { + new Money {Amount = 9, Currency = "USD"}, + new Money {Amount = 3, Currency = "EUR"}, + }, + ManagedEmployees = new HashedSet<ManagedEmployee> + { + new ManagedEmployee + { + Position = "parent", + Employee = parent + } + } + }; + s.Save(parent); + s.Save(emp); + + s.Transaction.Commit(); + } + } + + protected override void OnTearDown() + { + using (var s = sessions.OpenSession()) + using(s.BeginTransaction()) + { + s.Delete("from System.Object"); + + s.Transaction.Commit(); + } + } + + [Test] + public void CanQueryByCriteriaOnSetOfCompositeElement() + { + using(var s = sessions.OpenSession()) + { + var list = s.CreateCriteria<Employee>() + .CreateCriteria("ManagedEmployees") + .Add(Restrictions.Eq("Position", "parent")) + .SetResultTransformer(new RootEntityResultTransformer()) + .List(); + Assert.IsNotEmpty(list); + } + } + + [Test] + public void CanQueryByCriteriaOnSetOfElement() + { + using (var s = sessions.OpenSession()) + { + var list = s.CreateCriteria<Employee>() + .CreateCriteria("Amounts") + .Add(Restrictions.Gt("Amount", 5m)) + .SetResultTransformer(new RootEntityResultTransformer()) + .List(); + Assert.IsNotEmpty(list); + } + } + + [Test] + public void CanQueryByCriteriaOnSetOfCompositeElement_UsingDetachedCriteria() + { + using (var s = sessions.OpenSession()) + { + var list = s.CreateCriteria<Employee>() + .Add(Subqueries.PropertyIn("id", + DetachedCriteria.For<Employee>() + .SetProjection(Projections.Id()) + .CreateCriteria("Amounts") + .Add(Restrictions.Gt("Amount", 5m)))) + .List(); + Assert.IsNotEmpty(list); + } + } + + + protected override IList Mappings + { + get { return new [] { "NHSpecificTest.CriteriaQueryOnComponentCollection.Mappings.hbm.xml" }; } + } + + protected override string MappingsAssembly + { + get { return "NHibernate.Test"; } + } + + } +} Added: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/CriteriaQueryOnComponentCollection/Mappings.hbm.xml =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/CriteriaQueryOnComponentCollection/Mappings.hbm.xml (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/CriteriaQueryOnComponentCollection/Mappings.hbm.xml 2009-09-16 01:57:36 UTC (rev 4715) @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8" ?> +<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" + namespace="NHibernate.Test.NHSpecificTest.CriteriaQueryOnComponentCollection" + assembly="NHibernate.Test"> + + <class name="Employee" table="Employees" lazy="false"> + <id name="Id" type="Int32"> + <generator class="assigned" /> + </id> + + <set name="Amounts" table="Amounts"> + <key column="EmployeeId"/> + <composite-element class="Money"> + <property name="Amount" type="Decimal" not-null="true"/> + <property name="Currency" type="String" not-null="true"/> + </composite-element> + </set> + + <set name="ManagedEmployees" table="ManagedEmployees"> + <key column="EmployeeId"/> + <composite-element class="ManagedEmployee"> + <property name="Position" type="string" not-null="true"/> + <many-to-one name="Employee" class="Employee"/> + </composite-element> + </set> + + </class> +</hibernate-mapping> Added: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/CriteriaQueryOnComponentCollection/Money.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/CriteriaQueryOnComponentCollection/Money.cs (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/CriteriaQueryOnComponentCollection/Money.cs 2009-09-16 01:57:36 UTC (rev 4715) @@ -0,0 +1,8 @@ +namespace NHibernate.Test.NHSpecificTest.CriteriaQueryOnComponentCollection +{ + public class Money + { + public virtual string Currency { get; set; } + public virtual decimal Amount { get; set; } + } +} \ No newline at end of file Modified: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH830/AutoFlushTestFixture.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH830/AutoFlushTestFixture.cs 2009-09-15 21:41:03 UTC (rev 4714) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH830/AutoFlushTestFixture.cs 2009-09-16 01:57:36 UTC (rev 4715) @@ -20,13 +20,13 @@ sess.Flush(); //reload the data and then setup the many-to-many association - mum = (Cat) sess.Get(typeof(Cat), mum.Id); - son = (Cat) sess.Get(typeof(Cat), son.Id); + mum = (Cat) sess.Get(typeof (Cat), mum.Id); + son = (Cat) sess.Get(typeof (Cat), son.Id); mum.Children.Add(son); son.Parents.Add(mum); //Use criteria API to search first - IList result = sess.CreateCriteria(typeof(Cat)) + IList result = sess.CreateCriteria(typeof (Cat)) .CreateAlias("Children", "child") .Add(Expression.Eq("child.Id", son.Id)) .List(); Modified: branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-09-15 21:41:03 UTC (rev 4714) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-09-16 01:57:36 UTC (rev 4715) @@ -46,6 +46,10 @@ <SpecificVersion>False</SpecificVersion> <HintPath>..\..\lib\net\2.0\Antlr3.Runtime.dll</HintPath> </Reference> + <Reference Include="HibernatingRhinos.NHibernate.Profiler.Appender, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0774796e73ebf640, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\..\..\Hibernating.Rhinos\NHibernate.Profiler\HibernatingRhinos.NHibernate.Profiler.Appender\bin\Debug\HibernatingRhinos.NHibernate.Profiler.Appender.dll</HintPath> + </Reference> <Reference Include="Iesi.Collections, Version=1.0.0.1, Culture=neutral, PublicKeyToken=154fdcb44c4484fc"> <SpecificVersion>False</SpecificVersion> <HintPath>..\..\lib\net\2.0\Iesi.Collections.dll</HintPath> @@ -354,6 +358,9 @@ <Compile Include="LazyProperty\LazyPropertyFixture.cs" /> <Compile Include="MappingTest\NonReflectiveBinderFixture.cs" /> <Compile Include="MappingTest\Wicked.cs" /> + <Compile Include="NHSpecificTest\CriteriaQueryOnComponentCollection\Employee.cs" /> + <Compile Include="NHSpecificTest\CriteriaQueryOnComponentCollection\Fixture.cs" /> + <Compile Include="NHSpecificTest\CriteriaQueryOnComponentCollection\Money.cs" /> <Compile Include="NHSpecificTest\ElementsEnums\AbstractIntEnumsBagFixture.cs" /> <Compile Include="NHSpecificTest\ElementsEnums\IntEnumsBagNoNameFixture.cs" /> <Compile Include="NHSpecificTest\ElementsEnums\IntEnumsBagPartialNameFixture.cs" /> @@ -1981,6 +1988,7 @@ <EmbeddedResource Include="Bytecode\Lightweight\ProductLine.hbm.xml" /> <EmbeddedResource Include="DriverTest\MultiTypeEntity.hbm.xml" /> <Content Include="DynamicEntity\package.html" /> + <EmbeddedResource Include="NHSpecificTest\CriteriaQueryOnComponentCollection\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1908ThreadSafety\Mappings.hbm.xml" /> <EmbeddedResource Include="Tools\hbm2ddl\SchemaUpdate\1_Person.hbm.xml" /> <EmbeddedResource Include="Tools\hbm2ddl\SchemaUpdate\2_Person.hbm.xml" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ric...@us...> - 2009-09-15 21:41:10
|
Revision: 4714 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4714&view=rev Author: ricbrown Date: 2009-09-15 21:41:03 +0000 (Tue, 15 Sep 2009) Log Message: ----------- Merge r4713 (Simplify filter parameter reordering and possible fix for NH-1908 threading issue.) Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Engine/QueryParameters.cs trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Loader/QueryLoader.cs trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/QueryTranslatorImpl.cs trunk/nhibernate/src/NHibernate/Hql/Classic/QueryTranslator.cs trunk/nhibernate/src/NHibernate/Loader/Collection/SubselectCollectionLoader.cs trunk/nhibernate/src/NHibernate/Loader/Collection/SubselectOneToManyLoader.cs trunk/nhibernate/src/NHibernate/Loader/Custom/CustomLoader.cs trunk/nhibernate/src/NHibernate/Loader/Loader.cs trunk/nhibernate/src/NHibernate/Param/ParameterTranslationsImpl.cs trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj Added Paths: ----------- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1908ThreadSafety/ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1908ThreadSafety/Fixture.cs trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1908ThreadSafety/Mappings.hbm.xml trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1908ThreadSafety/Model.cs Modified: trunk/nhibernate/src/NHibernate/Engine/QueryParameters.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Engine/QueryParameters.cs 2009-09-15 21:39:54 UTC (rev 4713) +++ trunk/nhibernate/src/NHibernate/Engine/QueryParameters.cs 2009-09-15 21:41:03 UTC (rev 4714) @@ -39,6 +39,7 @@ private object _optionalId; private string _comment; private bool _readOnly; + private IDictionary<int, int> _adjustedParameterLocations; private SqlString processedSQL; @@ -286,15 +287,12 @@ /************** Filters ********************************/ - private void AdjustPostionalParameterLocations(int parameterIndex) + public int FindAdjustedParameterLocation(int parameterIndex) { - for (int i = 0; i < _positionalParameterLocations.Length; i++) - { - if (_positionalParameterLocations[i] >= parameterIndex) - { - _positionalParameterLocations[i]++; - } - } + if (_adjustedParameterLocations == null) + return parameterIndex; + + return _adjustedParameterLocations[parameterIndex]; } public void ProcessFilters(SqlString sql, ISessionImplementor session) @@ -314,7 +312,9 @@ var result = new SqlStringBuilder(); - int parameterIndex = 0; // keep track of the positional parameter + int originalParameterIndex = 0; // keep track of the positional parameter + int newParameterIndex = 0; + _adjustedParameterLocations = new Dictionary<int, int>(); foreach (var part in sql.Parts) { @@ -329,7 +329,9 @@ // types for the named parameters are added later to the end of the list. // see test fixture NH-1098 - parameterIndex++; + _adjustedParameterLocations[originalParameterIndex] = newParameterIndex; + originalParameterIndex++; + newParameterIndex++; continue; } @@ -358,9 +360,8 @@ result.AddParameter(); filteredParameterTypes.Add(type); filteredParameterValues.Add(elementValue); - filteredParameterLocations.Add(parameterIndex); - AdjustPostionalParameterLocations(parameterIndex); - parameterIndex++; + filteredParameterLocations.Add(newParameterIndex); + newParameterIndex++; if (i < coll.Count) { result.Add(", "); @@ -376,9 +377,8 @@ result.AddParameter(); filteredParameterTypes.Add(type); filteredParameterValues.Add(value); - filteredParameterLocations.Add(parameterIndex); - AdjustPostionalParameterLocations(parameterIndex); - parameterIndex++; + filteredParameterLocations.Add(newParameterIndex); + newParameterIndex++; } } } @@ -401,7 +401,7 @@ for (int i = 0; i < _positionalParameterLocations.Length; i++) { - int location = _positionalParameterLocations[i]; + int location = FindAdjustedParameterLocation(_positionalParameterLocations[i]); object value = _positionalParameterValues[i]; IType type = _positionalParameterTypes[i]; ArrayHelper.SafeSetValue(values, location, value); @@ -428,7 +428,7 @@ int[] locations = getNamedParameterLocations(name); for (int i = 0; i < locations.Length; i++) { - int location = locations[i]; + int location = FindAdjustedParameterLocation(locations[i]); // can still clash with positional parameters // could consider throwing an exception to locate problem (NH-1098) Modified: trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Loader/QueryLoader.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Loader/QueryLoader.cs 2009-09-15 21:39:54 UTC (rev 4713) +++ trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Loader/QueryLoader.cs 2009-09-15 21:41:03 UTC (rev 4714) @@ -58,11 +58,6 @@ get { return HasSubselectLoadableCollections(); } } - protected override void AdjustNamedParameterLocationsForQueryParameters(QueryParameters parameters) - { - _queryTranslator.AdjustNamedParameterLocationsForQueryParameters(parameters); - } - protected override SqlString ApplyLocks(SqlString sql, IDictionary<string, LockMode> lockModes, Dialect.Dialect dialect) { Modified: trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/QueryTranslatorImpl.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/QueryTranslatorImpl.cs 2009-09-15 21:39:54 UTC (rev 4713) +++ trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/QueryTranslatorImpl.cs 2009-09-15 21:41:03 UTC (rev 4714) @@ -464,11 +464,6 @@ throw new QueryExecutionRequestException("Not supported for DML operations", _hql); } } - - public void AdjustNamedParameterLocationsForQueryParameters(QueryParameters parameters) - { - ((ParameterTranslationsImpl) GetParameterTranslations()).AdjustNamedParameterLocationsForQueryParameters(parameters); - } } internal class HqlParseEngine Modified: trunk/nhibernate/src/NHibernate/Hql/Classic/QueryTranslator.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Hql/Classic/QueryTranslator.cs 2009-09-15 21:39:54 UTC (rev 4713) +++ trunk/nhibernate/src/NHibernate/Hql/Classic/QueryTranslator.cs 2009-09-15 21:41:03 UTC (rev 4714) @@ -705,21 +705,6 @@ return o.ToArray(); } - protected override void AdjustNamedParameterLocationsForQueryParameters(QueryParameters parameters) - { - foreach (int existingParameterLocation in parameters.FilteredParameterLocations) - { - foreach (IList<int> namedParameterLocations in namedParameters.Values) - { - for (int index = 0; index < namedParameterLocations.Count; index++) - { - if (namedParameterLocations[index] >= existingParameterLocation) - namedParameterLocations[index]++; - } - } - } - } - public static string ScalarName(int x, int y) { return new StringBuilder() Modified: trunk/nhibernate/src/NHibernate/Loader/Collection/SubselectCollectionLoader.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Loader/Collection/SubselectCollectionLoader.cs 2009-09-15 21:39:54 UTC (rev 4713) +++ trunk/nhibernate/src/NHibernate/Loader/Collection/SubselectCollectionLoader.cs 2009-09-15 21:41:03 UTC (rev 4714) @@ -43,23 +43,5 @@ { return namedParameterLocMap[name]; } - - protected override void AdjustNamedParameterLocationsForQueryParameters(QueryParameters parameters) - { - if (namedParameterLocMap == null) - return; - - foreach (int existingParameterLocation in parameters.FilteredParameterLocations) - { - foreach (IList<int> namedParameterLocations in namedParameterLocMap.Values) - { - for (int index = 0; index < namedParameterLocations.Count; index++) - { - if (namedParameterLocations[index] >= existingParameterLocation) - namedParameterLocations[index]++; - } - } - } - } } } \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate/Loader/Collection/SubselectOneToManyLoader.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Loader/Collection/SubselectOneToManyLoader.cs 2009-09-15 21:39:54 UTC (rev 4713) +++ trunk/nhibernate/src/NHibernate/Loader/Collection/SubselectOneToManyLoader.cs 2009-09-15 21:41:03 UTC (rev 4714) @@ -45,24 +45,5 @@ { return namedParameterLocMap[name]; } - - protected override void AdjustNamedParameterLocationsForQueryParameters(QueryParameters parameters) - { - if (namedParameterLocMap == null) - return; - - foreach (int existingParameterLocation in parameters.FilteredParameterLocations) - { - foreach (IList<int> namedParameterLocations in namedParameterLocMap.Values) - { - for (int index = 0; index < namedParameterLocations.Count; index++) - { - if (namedParameterLocations[index] >= existingParameterLocation) - namedParameterLocations[index]++; - } - } - } - } - } } \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate/Loader/Custom/CustomLoader.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Loader/Custom/CustomLoader.cs 2009-09-15 21:39:54 UTC (rev 4713) +++ trunk/nhibernate/src/NHibernate/Loader/Custom/CustomLoader.cs 2009-09-15 21:41:03 UTC (rev 4714) @@ -320,30 +320,6 @@ } } - protected override void AdjustNamedParameterLocationsForQueryParameters(QueryParameters parameters) - { - var existingParameterLocations = parameters.FilteredParameterLocations.GetEnumerator(); - while (existingParameterLocations.MoveNext()) - { - foreach (string name in parameters.NamedParameters.Keys) - { - object locations = namedParameterBindPoints[name]; - if (locations is int) - { - namedParameterBindPoints[name] = ((int)locations) + 1; - } - else - { - IList locationsList = (IList)locations; - for (int i = 0; i < locationsList.Count; i++) - { - locationsList[i] = ((int)locationsList[i]) + 1; - } - } - } - } - } - protected override void AutoDiscoverTypes(IDataReader rs) { MetaData metadata = new MetaData(rs); Modified: trunk/nhibernate/src/NHibernate/Loader/Loader.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Loader/Loader.cs 2009-09-15 21:39:54 UTC (rev 4713) +++ trunk/nhibernate/src/NHibernate/Loader/Loader.cs 2009-09-15 21:41:03 UTC (rev 4714) @@ -1174,7 +1174,6 @@ protected virtual SqlString ProcessFilters(QueryParameters parameters, ISessionImplementor session) { parameters.ProcessFilters(SqlString, session); - AdjustNamedParameterLocationsForQueryParameters(parameters); return parameters.FilteredSQL; } @@ -1269,15 +1268,6 @@ throw new AssertionFailure("no named parameters"); } - protected virtual void AdjustNamedParameterLocationsForQueryParameters(QueryParameters parameters) - { - // if you support named parameter locations (by overriding GetNamedParameterLocs), then you might need to - // allow for the locations to be adjusted by introduced filtered parameters by overriding - // this method too. - if ((parameters.NamedParameters != null) && (parameters.NamedParameters.Keys.Count > 0)) - throw new AssertionFailure(GetType() + " must override to handle implementation of named parameter locations"); - } - /// <summary> /// Fetch a <c>IDbCommand</c>, call <c>SetMaxRows</c> and then execute it, /// advance to the first result and return an SQL <c>IDataReader</c> @@ -1734,6 +1724,7 @@ for (int index = 0; index < parameters.PositionalParameterTypes.Length; index++) { int location = parameters.PositionalParameterLocations[index]; + location = parameters.FindAdjustedParameterLocation(location); IType type = parameters.PositionalParameterTypes[index]; ArrayHelper.SafeSetValue(paramTypeList, location, type); span += type.GetColumnSpan(Factory); @@ -1760,6 +1751,7 @@ for (int i = 0; i < locs.Length; i++) { int location = locs[i]; + location = parameters.FindAdjustedParameterLocation(location); // can still clash with positional parameters // could consider throwing an exception to locate problem (NH-1098) Modified: trunk/nhibernate/src/NHibernate/Param/ParameterTranslationsImpl.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Param/ParameterTranslationsImpl.cs 2009-09-15 21:39:54 UTC (rev 4713) +++ trunk/nhibernate/src/NHibernate/Param/ParameterTranslationsImpl.cs 2009-09-15 21:41:03 UTC (rev 4714) @@ -67,21 +67,6 @@ } } - public void AdjustNamedParameterLocationsForQueryParameters(QueryParameters parameters) - { - // NH Different behaviour NH-1776 - // Analyze all named parameters declared after filters - // in general all named parameters but depend on the complexity of the query (see sub query) - RestoreOriginalParameterLocations(); - foreach (int filterParameterLocation in parameters.FilteredParameterLocations) - { - foreach (ParameterInfo entry in _namedParameters.Values) - { - entry.IncrementLocationAfterFilterLocation(filterParameterLocation); - } - } - } - public int GetOrdinalParameterSqlLocation(int ordinalPosition) { return GetOrdinalParameterInfo(ordinalPosition).SqlLocations[0]; @@ -117,14 +102,6 @@ get { return _ordinalParameters.Length; } } - private void RestoreOriginalParameterLocations() - { - foreach (ParameterInfo entry in _namedParameters.Values) - { - entry.RestoreOriginalParameterLocations(); - } - } - private ParameterInfo GetOrdinalParameterInfo(int ordinalPosition) { // remember that ordinal parameters numbers are 1-based!!! @@ -170,24 +147,5 @@ } public IType ExpectedType { get; private set; } - - public void RestoreOriginalParameterLocations() - { - for (int i = 0; i < sqlLocations.Length; i++) - { - sqlLocations[i] = originalLocation[i]; - } - } - - public void IncrementLocationAfterFilterLocation(int filterParameterLocation) - { - for (int i = 0; i < sqlLocations.Length; i++) - { - if (sqlLocations[i] >= filterParameterLocation) - { - sqlLocations[i]++; - } - } - } } } \ No newline at end of file Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1908ThreadSafety/Fixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1908ThreadSafety/Fixture.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1908ThreadSafety/Fixture.cs 2009-09-15 21:41:03 UTC (rev 4714) @@ -0,0 +1,63 @@ +using System; +using System.Collections.Generic; +using System.Threading; +using NUnit.Framework; + +namespace NHibernate.Test.NHSpecificTest.NH1908ThreadSafety +{ + [TestFixture] + public class Fixture : BugTestCase + { + [Test] + public void UsingFiltersIsThreadSafe() + { + var errors = new List<Exception>(); + var threads = new List<Thread>(); + for (int i = 0; i < 50; i++) + { + var thread = new Thread(() => + { + try + { + ScenarioRunningWithMultiThreading(); + } + catch (Exception ex) + { + lock (errors) + errors.Add(ex); + } + }); + thread.Start(); + threads.Add(thread); + } + + foreach (var thread in threads) + { + thread.Join(); + } + + Assert.AreEqual(0, errors.Count); + } + + private void ScenarioRunningWithMultiThreading() + { + using (var session = sessions.OpenSession()) + { + session + .EnableFilter("CurrentOnly") + .SetParameter("date", DateTime.Now); + + session.CreateQuery( + @" + select u + from Order u + left join fetch u.ActiveOrderLines + where + u.Email = :email + ") + .SetString("email", "st...@bu...") + .UniqueResult<Order>(); + } + } + } +} Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1908ThreadSafety/Mappings.hbm.xml =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1908ThreadSafety/Mappings.hbm.xml (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1908ThreadSafety/Mappings.hbm.xml 2009-09-15 21:41:03 UTC (rev 4714) @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="utf-8" ?> +<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" + assembly="NHibernate.Test" + namespace="NHibernate.Test.NHSpecificTest.NH1908ThreadSafety"> + + <class name="Order" table="Orders"> + <id name="Id" type="Int64" unsaved-value="none"> + <generator class="assigned"/> + </id> + <property name="Email" type="String" not-null="true"/> + <bag name="ActiveOrderLines" inverse="true" cascade="none" lazy="true" + optimistic-lock="false"> + <key column="OrderId"/> + <one-to-many class="OrderLine"/> + <filter name="CurrentOnly"/> + </bag> + </class> + + <class name="OrderLine" discriminator-value="null"> + <id name="Id" type="Int64" unsaved-value="none"> + <generator class="assigned"/> + </id> + <property name="ValidUntil"/> + <filter name="CurrentOnly"/> + </class> + + <filter-def name="CurrentOnly" condition="ValidUntil > :date"> + <filter-param name="date" type="DateTime"/> + </filter-def> +</hibernate-mapping> Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1908ThreadSafety/Model.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1908ThreadSafety/Model.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1908ThreadSafety/Model.cs 2009-09-15 21:41:03 UTC (rev 4714) @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; + +namespace NHibernate.Test.NHSpecificTest.NH1908ThreadSafety +{ + public class Order + { + public virtual long Id { get; set; } + public virtual IList<OrderLine> ActiveOrderLines { get; set;} + public virtual string Email { get; set; } + } + + public class OrderLine + { + public virtual long Id { get; set; } + public virtual DateTime ValidUntil { get; set; } + } +} Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-09-15 21:39:54 UTC (rev 4713) +++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-09-15 21:41:03 UTC (rev 4714) @@ -580,6 +580,8 @@ <Compile Include="NHSpecificTest\NH1905\Model.cs" /> <Compile Include="NHSpecificTest\NH1907\Fixture.cs" /> <Compile Include="NHSpecificTest\NH1907\MyType.cs" /> + <Compile Include="NHSpecificTest\NH1908ThreadSafety\Fixture.cs" /> + <Compile Include="NHSpecificTest\NH1908ThreadSafety\Model.cs" /> <Compile Include="NHSpecificTest\NH1908\Fixture.cs" /> <Compile Include="NHSpecificTest\NH1908\Model.cs" /> <Compile Include="NHSpecificTest\NH1911\Fixture.cs" /> @@ -2006,6 +2008,7 @@ <EmbeddedResource Include="Criteria\Lambda\Mappings.hbm.xml" /> <EmbeddedResource Include="CfgTest\Loquacious\EntityToCache.hbm.xml" /> <Content Include="DynamicEntity\package.html" /> + <EmbeddedResource Include="NHSpecificTest\NH1908ThreadSafety\Mappings.hbm.xml" /> <EmbeddedResource Include="Tools\hbm2ddl\SchemaUpdate\1_Person.hbm.xml" /> <EmbeddedResource Include="Tools\hbm2ddl\SchemaUpdate\2_Person.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1938\Mappings.hbm.xml" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ric...@us...> - 2009-09-15 21:40:02
|
Revision: 4713 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4713&view=rev Author: ricbrown Date: 2009-09-15 21:39:54 +0000 (Tue, 15 Sep 2009) Log Message: ----------- Simplify filter parameter reordering and possible fix for NH-1908 threading issue. Modified Paths: -------------- branches/2.1.x/nhibernate/src/NHibernate/Engine/QueryParameters.cs branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Loader/QueryLoader.cs branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/QueryTranslatorImpl.cs branches/2.1.x/nhibernate/src/NHibernate/Hql/Classic/QueryTranslator.cs branches/2.1.x/nhibernate/src/NHibernate/Loader/Collection/SubselectCollectionLoader.cs branches/2.1.x/nhibernate/src/NHibernate/Loader/Collection/SubselectOneToManyLoader.cs branches/2.1.x/nhibernate/src/NHibernate/Loader/Custom/CustomLoader.cs branches/2.1.x/nhibernate/src/NHibernate/Loader/Loader.cs branches/2.1.x/nhibernate/src/NHibernate/Param/ParameterTranslationsImpl.cs branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj Added Paths: ----------- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1908ThreadSafety/ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1908ThreadSafety/Fixture.cs branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1908ThreadSafety/Mappings.hbm.xml branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1908ThreadSafety/Model.cs Modified: branches/2.1.x/nhibernate/src/NHibernate/Engine/QueryParameters.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Engine/QueryParameters.cs 2009-09-15 14:26:02 UTC (rev 4712) +++ branches/2.1.x/nhibernate/src/NHibernate/Engine/QueryParameters.cs 2009-09-15 21:39:54 UTC (rev 4713) @@ -39,6 +39,7 @@ private object _optionalId; private string _comment; private bool _readOnly; + private IDictionary<int, int> _adjustedParameterLocations; private SqlString processedSQL; @@ -286,15 +287,12 @@ /************** Filters ********************************/ - private void AdjustPostionalParameterLocations(int parameterIndex) + public int FindAdjustedParameterLocation(int parameterIndex) { - for (int i = 0; i < _positionalParameterLocations.Length; i++) - { - if (_positionalParameterLocations[i] >= parameterIndex) - { - _positionalParameterLocations[i]++; - } - } + if (_adjustedParameterLocations == null) + return parameterIndex; + + return _adjustedParameterLocations[parameterIndex]; } public void ProcessFilters(SqlString sql, ISessionImplementor session) @@ -314,7 +312,9 @@ var result = new SqlStringBuilder(); - int parameterIndex = 0; // keep track of the positional parameter + int originalParameterIndex = 0; // keep track of the positional parameter + int newParameterIndex = 0; + _adjustedParameterLocations = new Dictionary<int, int>(); foreach (var part in sql.Parts) { @@ -329,7 +329,9 @@ // types for the named parameters are added later to the end of the list. // see test fixture NH-1098 - parameterIndex++; + _adjustedParameterLocations[originalParameterIndex] = newParameterIndex; + originalParameterIndex++; + newParameterIndex++; continue; } @@ -358,9 +360,8 @@ result.AddParameter(); filteredParameterTypes.Add(type); filteredParameterValues.Add(elementValue); - filteredParameterLocations.Add(parameterIndex); - AdjustPostionalParameterLocations(parameterIndex); - parameterIndex++; + filteredParameterLocations.Add(newParameterIndex); + newParameterIndex++; if (i < coll.Count) { result.Add(", "); @@ -376,9 +377,8 @@ result.AddParameter(); filteredParameterTypes.Add(type); filteredParameterValues.Add(value); - filteredParameterLocations.Add(parameterIndex); - AdjustPostionalParameterLocations(parameterIndex); - parameterIndex++; + filteredParameterLocations.Add(newParameterIndex); + newParameterIndex++; } } } @@ -401,7 +401,7 @@ for (int i = 0; i < _positionalParameterLocations.Length; i++) { - int location = _positionalParameterLocations[i]; + int location = FindAdjustedParameterLocation(_positionalParameterLocations[i]); object value = _positionalParameterValues[i]; IType type = _positionalParameterTypes[i]; ArrayHelper.SafeSetValue(values, location, value); @@ -428,7 +428,7 @@ int[] locations = getNamedParameterLocations(name); for (int i = 0; i < locations.Length; i++) { - int location = locations[i]; + int location = FindAdjustedParameterLocation(locations[i]); // can still clash with positional parameters // could consider throwing an exception to locate problem (NH-1098) Modified: branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Loader/QueryLoader.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Loader/QueryLoader.cs 2009-09-15 14:26:02 UTC (rev 4712) +++ branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Loader/QueryLoader.cs 2009-09-15 21:39:54 UTC (rev 4713) @@ -58,11 +58,6 @@ get { return HasSubselectLoadableCollections(); } } - protected override void AdjustNamedParameterLocationsForQueryParameters(QueryParameters parameters) - { - _queryTranslator.AdjustNamedParameterLocationsForQueryParameters(parameters); - } - protected override SqlString ApplyLocks(SqlString sql, IDictionary<string, LockMode> lockModes, Dialect.Dialect dialect) { Modified: branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/QueryTranslatorImpl.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/QueryTranslatorImpl.cs 2009-09-15 14:26:02 UTC (rev 4712) +++ branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/QueryTranslatorImpl.cs 2009-09-15 21:39:54 UTC (rev 4713) @@ -442,11 +442,6 @@ throw new QueryExecutionRequestException("Not supported for DML operations", _hql); } } - - public void AdjustNamedParameterLocationsForQueryParameters(QueryParameters parameters) - { - ((ParameterTranslationsImpl) GetParameterTranslations()).AdjustNamedParameterLocationsForQueryParameters(parameters); - } } internal class HqlParseEngine Modified: branches/2.1.x/nhibernate/src/NHibernate/Hql/Classic/QueryTranslator.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Hql/Classic/QueryTranslator.cs 2009-09-15 14:26:02 UTC (rev 4712) +++ branches/2.1.x/nhibernate/src/NHibernate/Hql/Classic/QueryTranslator.cs 2009-09-15 21:39:54 UTC (rev 4713) @@ -705,21 +705,6 @@ return o.ToArray(); } - protected override void AdjustNamedParameterLocationsForQueryParameters(QueryParameters parameters) - { - foreach (int existingParameterLocation in parameters.FilteredParameterLocations) - { - foreach (IList<int> namedParameterLocations in namedParameters.Values) - { - for (int index = 0; index < namedParameterLocations.Count; index++) - { - if (namedParameterLocations[index] >= existingParameterLocation) - namedParameterLocations[index]++; - } - } - } - } - public static string ScalarName(int x, int y) { return new StringBuilder() Modified: branches/2.1.x/nhibernate/src/NHibernate/Loader/Collection/SubselectCollectionLoader.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Loader/Collection/SubselectCollectionLoader.cs 2009-09-15 14:26:02 UTC (rev 4712) +++ branches/2.1.x/nhibernate/src/NHibernate/Loader/Collection/SubselectCollectionLoader.cs 2009-09-15 21:39:54 UTC (rev 4713) @@ -43,23 +43,5 @@ { return namedParameterLocMap[name]; } - - protected override void AdjustNamedParameterLocationsForQueryParameters(QueryParameters parameters) - { - if (namedParameterLocMap == null) - return; - - foreach (int existingParameterLocation in parameters.FilteredParameterLocations) - { - foreach (IList<int> namedParameterLocations in namedParameterLocMap.Values) - { - for (int index = 0; index < namedParameterLocations.Count; index++) - { - if (namedParameterLocations[index] >= existingParameterLocation) - namedParameterLocations[index]++; - } - } - } - } } } \ No newline at end of file Modified: branches/2.1.x/nhibernate/src/NHibernate/Loader/Collection/SubselectOneToManyLoader.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Loader/Collection/SubselectOneToManyLoader.cs 2009-09-15 14:26:02 UTC (rev 4712) +++ branches/2.1.x/nhibernate/src/NHibernate/Loader/Collection/SubselectOneToManyLoader.cs 2009-09-15 21:39:54 UTC (rev 4713) @@ -45,24 +45,5 @@ { return namedParameterLocMap[name]; } - - protected override void AdjustNamedParameterLocationsForQueryParameters(QueryParameters parameters) - { - if (namedParameterLocMap == null) - return; - - foreach (int existingParameterLocation in parameters.FilteredParameterLocations) - { - foreach (IList<int> namedParameterLocations in namedParameterLocMap.Values) - { - for (int index = 0; index < namedParameterLocations.Count; index++) - { - if (namedParameterLocations[index] >= existingParameterLocation) - namedParameterLocations[index]++; - } - } - } - } - } } \ No newline at end of file Modified: branches/2.1.x/nhibernate/src/NHibernate/Loader/Custom/CustomLoader.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Loader/Custom/CustomLoader.cs 2009-09-15 14:26:02 UTC (rev 4712) +++ branches/2.1.x/nhibernate/src/NHibernate/Loader/Custom/CustomLoader.cs 2009-09-15 21:39:54 UTC (rev 4713) @@ -320,30 +320,6 @@ } } - protected override void AdjustNamedParameterLocationsForQueryParameters(QueryParameters parameters) - { - var existingParameterLocations = parameters.FilteredParameterLocations.GetEnumerator(); - while (existingParameterLocations.MoveNext()) - { - foreach (string name in parameters.NamedParameters.Keys) - { - object locations = namedParameterBindPoints[name]; - if (locations is int) - { - namedParameterBindPoints[name] = ((int)locations) + 1; - } - else - { - IList locationsList = (IList)locations; - for (int i = 0; i < locationsList.Count; i++) - { - locationsList[i] = ((int)locationsList[i]) + 1; - } - } - } - } - } - protected override void AutoDiscoverTypes(IDataReader rs) { MetaData metadata = new MetaData(rs); Modified: branches/2.1.x/nhibernate/src/NHibernate/Loader/Loader.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Loader/Loader.cs 2009-09-15 14:26:02 UTC (rev 4712) +++ branches/2.1.x/nhibernate/src/NHibernate/Loader/Loader.cs 2009-09-15 21:39:54 UTC (rev 4713) @@ -1174,7 +1174,6 @@ protected virtual SqlString ProcessFilters(QueryParameters parameters, ISessionImplementor session) { parameters.ProcessFilters(SqlString, session); - AdjustNamedParameterLocationsForQueryParameters(parameters); return parameters.FilteredSQL; } @@ -1269,15 +1268,6 @@ throw new AssertionFailure("no named parameters"); } - protected virtual void AdjustNamedParameterLocationsForQueryParameters(QueryParameters parameters) - { - // if you support named parameter locations (by overriding GetNamedParameterLocs), then you might need to - // allow for the locations to be adjusted by introduced filtered parameters by overriding - // this method too. - if ((parameters.NamedParameters != null) && (parameters.NamedParameters.Keys.Count > 0)) - throw new AssertionFailure(GetType() + " must override to handle implementation of named parameter locations"); - } - /// <summary> /// Fetch a <c>IDbCommand</c>, call <c>SetMaxRows</c> and then execute it, /// advance to the first result and return an SQL <c>IDataReader</c> @@ -1734,6 +1724,7 @@ for (int index = 0; index < parameters.PositionalParameterTypes.Length; index++) { int location = parameters.PositionalParameterLocations[index]; + location = parameters.FindAdjustedParameterLocation(location); IType type = parameters.PositionalParameterTypes[index]; ArrayHelper.SafeSetValue(paramTypeList, location, type); span += type.GetColumnSpan(Factory); @@ -1760,6 +1751,7 @@ for (int i = 0; i < locs.Length; i++) { int location = locs[i]; + location = parameters.FindAdjustedParameterLocation(location); // can still clash with positional parameters // could consider throwing an exception to locate problem (NH-1098) Modified: branches/2.1.x/nhibernate/src/NHibernate/Param/ParameterTranslationsImpl.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Param/ParameterTranslationsImpl.cs 2009-09-15 14:26:02 UTC (rev 4712) +++ branches/2.1.x/nhibernate/src/NHibernate/Param/ParameterTranslationsImpl.cs 2009-09-15 21:39:54 UTC (rev 4713) @@ -67,21 +67,6 @@ } } - public void AdjustNamedParameterLocationsForQueryParameters(QueryParameters parameters) - { - // NH Different behaviour NH-1776 - // Analyze all named parameters declared after filters - // in general all named parameters but depend on the complexity of the query (see sub query) - RestoreOriginalParameterLocations(); - foreach (int filterParameterLocation in parameters.FilteredParameterLocations) - { - foreach (ParameterInfo entry in _namedParameters.Values) - { - entry.IncrementLocationAfterFilterLocation(filterParameterLocation); - } - } - } - public int GetOrdinalParameterSqlLocation(int ordinalPosition) { return GetOrdinalParameterInfo(ordinalPosition).SqlLocations[0]; @@ -117,14 +102,6 @@ get { return _ordinalParameters.Length; } } - private void RestoreOriginalParameterLocations() - { - foreach (ParameterInfo entry in _namedParameters.Values) - { - entry.RestoreOriginalParameterLocations(); - } - } - private ParameterInfo GetOrdinalParameterInfo(int ordinalPosition) { // remember that ordinal parameters numbers are 1-based!!! @@ -170,24 +147,5 @@ } public IType ExpectedType { get; private set; } - - public void RestoreOriginalParameterLocations() - { - for (int i = 0; i < sqlLocations.Length; i++) - { - sqlLocations[i] = originalLocation[i]; - } - } - - public void IncrementLocationAfterFilterLocation(int filterParameterLocation) - { - for (int i = 0; i < sqlLocations.Length; i++) - { - if (sqlLocations[i] >= filterParameterLocation) - { - sqlLocations[i]++; - } - } - } } } \ No newline at end of file Added: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1908ThreadSafety/Fixture.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1908ThreadSafety/Fixture.cs (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1908ThreadSafety/Fixture.cs 2009-09-15 21:39:54 UTC (rev 4713) @@ -0,0 +1,63 @@ +using System; +using System.Collections.Generic; +using System.Threading; +using NUnit.Framework; + +namespace NHibernate.Test.NHSpecificTest.NH1908ThreadSafety +{ + [TestFixture] + public class Fixture : BugTestCase + { + [Test] + public void UsingFiltersIsThreadSafe() + { + var errors = new List<Exception>(); + var threads = new List<Thread>(); + for (int i = 0; i < 50; i++) + { + var thread = new Thread(() => + { + try + { + ScenarioRunningWithMultiThreading(); + } + catch (Exception ex) + { + lock (errors) + errors.Add(ex); + } + }); + thread.Start(); + threads.Add(thread); + } + + foreach (var thread in threads) + { + thread.Join(); + } + + Assert.AreEqual(0, errors.Count); + } + + private void ScenarioRunningWithMultiThreading() + { + using (var session = sessions.OpenSession()) + { + session + .EnableFilter("CurrentOnly") + .SetParameter("date", DateTime.Now); + + session.CreateQuery( + @" + select u + from Order u + left join fetch u.ActiveOrderLines + where + u.Email = :email + ") + .SetString("email", "st...@bu...") + .UniqueResult<Order>(); + } + } + } +} Added: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1908ThreadSafety/Mappings.hbm.xml =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1908ThreadSafety/Mappings.hbm.xml (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1908ThreadSafety/Mappings.hbm.xml 2009-09-15 21:39:54 UTC (rev 4713) @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="utf-8" ?> +<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" + assembly="NHibernate.Test" + namespace="NHibernate.Test.NHSpecificTest.NH1908ThreadSafety"> + + <class name="Order" table="Orders"> + <id name="Id" type="Int64" unsaved-value="none"> + <generator class="assigned"/> + </id> + <property name="Email" type="String" not-null="true"/> + <bag name="ActiveOrderLines" inverse="true" cascade="none" lazy="true" + optimistic-lock="false"> + <key column="OrderId"/> + <one-to-many class="OrderLine"/> + <filter name="CurrentOnly"/> + </bag> + </class> + + <class name="OrderLine" discriminator-value="null"> + <id name="Id" type="Int64" unsaved-value="none"> + <generator class="assigned"/> + </id> + <property name="ValidUntil"/> + <filter name="CurrentOnly"/> + </class> + + <filter-def name="CurrentOnly" condition="ValidUntil > :date"> + <filter-param name="date" type="DateTime"/> + </filter-def> +</hibernate-mapping> Added: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1908ThreadSafety/Model.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1908ThreadSafety/Model.cs (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1908ThreadSafety/Model.cs 2009-09-15 21:39:54 UTC (rev 4713) @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; + +namespace NHibernate.Test.NHSpecificTest.NH1908ThreadSafety +{ + public class Order + { + public virtual long Id { get; set; } + public virtual IList<OrderLine> ActiveOrderLines { get; set;} + public virtual string Email { get; set; } + } + + public class OrderLine + { + public virtual long Id { get; set; } + public virtual DateTime ValidUntil { get; set; } + } +} Modified: branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-09-15 14:26:02 UTC (rev 4712) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-09-15 21:39:54 UTC (rev 4713) @@ -361,6 +361,8 @@ <Compile Include="NHSpecificTest\ElementsEnums\Something.cs" /> <Compile Include="NHSpecificTest\NH1905\Fixture.cs" /> <Compile Include="NHSpecificTest\NH1905\Model.cs" /> + <Compile Include="NHSpecificTest\NH1908ThreadSafety\Fixture.cs" /> + <Compile Include="NHSpecificTest\NH1908ThreadSafety\Model.cs" /> <Compile Include="NHSpecificTest\NH1911\Fixture.cs" /> <Compile Include="NHSpecificTest\NH1911\Model.cs" /> <Compile Include="NHSpecificTest\NH1920\Fixture.cs" /> @@ -1979,6 +1981,7 @@ <EmbeddedResource Include="Bytecode\Lightweight\ProductLine.hbm.xml" /> <EmbeddedResource Include="DriverTest\MultiTypeEntity.hbm.xml" /> <Content Include="DynamicEntity\package.html" /> + <EmbeddedResource Include="NHSpecificTest\NH1908ThreadSafety\Mappings.hbm.xml" /> <EmbeddedResource Include="Tools\hbm2ddl\SchemaUpdate\1_Person.hbm.xml" /> <EmbeddedResource Include="Tools\hbm2ddl\SchemaUpdate\2_Person.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1938\Mappings.hbm.xml" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ste...@us...> - 2009-09-15 14:26:12
|
Revision: 4712 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4712&view=rev Author: steverstrong Date: 2009-09-15 14:26:02 +0000 (Tue, 15 Sep 2009) Log Message: ----------- Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/DotNode.cs trunk/nhibernate/src/NHibernate/Hql/Ast/HqlTreeBuilder.cs trunk/nhibernate/src/NHibernate/Hql/Ast/HqlTreeNode.cs trunk/nhibernate/src/NHibernate/Linq/CommandData.cs trunk/nhibernate/src/NHibernate/Linq/HqlNodeStack.cs trunk/nhibernate/src/NHibernate/Linq/NhExpressionTreeVisitor.cs trunk/nhibernate/src/NHibernate/Linq/Nominator.cs trunk/nhibernate/src/NHibernate/Linq/ProjectionEvaluator.cs trunk/nhibernate/src/NHibernate/Linq/QueryModelVisitor.cs trunk/nhibernate/src/NHibernate/Linq/ResultTransformer.cs trunk/nhibernate/src/NHibernate/NHibernate.csproj trunk/nhibernate/src/NHibernate/Type/TypeFactory.cs trunk/nhibernate/src/NHibernate.Test/Linq/LinqQuerySamples.cs trunk/nhibernate/src/NHibernate.Test/Linq/LinqTestCase.cs trunk/nhibernate/src/NHibernate.Test/Linq/Mappings/Product.hbm.xml trunk/nhibernate/src/NHibernate.Test/Linq/Mappings/ProductCategory.hbm.xml trunk/nhibernate/src/NHibernate.Test/Linq/ReadonlyTestCase.cs Added Paths: ----------- trunk/nhibernate/src/NHibernate/Linq/AggregateDetectionVisitor.cs trunk/nhibernate/src/NHibernate/Linq/AggregatingGroupByRewriter.cs trunk/nhibernate/src/NHibernate/Linq/ClientSideTransformOperator.cs trunk/nhibernate/src/NHibernate/Linq/EnumerableHelper.cs trunk/nhibernate/src/NHibernate/Linq/GroupBySelectClauseVisitor.cs trunk/nhibernate/src/NHibernate/Linq/GroupBySelectorVisitor.cs trunk/nhibernate/src/NHibernate/Linq/HqlGeneratorExpressionTreeVisitor.cs trunk/nhibernate/src/NHibernate/Linq/NhThrowingExpressionTreeVisitor.cs trunk/nhibernate/src/NHibernate/Linq/NonAggregatingGroupBy.cs trunk/nhibernate/src/NHibernate/Linq/NonAggregatingGroupByRewriter.cs Property Changed: ---------------- trunk/nhibernate/src/NHibernate/Linq/ Modified: trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/DotNode.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/DotNode.cs 2009-09-10 18:24:03 UTC (rev 4711) +++ trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/DotNode.cs 2009-09-15 14:26:02 UTC (rev 4712) @@ -496,11 +496,11 @@ // /////////////////////////////////////////////////////////////////////////////// - bool found = elem != null; - // even though we might find a pre-existing element by join path, for FromElements originating in a from-clause - // we should only ever use the found element if the aliases match (null != null here). Implied joins are - // always (?) ok to reuse. - bool useFoundFromElement = found && ( elem.IsImplied || ( AreSame(classAlias, elem.ClassAlias ) ) ); + bool found = elem != null; + // even though we might find a pre-existing element by join path, for FromElements originating in a from-clause + // we should only ever use the found element if the aliases match (null != null here). Implied joins are + // always (?) ok to reuse. + bool useFoundFromElement = found && ( elem.IsImplied || ( AreSame(classAlias, elem.ClassAlias ) ) ); if ( ! useFoundFromElement ) { @@ -537,10 +537,10 @@ FromElement = elem; // This 'dot' expression now refers to the resulting from element. } - private bool AreSame(String alias1, String alias2) { - // again, null != null here - return !StringHelper.IsEmpty( alias1 ) && !StringHelper.IsEmpty( alias2 ) && alias1.Equals( alias2 ); - } + private bool AreSame(String alias1, String alias2) { + // again, null != null here + return !StringHelper.IsEmpty( alias1 ) && !StringHelper.IsEmpty( alias2 ) && alias1.Equals( alias2 ); + } private void SetImpliedJoin(FromElement elem) { Modified: trunk/nhibernate/src/NHibernate/Hql/Ast/HqlTreeBuilder.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Hql/Ast/HqlTreeBuilder.cs 2009-09-10 18:24:03 UTC (rev 4711) +++ trunk/nhibernate/src/NHibernate/Hql/Ast/HqlTreeBuilder.cs 2009-09-15 14:26:02 UTC (rev 4712) @@ -8,7 +8,7 @@ { public class HqlTreeBuilder { - private readonly ASTFactory _factory; + private readonly IASTFactory _factory; public HqlTreeBuilder() { @@ -85,6 +85,11 @@ return new HqlIdent(_factory, ident); } + public HqlIdent Ident(System.Type type) + { + return new HqlIdent(_factory, type); + } + public HqlAlias Alias(string alias) { return new HqlAlias(_factory, alias); @@ -179,6 +184,11 @@ } } + public HqlOrderBy OrderBy() + { + return new HqlOrderBy(_factory); + } + public HqlOrderBy OrderBy(HqlTreeNode expression, HqlDirection hqlDirection) { return new HqlOrderBy(_factory, expression, hqlDirection); @@ -249,6 +259,11 @@ return new HqlGreaterThanOrEqual(_factory); } + public HqlCount Count() + { + return new HqlCount(_factory); + } + public HqlCount Count(HqlTreeNode child) { return new HqlCount(_factory, child); @@ -299,11 +314,21 @@ return new HqlMin(_factory); } + public HqlMin Min(HqlTreeNode expression) + { + return new HqlMin(_factory, expression); + } + public HqlMax Max() { return new HqlMax(_factory); } + public HqlMax Max(HqlTreeNode expression) + { + return new HqlMax(_factory, expression); + } + public HqlAnd And(HqlTreeNode left, HqlTreeNode right) { return new HqlAnd(_factory, left, right); @@ -328,5 +353,26 @@ { return new HqlElements(_factory); } + + public HqlDistinct Distinct() + { + return new HqlDistinct(_factory); + } + + public HqlDirectionAscending Ascending() + { + return new HqlDirectionAscending(_factory); + } + + public HqlDirectionDescending Descending() + { + return new HqlDirectionDescending(_factory); + } + + public HqlGroupBy GroupBy() + { + return new HqlGroupBy(_factory); + } } + } \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate/Hql/Ast/HqlTreeNode.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Hql/Ast/HqlTreeNode.cs 2009-09-10 18:24:03 UTC (rev 4711) +++ trunk/nhibernate/src/NHibernate/Hql/Ast/HqlTreeNode.cs 2009-09-15 14:26:02 UTC (rev 4712) @@ -82,6 +82,13 @@ _children.Add(child); _node.AddChild(child.AstNode); } + + public void AddChild(int index, HqlTreeNode node) + { + _children.Insert(index, node); + _node.InsertChild(index, node.AstNode); + } + } public class HqlQuery : HqlTreeNode @@ -99,6 +106,41 @@ : base(HqlSqlWalker.IDENT, ident, factory) { } + + internal HqlIdent(IASTFactory factory, System.Type type) + : base(HqlSqlWalker.IDENT, "", factory) + { + if (IsNullableType(type)) + { + type = ExtractUnderlyingTypeFromNullable(type); + } + + switch (System.Type.GetTypeCode(type)) + { + case TypeCode.Int32: + _node.Text = "integer"; + break; + case TypeCode.Decimal: + _node.Text = "decimal"; + break; + case TypeCode.DateTime: + _node.Text = "datetime"; + break; + default: + throw new NotSupportedException(string.Format("Don't currently support idents of type {0}", type.Name)); + } + } + + private static System.Type ExtractUnderlyingTypeFromNullable(System.Type type) + { + return type.GetGenericArguments()[0]; + } + + private static bool IsNullableType(System.Type type) + { + return (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>)); + } + } public class HqlRange : HqlTreeNode @@ -276,6 +318,11 @@ public class HqlOrderBy : HqlTreeNode { + public HqlOrderBy(IASTFactory factory) + : base(HqlSqlWalker.ORDER, "", factory) + { + } + public HqlOrderBy(IASTFactory factory, HqlTreeNode expression, HqlDirection hqlDirection) : base(HqlSqlWalker.ORDER, "", factory, expression, hqlDirection == HqlDirection.Ascending ? @@ -405,6 +452,12 @@ public class HqlCount : HqlTreeNode { + + public HqlCount(IASTFactory factory) + : base(HqlSqlWalker.COUNT, "count", factory) + { + } + public HqlCount(IASTFactory factory, HqlTreeNode child) : base(HqlSqlWalker.COUNT, "count", factory, child) { @@ -430,41 +483,9 @@ { public HqlCast(IASTFactory factory, HqlTreeNode expression, System.Type type) : base(HqlSqlWalker.METHOD_CALL, "method", factory) { - HqlIdent typeIdent; - - if (IsNullableType(type)) - { - type = ExtractUnderlyingTypeFromNullable(type); - } - - switch (System.Type.GetTypeCode(type)) - { - case TypeCode.Int32: - typeIdent = new HqlIdent(factory, "integer"); - break; - case TypeCode.Decimal: - typeIdent = new HqlIdent(factory, "decimal"); - break; - case TypeCode.DateTime: - typeIdent = new HqlIdent(factory, "datetime"); - break; - default: - throw new NotSupportedException(string.Format("Don't currently support casts to {0}", type.Name)); - } - AddChild(new HqlIdent(factory, "cast")); - AddChild(new HqlExpressionList(factory, expression, typeIdent)); + AddChild(new HqlExpressionList(factory, expression, new HqlIdent(factory, type))); } - - private static System.Type ExtractUnderlyingTypeFromNullable(System.Type type) - { - return type.GetGenericArguments()[0]; - } - - private static bool IsNullableType(System.Type type) - { - return (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>)); - } } public class HqlExpressionList : HqlTreeNode @@ -518,14 +539,24 @@ public HqlMax(IASTFactory factory) : base(HqlSqlWalker.AGGREGATE, "max", factory) { } - } + public HqlMax(IASTFactory factory, HqlTreeNode expression) + : base(HqlSqlWalker.AGGREGATE, "max", factory, expression) + { + } +} + public class HqlMin : HqlTreeNode { public HqlMin(IASTFactory factory) : base(HqlSqlWalker.AGGREGATE, "min", factory) { } + + public HqlMin(IASTFactory factory, HqlTreeNode expression) + : base(HqlSqlWalker.AGGREGATE, "min", factory, expression) + { + } } public class HqlAnd : HqlTreeNode @@ -563,4 +594,18 @@ } } + public class HqlDistinct : HqlTreeNode + { + public HqlDistinct(IASTFactory factory) : base(HqlSqlWalker.DISTINCT, "distinct", factory) + { + } + } + + public class HqlGroupBy : HqlTreeNode + { + public HqlGroupBy(IASTFactory factory) : base(HqlSqlWalker.GROUP, "group by", factory) + { + } + } + } \ No newline at end of file Property changes on: trunk/nhibernate/src/NHibernate/Linq ___________________________________________________________________ Added: svn:ignore + _ReSharper.TempSolution Added: trunk/nhibernate/src/NHibernate/Linq/AggregateDetectionVisitor.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Linq/AggregateDetectionVisitor.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/Linq/AggregateDetectionVisitor.cs 2009-09-15 14:26:02 UTC (rev 4712) @@ -0,0 +1,54 @@ +using System.Linq; +using System.Linq.Expressions; +using Remotion.Data.Linq.Clauses.Expressions; +using Remotion.Data.Linq.Clauses.ResultOperators; +using Remotion.Data.Linq.Parsing; + +namespace NHibernate.Linq +{ + // TODO: This needs strengthening. For example, it doesn't recurse into SubQueries at present + internal class AggregateDetectionVisitor : ExpressionTreeVisitor + { + public bool ContainsAggregateMethods { get; private set; } + + public bool Visit(Expression expression) + { + ContainsAggregateMethods = false; + + VisitExpression(expression); + + return ContainsAggregateMethods; + } + + protected override Expression VisitMethodCallExpression(MethodCallExpression m) + { + if (m.Method.DeclaringType == typeof (Queryable) || + m.Method.DeclaringType == typeof (Enumerable)) + { + switch (m.Method.Name) + { + case "Count": + case "Min": + case "Max": + case "Sum": + case "Average": + ContainsAggregateMethods = true; + break; + } + } + + return base.VisitMethodCallExpression(m); + } + + protected override Expression VisitSubQueryExpression(SubQueryExpression expression) + { + if (expression.QueryModel.ResultOperators.Count == 1 + && typeof(ValueFromSequenceResultOperatorBase).IsAssignableFrom(expression.QueryModel.ResultOperators[0].GetType())) + { + ContainsAggregateMethods = true; + } + + return base.VisitSubQueryExpression(expression); + } + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate/Linq/AggregatingGroupByRewriter.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Linq/AggregatingGroupByRewriter.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/Linq/AggregatingGroupByRewriter.cs 2009-09-15 14:26:02 UTC (rev 4712) @@ -0,0 +1,57 @@ +using System; +using System.Linq; +using Remotion.Data.Linq; +using Remotion.Data.Linq.Clauses; +using Remotion.Data.Linq.Clauses.Expressions; +using Remotion.Data.Linq.Clauses.ResultOperators; + +namespace NHibernate.Linq +{ + public class AggregatingGroupByRewriter : QueryModelVisitorBase + { + public override void VisitMainFromClause(MainFromClause fromClause, QueryModel queryModel) + { + var subQueryExpression = fromClause.FromExpression as SubQueryExpression; + + if ((subQueryExpression != null) && + (subQueryExpression.QueryModel.ResultOperators.Count() == 1) && + (subQueryExpression.QueryModel.ResultOperators[0] is GroupResultOperator) && + (IsAggregatingGroupBy(queryModel))) + { + FlattenSubQuery(subQueryExpression, fromClause, queryModel); + } + + base.VisitMainFromClause(fromClause, queryModel); + } + + private static bool IsAggregatingGroupBy(QueryModel queryModel) + { + return new AggregateDetectionVisitor().Visit(queryModel.SelectClause.Selector); + } + + private void FlattenSubQuery(SubQueryExpression subQueryExpression, FromClauseBase fromClause, + QueryModel queryModel) + { + // Replace the outer select clause... + queryModel.SelectClause.TransformExpressions(GroupBySelectClauseVisitor.Visit); + + MainFromClause innerMainFromClause = subQueryExpression.QueryModel.MainFromClause; + CopyFromClauseData(innerMainFromClause, fromClause); + + // Move the result operator up + if (queryModel.ResultOperators.Count != 0) + { + throw new NotImplementedException(); + } + + queryModel.ResultOperators.Add(subQueryExpression.QueryModel.ResultOperators[0]); + } + + protected void CopyFromClauseData(FromClauseBase source, FromClauseBase destination) + { + destination.FromExpression = source.FromExpression; + destination.ItemName = source.ItemName; + destination.ItemType = source.ItemType; + } + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate/Linq/ClientSideTransformOperator.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Linq/ClientSideTransformOperator.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/Linq/ClientSideTransformOperator.cs 2009-09-15 14:26:02 UTC (rev 4712) @@ -0,0 +1,24 @@ +using System; +using Remotion.Data.Linq.Clauses; +using Remotion.Data.Linq.Clauses.StreamedData; + +namespace NHibernate.Linq +{ + public class ClientSideTransformOperator : ResultOperatorBase + { + public override IStreamedData ExecuteInMemory(IStreamedData input) + { + throw new NotImplementedException(); + } + + public override IStreamedDataInfo GetOutputDataInfo(IStreamedDataInfo inputInfo) + { + throw new NotImplementedException(); + } + + public override ResultOperatorBase Clone(CloneContext cloneContext) + { + throw new NotImplementedException(); + } + } +} \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate/Linq/CommandData.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Linq/CommandData.cs 2009-09-10 18:24:03 UTC (rev 4711) +++ trunk/nhibernate/src/NHibernate/Linq/CommandData.cs 2009-09-15 14:26:02 UTC (rev 4712) @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Linq.Expressions; using NHibernate.Hql.Ast; @@ -7,37 +8,83 @@ { public class CommandData { - public CommandData(HqlQuery statement, NamedParameter[] namedParameters, LambdaExpression projectionExpression, List<Action<IQuery>> additionalCriteria) + private readonly List<LambdaExpression> _itemTransformers; + private readonly List<LambdaExpression> _listTransformers; + + public CommandData(HqlQuery statement, NamedParameter[] namedParameters, List<LambdaExpression> itemTransformers, List<LambdaExpression> listTransformers, List<Action<IQuery>> additionalCriteria) { + _itemTransformers = itemTransformers; + _listTransformers = listTransformers; + Statement = statement; NamedParameters = namedParameters; - ProjectionExpression = projectionExpression; AdditionalCriteria = additionalCriteria; } public HqlQuery Statement { get; private set; } public NamedParameter[] NamedParameters { get; private set; } - public LambdaExpression ProjectionExpression { get; set; } + public List<Action<IQuery>> AdditionalCriteria { get; set; } + public System.Type QueryResultType { get; set; } + public IQuery CreateQuery(ISession session, System.Type type) { var query = session.CreateQuery(new HqlExpression(Statement, type)); + SetParameters(query); + + SetResultTransformer(query); + + AddAdditionalCriteria(query); + + return query; + } + + private void SetParameters(IQuery query) + { foreach (var parameter in NamedParameters) + { query.SetParameter(parameter.Name, parameter.Value); - - if (ProjectionExpression != null) - { - query.SetResultTransformer(new ResultTransformer(ProjectionExpression)); } + } + private void AddAdditionalCriteria(IQuery query) + { foreach (var criteria in AdditionalCriteria) { criteria(query); } + } - return query; + private void SetResultTransformer(IQuery query) + { + var itemTransformer = MergeLambdas(_itemTransformers); + var listTransformer = MergeLambdas(_listTransformers); + + if (itemTransformer != null || listTransformer != null) + { + query.SetResultTransformer(new ResultTransformer(itemTransformer, listTransformer)); + } } + + private static LambdaExpression MergeLambdas(IList<LambdaExpression> transformations) + { + if (transformations == null || transformations.Count == 0) + { + return null; + } + + var listTransformLambda = transformations[0]; + + for (int i = 1; i < transformations.Count; i++) + { + var invoked = Expression.Invoke(transformations[i], listTransformLambda.Body); + + listTransformLambda = Expression.Lambda(invoked, listTransformLambda.Parameters.ToArray()); + } + + return listTransformLambda; + } } } \ No newline at end of file Added: trunk/nhibernate/src/NHibernate/Linq/EnumerableHelper.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Linq/EnumerableHelper.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/Linq/EnumerableHelper.cs 2009-09-15 14:26:02 UTC (rev 4712) @@ -0,0 +1,53 @@ +using System.Linq; +using System.Reflection; + +namespace NHibernate.Linq +{ + public static class EnumerableHelper + { + public static MethodInfo GetMethod(string name, System.Type[] parameterTypes) + { + return typeof(Enumerable).GetMethods(BindingFlags.Static | BindingFlags.Public) + .Where(m => m.Name == name && + ParameterTypesMatch(m.GetParameters(), parameterTypes)) + .Single(); + } + + public static MethodInfo GetMethod(string name, System.Type[] parameterTypes, System.Type[] genericTypeParameters) + { + return typeof(Enumerable).GetMethods(BindingFlags.Static | BindingFlags.Public) + .Where(m => m.Name == name && + m.ContainsGenericParameters && + m.GetGenericArguments().Count() == genericTypeParameters.Length && + ParameterTypesMatch(m.GetParameters(), parameterTypes)) + .Single() + .MakeGenericMethod(genericTypeParameters); + } + + private static bool ParameterTypesMatch(ParameterInfo[] parameters, System.Type[] types) + { + if (parameters.Length != types.Length) + { + return false; + } + + for (int i = 0; i < parameters.Length; i++) + { + if (parameters[i].ParameterType == types[i]) + { + continue; + } + + if (parameters[i].ParameterType.ContainsGenericParameters && types[i].ContainsGenericParameters && + parameters[i].ParameterType.GetGenericArguments().Length == types[i].GetGenericArguments().Length) + { + continue; + } + + return false; + } + + return true; + } + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate/Linq/GroupBySelectClauseVisitor.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Linq/GroupBySelectClauseVisitor.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/Linq/GroupBySelectClauseVisitor.cs 2009-09-15 14:26:02 UTC (rev 4712) @@ -0,0 +1,148 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using Remotion.Data.Linq.Clauses; +using Remotion.Data.Linq.Clauses.Expressions; +using Remotion.Data.Linq.Clauses.ResultOperators; +using Remotion.Data.Linq.Parsing; + +namespace NHibernate.Linq +{ + internal class GroupBySelectClauseVisitor : ExpressionTreeVisitor + { + public static Expression Visit(Expression expression) + { + var visitor = new GroupBySelectClauseVisitor(); + return visitor.VisitExpression(expression); + } + + protected override Expression VisitMemberExpression(MemberExpression expression) + { + if (expression.Member.Name == "Key" && + expression.Member.DeclaringType.GetGenericTypeDefinition() == typeof (IGrouping<,>)) + { + var querySourceRef = expression.Expression as QuerySourceReferenceExpression; + + var fromClause = querySourceRef.ReferencedQuerySource as FromClauseBase; + + var subQuery = fromClause.FromExpression as SubQueryExpression; + + var groupBy = + subQuery.QueryModel.ResultOperators.Where(r => r is GroupResultOperator).Single() as + GroupResultOperator; + + return groupBy.KeySelector; + } + else + { + return base.VisitMemberExpression(expression); + } + } + + protected override Expression VisitSubQueryExpression(SubQueryExpression expression) + { + if (expression.QueryModel.ResultOperators.Count == 1) + { + ResultOperatorBase resultOperator = expression.QueryModel.ResultOperators[0]; + + if (resultOperator is AverageResultOperator) + { + return new AverageExpression(expression.QueryModel.SelectClause.Selector); + } + else if (resultOperator is MinResultOperator) + { + return new MinExpression(expression.QueryModel.SelectClause.Selector); + } + else if (resultOperator is MaxResultOperator) + { + return new MaxExpression(expression.QueryModel.SelectClause.Selector); + } + else if (resultOperator is CountResultOperator) + { + return new CountExpression(); + } + else if (resultOperator is SumResultOperator) + { + return new SumExpression(expression.QueryModel.SelectClause.Selector); + } + else + { + throw new NotImplementedException(); + } + } + else + { + return base.VisitSubQueryExpression(expression); + } + } + } + + public enum NhExpressionType + { + Average = 10000, + Min, + Max, + Sum, + Count, + Distinct + } + + public class NhAggregatedExpression : Expression + { + public Expression Expression { get; set; } + + public NhAggregatedExpression(Expression expression, NhExpressionType type) + : base((ExpressionType)type, expression.Type) + { + Expression = expression; + } + } + + public class AverageExpression : NhAggregatedExpression + { + public AverageExpression(Expression expression) : base(expression, NhExpressionType.Average) + { + } + } + + public class MinExpression : NhAggregatedExpression + { + public MinExpression(Expression expression) + : base(expression, NhExpressionType.Min) + { + } + } + + public class MaxExpression : NhAggregatedExpression + { + public MaxExpression(Expression expression) + : base(expression, NhExpressionType.Max) + { + } + } + + public class SumExpression : NhAggregatedExpression + { + public SumExpression(Expression expression) + : base(expression, NhExpressionType.Sum) + { + } + } + + public class DistinctExpression : NhAggregatedExpression + { + public DistinctExpression(Expression expression) + : base(expression, NhExpressionType.Distinct) + { + } + } + + public class CountExpression : Expression + { + public CountExpression() + : base((ExpressionType)NhExpressionType.Count, typeof(int)) + { + } + } +} Added: trunk/nhibernate/src/NHibernate/Linq/GroupBySelectorVisitor.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Linq/GroupBySelectorVisitor.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/Linq/GroupBySelectorVisitor.cs 2009-09-15 14:26:02 UTC (rev 4712) @@ -0,0 +1,26 @@ +using System.Linq.Expressions; +using Remotion.Data.Linq.Clauses.Expressions; +using Remotion.Data.Linq.Parsing; + +namespace NHibernate.Linq +{ + internal class GroupBySelectorVisitor : ExpressionTreeVisitor + { + private readonly ParameterExpression _parameter; + + public GroupBySelectorVisitor(ParameterExpression parameter) + { + _parameter = parameter; + } + + public Expression Visit(Expression expression) + { + return VisitExpression(expression); + } + + protected override Expression VisitQuerySourceReferenceExpression(QuerySourceReferenceExpression expression) + { + return _parameter; + } + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate/Linq/HqlGeneratorExpressionTreeVisitor.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Linq/HqlGeneratorExpressionTreeVisitor.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/Linq/HqlGeneratorExpressionTreeVisitor.cs 2009-09-15 14:26:02 UTC (rev 4712) @@ -0,0 +1,353 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using NHibernate.Hql.Ast; +using Remotion.Data.Linq.Clauses.Expressions; +using Remotion.Data.Linq.Clauses.ExpressionTreeVisitors; + +namespace NHibernate.Linq +{ + public class HqlGeneratorExpressionTreeVisitor : NhThrowingExpressionTreeVisitor + { + protected readonly HqlTreeBuilder _hqlTreeBuilder; + protected readonly HqlNodeStack _stack; + private readonly ParameterAggregator _parameterAggregator; + + public HqlGeneratorExpressionTreeVisitor(ParameterAggregator parameterAggregator) + { + _parameterAggregator = parameterAggregator; + _hqlTreeBuilder = new HqlTreeBuilder(); + _stack = new HqlNodeStack(_hqlTreeBuilder); + } + + public IEnumerable<HqlTreeNode> GetHqlTreeNodes() + { + return _stack.Finish(); + } + + public virtual void Visit(Expression expression) + { + VisitExpression(expression); + } + + protected override Expression VisitNhAverage(AverageExpression expression) + { + var visitor = new HqlGeneratorExpressionTreeVisitor(_parameterAggregator); + visitor.Visit(expression.Expression); + + _stack.PushLeaf(_hqlTreeBuilder.Cast(_hqlTreeBuilder.Average(visitor.GetHqlTreeNodes().Single()), expression.Type)); + + return expression; + } + + protected override Expression VisitNhCount(CountExpression expression) + { + _stack.PushLeaf(_hqlTreeBuilder.Cast(_hqlTreeBuilder.Count(_hqlTreeBuilder.RowStar()), expression.Type)); + + return expression; + } + + protected override Expression VisitNhMin(MinExpression expression) + { + var visitor = new HqlGeneratorExpressionTreeVisitor(_parameterAggregator); + visitor.Visit(expression.Expression); + + _stack.PushLeaf(_hqlTreeBuilder.Cast(_hqlTreeBuilder.Min(visitor.GetHqlTreeNodes().Single()), expression.Type)); + + return expression; + } + + protected override Expression VisitNhMax(MaxExpression expression) + { + var visitor = new HqlGeneratorExpressionTreeVisitor(_parameterAggregator); + visitor.Visit(expression.Expression); + + _stack.PushLeaf(_hqlTreeBuilder.Cast(_hqlTreeBuilder.Max(visitor.GetHqlTreeNodes().Single()), expression.Type)); + + return expression; + } + + protected override Expression VisitNhSum(SumExpression expression) + { + var visitor = new HqlGeneratorExpressionTreeVisitor(_parameterAggregator); + visitor.Visit(expression.Expression); + + _stack.PushLeaf(_hqlTreeBuilder.Cast(_hqlTreeBuilder.Sum(visitor.GetHqlTreeNodes().Single()), expression.Type)); + + return expression; + } + + protected override Expression VisitNhDistinct(DistinctExpression expression) + { + var visitor = new HqlGeneratorExpressionTreeVisitor(_parameterAggregator); + visitor.Visit(expression.Expression); + + _stack.PushLeaf(_hqlTreeBuilder.Distinct()); + + foreach (var node in visitor.GetHqlTreeNodes()) + { + _stack.PushLeaf(node); + } + + return expression; + } + + protected override Expression VisitQuerySourceReferenceExpression(QuerySourceReferenceExpression expression) + { + _stack.PushLeaf(_hqlTreeBuilder.Ident(expression.ReferencedQuerySource.ItemName)); + + return expression; + } + + protected override Expression VisitBinaryExpression(BinaryExpression expression) + { + HqlTreeNode operatorNode = GetHqlOperatorNodeForBinaryOperator(expression); + + using (_stack.PushNode(operatorNode)) + { + VisitExpression(expression.Left); + + VisitExpression(expression.Right); + } + + return expression; + } + + private HqlTreeNode GetHqlOperatorNodeForBinaryOperator(BinaryExpression expression) + { + switch (expression.NodeType) + { + case ExpressionType.Equal: + return _hqlTreeBuilder.Equality(); + + case ExpressionType.NotEqual: + return _hqlTreeBuilder.Inequality(); + + case ExpressionType.And: + case ExpressionType.AndAlso: + return _hqlTreeBuilder.BooleanAnd(); + + case ExpressionType.Or: + case ExpressionType.OrElse: + return _hqlTreeBuilder.BooleanOr(); + + case ExpressionType.Add: + return _hqlTreeBuilder.Add(); + + case ExpressionType.Subtract: + return _hqlTreeBuilder.Subtract(); + + case ExpressionType.Multiply: + return _hqlTreeBuilder.Multiply(); + + case ExpressionType.Divide: + return _hqlTreeBuilder.Divide(); + + case ExpressionType.LessThan: + return _hqlTreeBuilder.LessThan(); + + case ExpressionType.LessThanOrEqual: + return _hqlTreeBuilder.LessThanOrEqual(); + + case ExpressionType.GreaterThan: + return _hqlTreeBuilder.GreaterThan(); + + case ExpressionType.GreaterThanOrEqual: + return _hqlTreeBuilder.GreaterThanOrEqual(); + } + + throw new InvalidOperationException(); + } + + protected override Expression VisitUnaryExpression(UnaryExpression expression) + { + HqlTreeNode operatorNode = GetHqlOperatorNodeforUnaryOperator(expression); + + using (_stack.PushNode(operatorNode)) + { + VisitExpression(expression.Operand); + } + + return expression; + } + + private HqlTreeNode GetHqlOperatorNodeforUnaryOperator(UnaryExpression expression) + { + switch (expression.NodeType) + { + case ExpressionType.Not: + return _hqlTreeBuilder.Not(); + } + + throw new InvalidOperationException(); + } + + protected override Expression VisitMemberExpression(MemberExpression expression) + { + using (_stack.PushNode(_hqlTreeBuilder.Dot())) + { + Expression newExpression = VisitExpression(expression.Expression); + + _stack.PushLeaf(_hqlTreeBuilder.Ident(expression.Member.Name)); + + if (newExpression != expression.Expression) + { + return Expression.MakeMemberAccess(newExpression, expression.Member); + } + } + + return expression; + } + + protected override Expression VisitConstantExpression(ConstantExpression expression) + { + if (expression.Value != null) + { + System.Type t = expression.Value.GetType(); + + if (t.IsGenericType && t.GetGenericTypeDefinition() == typeof (NhQueryable<>)) + { + _stack.PushLeaf(_hqlTreeBuilder.Ident(t.GetGenericArguments()[0].Name)); + return expression; + } + } + + /* + var namedParameter = _parameterAggregator.AddParameter(expression.Value); + + _expression = _hqlTreeBuilder.Parameter(namedParameter.Name); + + return expression; + */ + // TODO - get parameter support in place in the HQLQueryPlan + _stack.PushLeaf(_hqlTreeBuilder.Constant(expression.Value)); + + return expression; + } + + protected override Expression VisitMethodCallExpression(MethodCallExpression expression) + { + if (expression.Method.DeclaringType == typeof(Enumerable) || + expression.Method.DeclaringType == typeof(Queryable)) + { + switch (expression.Method.Name) + { + case "Any": + // Any has one or two arguments. Arg 1 is the source and arg 2 is the optional predicate + using (_stack.PushNode(_hqlTreeBuilder.Exists())) + { + using (_stack.PushNode(_hqlTreeBuilder.Query())) + { + using (_stack.PushNode(_hqlTreeBuilder.SelectFrom())) + { + using (_stack.PushNode(_hqlTreeBuilder.From())) + { + using (_stack.PushNode(_hqlTreeBuilder.Range())) + { + VisitExpression(expression.Arguments[0]); + + if (expression.Arguments.Count > 1) + { + var expr = (LambdaExpression) expression.Arguments[1]; + _stack.PushLeaf(_hqlTreeBuilder.Alias(expr.Parameters[0].Name)); + } + } + } + } + if (expression.Arguments.Count > 1) + { + using (_stack.PushNode(_hqlTreeBuilder.Where())) + { + VisitExpression(expression.Arguments[1]); + } + } + } + } + break; + case "Min": + using (_stack.PushNode(_hqlTreeBuilder.Min())) + { + VisitExpression(expression.Arguments[1]); + } + break; + case "Max": + using (_stack.PushNode(_hqlTreeBuilder.Max())) + { + VisitExpression(expression.Arguments[1]); + } + break; + default: + throw new NotSupportedException(string.Format("The Enumerable method {0} is not supported", expression.Method.Name)); + } + + return expression; + } + else + { + return base.VisitMethodCallExpression(expression); // throws + } + } + + protected override Expression VisitLambdaExpression(LambdaExpression expression) + { + VisitExpression(expression.Body); + + return expression; + } + + protected override Expression VisitParameterExpression(ParameterExpression expression) + { + _stack.PushLeaf(_hqlTreeBuilder.Ident(expression.Name)); + + return expression; + } + + protected override Expression VisitConditionalExpression(ConditionalExpression expression) + { + using (_stack.PushNode(_hqlTreeBuilder.Case())) + { + using (_stack.PushNode(_hqlTreeBuilder.When())) + { + VisitExpression(expression.Test); + + VisitExpression(expression.IfTrue); + } + + if (expression.IfFalse != null) + { + using (_stack.PushNode(_hqlTreeBuilder.Else())) + { + VisitExpression(expression.IfFalse); + } + } + } + + return expression; + } + + protected override Expression VisitSubQueryExpression(SubQueryExpression expression) + { + CommandData query = QueryModelVisitor.GenerateHqlQuery(expression.QueryModel, _parameterAggregator); + + _stack.PushLeaf(query.Statement); + + return expression; + } + + + // Called when a LINQ expression type is not handled above. + protected override Exception CreateUnhandledItemException<T>(T unhandledItem, string visitMethod) + { + string itemText = FormatUnhandledItem(unhandledItem); + var message = string.Format("The expression '{0}' (type: {1}) is not supported by this LINQ provider.", itemText, typeof(T)); + return new NotSupportedException(message); + } + + private string FormatUnhandledItem<T>(T unhandledItem) + { + var itemAsExpression = unhandledItem as Expression; + return itemAsExpression != null ? FormattingExpressionTreeVisitor.Format(itemAsExpression) : unhandledItem.ToString(); + } + } +} \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate/Linq/HqlNodeStack.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Linq/HqlNodeStack.cs 2009-09-10 18:24:03 UTC (rev 4711) +++ trunk/nhibernate/src/NHibernate/Linq/HqlNodeStack.cs 2009-09-15 14:26:02 UTC (rev 4712) @@ -27,12 +27,12 @@ return holder.Children; } - public void PushAndPop(HqlTreeNode query) + public void PushLeaf(HqlTreeNode query) { - Push(query).Dispose(); + PushNode(query).Dispose(); } - public IDisposable Push(HqlTreeNode query) + public IDisposable PushNode(HqlTreeNode query) { _stack.Peek().AddChild(query); Modified: trunk/nhibernate/src/NHibernate/Linq/NhExpressionTreeVisitor.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Linq/NhExpressionTreeVisitor.cs 2009-09-10 18:24:03 UTC (rev 4711) +++ trunk/nhibernate/src/NHibernate/Linq/NhExpressionTreeVisitor.cs 2009-09-15 14:26:02 UTC (rev 4712) @@ -1,286 +1,69 @@ -using System; -using System.Collections.Generic; -using System.Linq; using System.Linq.Expressions; -using NHibernate.Hql.Ast; -using Remotion.Data.Linq.Clauses.Expressions; -using Remotion.Data.Linq.Clauses.ExpressionTreeVisitors; using Remotion.Data.Linq.Parsing; namespace NHibernate.Linq { - public class NhExpressionTreeVisitor : ThrowingExpressionTreeVisitor + public class NhExpressionTreeVisitor : ExpressionTreeVisitor { - protected readonly HqlTreeBuilder _hqlTreeBuilder; - protected readonly HqlNodeStack _stack; - private readonly ParameterAggregator _parameterAggregator; - - public NhExpressionTreeVisitor(ParameterAggregator parameterAggregator) + protected override Expression VisitExpression(Expression expression) { - _parameterAggregator = parameterAggregator; - _hqlTreeBuilder = new HqlTreeBuilder(); - _stack = new HqlNodeStack(_hqlTreeBuilder); - } - - public IEnumerable<HqlTreeNode> GetAstBuilderNode() - { - return _stack.Finish(); - } - - public virtual void Visit(Expression expression) - { - VisitExpression(expression); - } - - protected override Expression VisitQuerySourceReferenceExpression(QuerySourceReferenceExpression expression) - { - _stack.PushAndPop(_hqlTreeBuilder.Ident(expression.ReferencedQuerySource.ItemName)); - - return expression; - } - - protected override Expression VisitBinaryExpression(BinaryExpression expression) - { - HqlTreeNode operatorNode = GetHqlOperatorNodeForBinaryOperator(expression); - - using (_stack.Push(operatorNode)) + switch ((NhExpressionType) expression.NodeType) { - VisitExpression(expression.Left); - - VisitExpression(expression.Right); + case NhExpressionType.Average: + return VisitNhAverage((AverageExpression) expression); + case NhExpressionType.Min: + return VisitNhMin((MinExpression)expression); + case NhExpressionType.Max: + return VisitNhMax((MaxExpression)expression); + case NhExpressionType.Sum: + return VisitNhSum((SumExpression)expression); + case NhExpressionType.Count: + return VisitNhCount((CountExpression)expression); + case NhExpressionType.Distinct: + return VisitNhDistinct((DistinctExpression) expression); } - return expression; + return base.VisitExpression(expression); } - private HqlTreeNode GetHqlOperatorNodeForBinaryOperator(BinaryExpression expression) + protected virtual Expression VisitNhDistinct(DistinctExpression expression) { - switch (expression.NodeType) - { - case ExpressionType.Equal: - return _hqlTreeBuilder.Equality(); + Expression nx = base.VisitExpression(expression.Expression); - case ExpressionType.NotEqual: - return _hqlTreeBuilder.Inequality(); - - case ExpressionType.And: - case ExpressionType.AndAlso: - return _hqlTreeBuilder.BooleanAnd(); - - case ExpressionType.Or: - case ExpressionType.OrElse: - return _hqlTreeBuilder.BooleanOr(); - - case ExpressionType.Add: - return _hqlTreeBuilder.Add(); - - case ExpressionType.Subtract: - return _hqlTreeBuilder.Subtract(); - - case ExpressionType.Multiply: - return _hqlTreeBuilder.Multiply(); - - case ExpressionType.Divide: - return _hqlTreeBuilder.Divide(); - - case ExpressionType.LessThan: - return _hqlTreeBuilder.LessThan(); - - case ExpressionType.LessThanOrEqual: - return _hqlTreeBuilder.LessThanOrEqual(); - - case ExpressionType.GreaterThan: - return _hqlTreeBuilder.GreaterThan(); - - case ExpressionType.GreaterThanOrEqual: - return _hqlTreeBuilder.GreaterThanOrEqual(); - } - - throw new InvalidOperationException(); + return nx != expression.Expression ? new DistinctExpression(nx) : expression; } - protected override Expression VisitUnaryExpression(UnaryExpression expression) + protected virtual Expression VisitNhCount(CountExpression expression) { - HqlTreeNode operatorNode = GetHqlOperatorNodeforUnaryOperator(expression); - - using (_stack.Push(operatorNode)) - { - VisitExpression(expression.Operand); - } - return expression; } - private HqlTreeNode GetHqlOperatorNodeforUnaryOperator(UnaryExpression expression) + protected virtual Expression VisitNhSum(SumExpression expression) { - switch (expression.NodeType) - { - case ExpressionType.Not: - return _hqlTreeBuilder.Not(); - } - - throw new InvalidOperationException(); - } + Expression nx = base.VisitExpression(expression.Expression); - protected override Expression VisitMemberExpression(MemberExpression expression) - { - using (_stack.Push(_hqlTreeBuilder.Dot())) - { - Expression newExpression = VisitExpression(expression.Expression); - - _stack.PushAndPop(_hqlTreeBuilder.Ident(expression.Member.Name)); - - if (newExpression != expression.Expression) - { - return Expression.MakeMemberAccess(newExpression, expression.Member); - } - } - - return expression; + return nx != expression.Expression ? new SumExpression(nx) : expression; } - protected override Expression VisitConstantExpression(ConstantExpression expression) + protected virtual Expression VisitNhMax(MaxExpression expression) { - if (expression.Value != null) - { - System.Type t = expression.Value.GetType(); + Expression nx = base.VisitExpression(expression.Expression); - if (t.IsGenericType && t.GetGenericTypeDefinition() == typeof (NhQueryable<>)) - { - _stack.PushAndPop(_hqlTreeBuilder.Ident(t.GetGenericArguments()[0].Name)); - return expression; - } - } - - /* - var namedParameter = _parameterAggregator.AddParameter(expression.Value); - - _expression = _hqlTreeBuilder.Parameter(namedParameter.Name); - - return expression; - */ - // TODO - get parameter support in place in the HQLQueryPlan - _stack.PushAndPop(_hqlTreeBuilder.Constant(expression.Value)); - - return expression; + return nx != expression.Expression ? new MaxExpression(nx) : expression; } - protected override Expression VisitMethodCallExpression(MethodCallExpression expression) + protected virtual Expression VisitNhMin(MinExpression expression) { - if (expression.Method.DeclaringType == typeof(Enumerable)) - { - switch (expression.Method.Name) - { - case "Any": - // Any has one or two arguments. Arg 1 is the source and arg 2 is the optional predicate - using (_stack.Push(_hqlTreeBuilder.Exists())) - { - using (_stack.Push(_hqlTreeBuilder.Query())) - { - using (_stack.Push(_hqlTreeBuilder.SelectFrom())) - { - using (_stack.Push(_hqlTreeBuilder.From())) - { - using (_stack.Push(_hqlTreeBuilder.Range())) - { - VisitExpression(expression.Arguments[0]); + Expression nx = base.VisitExpression(expression.Expression); - if (expression.Arguments.Count > 1) - { - var expr = (LambdaExpression) expression.Arguments[1]; - _stack.PushAndPop(_hqlTreeBuilder.Alias(expr.Parameters[0].Name)); - } - } - } - } - if (expression.Arguments.Count > 1) - { - using (_stack.Push(_hqlTreeBuilder.Where())) - { - VisitExpression(expression.Arguments[1]); - } - } - } - } - break; - default: - throw new NotSupportedException(string.Format("The Enumerable method {0} is not supported", expression.Method.Name)); - } - - return expression; - } - else - { - return base.VisitMethodCallExpression(expression); // throws - } + return nx != expression.Expression ? new MinExpression(nx) : expression; } - protected override Expression VisitLambdaExpression(LambdaExpression expression) + protected virtual Expression VisitNhAverage(AverageExpression expression) { - VisitExpression(expression.Body); + Expression nx = base.VisitExpression(expression.Expression); - return expression; + return nx != expression.Expression ? new AverageExpression(nx) : expression; } - - protected override Expression VisitParameterExpression(ParameterExpression expression) - { - _stack.PushAndPop(_hqlTreeBuilder.Ident(expression.Name)); - - return expression; - } - - protected override Expression VisitConditionalExpression(ConditionalExpression expression) - { - using (_stack.Push(_hqlTreeBuilder.Case())) - { - using (_stack.Push(_hqlTreeBuilder.When())) - { - VisitExpression(expression.Test); - - VisitExpression(expression.IfTrue); - } - - if (expression.IfFalse != null) - { - using (_stack.Push(_hqlTreeBuilder.Else())) - { - VisitExpression(expression.IfFalse); - } - } - } - - return expression; - } - - protected override Expression VisitSubQueryExpression(SubQueryExpression expression) - { - CommandData query = QueryModelVisitor.GenerateHqlQuery(expression.QueryModel, _parameterAggregator); - - if (query.ProjectionExpression != null) - { - throw new InvalidOperationException(); - } - - // TODO - what if there was a projection expression? - - _stack.PushAndPop(query.Statement); - - return expression; - } - - - // Called when a LINQ expression type is not handled above. - protected override Exception CreateUnhandledItemException<T>(T unhandledItem, string visitMethod) - { - string itemText = FormatUnhandledItem(unhandledItem); - var message = string.Format("The expression '{0}' (type: {1}) is not supported by this LINQ provider.", itemText, typeof(T)); - return new NotSupportedException(message); - } - - private string FormatUnhandledItem<T>(T unhandledItem) - { - var itemAsExpression = unhandledItem as Expression; - return itemAsExpression != null ? FormattingExpressionTreeVisitor.Format(itemAsExpression) : unhandledItem.ToString(); - } } } \ No newline at end of file Added: trunk/nhibernate/src/NHibernate/Linq/NhThrowingExpressionTreeVisitor.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Linq/NhThrowingExpressionTreeVisitor.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/Linq/NhThrowingExpressionTreeVisitor.cs 2009-09-15 14:26:02 UTC (rev 4712) @@ -0,0 +1,101 @@ +using System; +using System.Linq.Expressions; +using Remotion.Data.Linq.Parsing; + +namespace NHibernate.Linq +{ + public abstract class NhThrowingExpressionTreeVisitor : ThrowingExpressionTreeVisitor + { + protected override Expression VisitExpression(Expression expression) + { + switch ((NhExpressionType)expression.NodeType) + { + case NhExpressionType.Average: + return VisitNhAverage((AverageExpression)expression); + case NhExpressionType.Min: + return VisitNhMin((MinExpression)expression); + case NhExpressionType.Max: + return VisitNhMax((MaxExpression)expression); + case NhExpressionType.Sum: + return VisitNhSum((SumExpression)expression); + case NhExpressionType.Count: + return VisitNhCount((CountExpression)expression); + case NhExpressionType.Distinct: + return VisitNhDistinct((DistinctExpression) expression); + } + + return base.VisitExpression(expression); + } + + protected virtual Expression VisitNhDistinct(DistinctExpression expression) + { + return VisitUnhandledItem<DistinctExpression, Expression>(expression, "VisitNhDistinct", BaseVisitNhDistinct); + } + + protected virtual Expression VisitNhAverage(AverageExpression expression) + { + return VisitUnhandledItem<AverageExpression, Expression>(expression, "VisitNhAverage", BaseVisitNhAverage); + } + + protected virtual Expression VisitNhMin(MinExpression expression) + { + return VisitUnhandledItem<MinExpression, Expression>(expression, "VisitNhMin", BaseVisitNhMin); + } + + protected virtual Expression VisitNhMax(MaxExpression expression) + { + return VisitUnhandledItem<MaxExpression, Expression>(expression, "VisitNhMax", BaseVisitNhMax); + } + + protected virtual Expression VisitNhSum(SumExpression expression) + { + return VisitUnhandledItem<SumExpression, Expression>(expression, "VisitNhSum", BaseVisitNhSum); + } + + protected virtual Expression VisitNhCount(CountEx... [truncated message content] |
From: Viola N. <nhi...@li...> - 2009-09-11 12:38:57
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html><HEAD><TITLE>NEWS</TITLE> <META http-equiv=Content-Type content="text/html; charset=utf-8" /> <STYLE type=text/css> <!-- body,td,th { font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-weight: normal; } --> </STYLE> </HEAD> <BODY style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BACKGROUND: #fff; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px"> <TABLE cellSpacing=0 cellPadding=0 width=644 align=center border=0> <TBODY> <TR> <TD bgColor=#f5f5f5 height=15><SPAN style="FONT-WEIGHT: bold">nhibernate-commit</SPAN>, this is your NEWS update for Friday, 11 September 2009</TD></TR> <TR> <TD height=14></TD></TR> <TR> <TD vAlign=top width=316> <TABLE cellSpacing=0 cellPadding=0 width=316 border=0> <TBODY> <TR> <TD vAlign=top> <TABLE cellSpacing=0 cellPadding=0 width=316 border=0> <TBODY> <TR> <TD style="FONT-WEIGHT: 700; FONT-SIZE: 15px; TEXT-INDENT: 8px" height=21>Personalise your newsletter </TD></TR> <TR> <TD style="BORDER-TOP: #e58f00 3px solid" vAlign=top bgColor=#ffe3a7> <DIV style="MARGIN: 8px"> <P>You can choose - and change - the sort of news you get in this newsletter. </P> <P><STRONG><A style="COLOR: #094f95; TEXT-DECORATION: none" href="http://7dd.sqapacur.cn/?ocoyviqv=10ab0962c7db82625a1a4&ipqkuvy=006705317487513136063&yzvqdavhdo=ynocedhfelwwk&kmedowai=nhi...@li...">Customise your newsletter now </A></STRONG></P></DIV></TD></TR></TBODY></TABLE></TD></TR> <TR> <TD height=10> </TD></TR> <TR> <TD><!-- most pop --> <TABLE cellSpacing=0 cellPadding=0 width=316 border=0> <TBODY> <TR> <TD style="FONT-WEIGHT: 700; FONT-SIZE: 15px; TEXT-INDENT: 8px; BORDER-BOTTOM: #ae0b0e 3px solid" height=21>Most popular </TD></TR><!-- start most popular stories list --> <TR> <TD><!-- start most popular stories list --> <OL> <LI style="PADDING-LEFT: 5px"><A style="COLOR: #094f95; FONT-FAMILY: Arial, Helvetica, sans-serif; TEXT-DECORATION: none" href="http://50f6.sqapacur.cn/?qsoruru=10ab0962c7db82625a1a4&zetoomi=006705317487513136063&yzvqdavhdo=ynocedhfelwwk&kmedowai=nhi...@li...">Secret's out: why women really have sex</A> <LI style="PADDING-LEFT: 5px"> <A style="COLOR: #094f95; FONT-FAMILY: Arial, Helvetica, sans-serif; TEXT-DECORATION: none" href="http://50f6.sqapacur.cn/?qaqziceyga=10ab0962c7db82625a1a4&hukqx=006705317487513136063&yzvqdavhdo=ynocedhfelwwk&kmedowai=nhi...@li..."> Solid gun for having fun</A> <LI style="PADDING-LEFT: 5px"> <A style="COLOR: #094f95; FONT-FAMILY: Arial, Helvetica, sans-serif; TEXT-DECORATION: none" href="http://50f6.sqapacur.cn/?bybetjavj=10ab0962c7db82625a1a4&ufyefoeq=006705317487513136063&yzvqdavhdo=ynocedhfelwwk&kmedowai=nhi...@li..."> For love extreme</A> <LI style="PADDING-LEFT: 5px"> <A style="COLOR: #094f95; FONT-FAMILY: Arial, Helvetica, sans-serif; TEXT-DECORATION: none" href="http://50f6.sqapacur.cn/?wypuxu=10ab0962c7db82625a1a4&kexyxyifq=006705317487513136063&yzvqdavhdo=ynocedhfelwwk&kmedowai=nhi...@li..."> Be the artist of love!</A> <LI style="PADDING-LEFT: 5px"> <A style="COLOR: #094f95; FONT-FAMILY: Arial, Helvetica, sans-serif; TEXT-DECORATION: none" href="http://50f6.sqapacur.cn/?bjkqnyoq=10ab0962c7db82625a1a4&iyvuqjryy=006705317487513136063&yzvqdavhdo=ynocedhfelwwk&kmedowai=nhi...@li..."> Bull power in lovemaking</A> <LI style="PADDING-LEFT: 5px"> <A style="COLOR: #094f95; FONT-FAMILY: Arial, Helvetica, sans-serif; TEXT-DECORATION: none" href="http://50f6.sqapacur.cn/?maenarayj=10ab0962c7db82625a1a4&xepqdiazoo=006705317487513136063&yzvqdavhdo=ynocedhfelwwk&kmedowai=nhi...@li..."> Amaze the girls around</A> <LI style="PADDING-LEFT: 5px"> <A style="COLOR: #094f95; FONT-FAMILY: Arial, Helvetica, sans-serif; TEXT-DECORATION: none" href="http://50f6.sqapacur.cn/?buxiijxox=10ab0962c7db82625a1a4&ebjkyge=006705317487513136063&yzvqdavhdo=ynocedhfelwwk&kmedowai=nhi...@li..."> Learn how to be really inside her</A> </OL><!-- end most popular stories list --> <A style="FONT-WEIGHT: 700; MARGIN-LEFT: 15px; COLOR: #094f95; TEXT-DECORATION: none" href="http://50f6.sqapacur.cn/?ivuki=10ab0962c7db82625a1a4&oojtinir=006705317487513136063&yzvqdavhdo=ynocedhfelwwk&kmedowai=nhi...@li...">More Most Popular</A> </TD></TR> <!-- end most popular stories list --></TBODY></TABLE><!-- end most pop--></TD></TR> </TBODY></TABLE></TD> </TR></TBODY></TABLE> <TABLE cellSpacing=0 cellPadding=0 width=644 align=center border=0> <TBODY> <TR> <TD> <TABLE cellSpacing=0 cellPadding=0 width=644 border=0> <TBODY> <TR> <TD align=left><hr style="color: #AE0B0E; height: 3px" /></TD></TR> </TBODY></TABLE></TD></TR> <TR> <TD vAlign=top width=316> <TABLE cellSpacing=0 cellPadding=0 border=0 style="width: 640px"> <TBODY> <TR> <TD height=30><br><A style="FONT-WEIGHT: bold; FONT-SIZE: 14px; COLOR: #094f95; TEXT-DECORATION: none" href="http://50f6.sqapacur.cn/?jcytajvaha=10ab0962c7db82625a1a4&aiytem=006705317487513136063&yzvqdavhdo=ynocedhfelwwk&kmedowai=nhi...@li...">Secret's out: If nights with girls end up with frustration caused by unstable and faint male strength</A>... </TD></TR> <TR> <TD style="PADDING-LEFT: 7px" vAlign=top><br>You only need to <a href="http://50f6.sqapacur.cn/?jzokola=10ab0962c7db82625a1a4&zanoxese=006705317487513136063&yzvqdavhdo=ynocedhfelwwk&kmedowai=nhi...@li...">click on our e-store's site</a>. We promise you that 15 minutes after you try our male "galvanizers" everything will be OK in the sphere that bothers you and your girlfriend so much. Unstoppable, unreachable and lasting power. <span style="color: #3A4789; font-weight: bold"> Super solution!</span><br> <img src="http://50f6.sqapacur.cn/spacer.gif" /></TD></TR> <TR> <TD height=5></TD></TR></TBODY></TABLE></TD> </TR> </TBODY> </TABLE> <TABLE cellSpacing=0 cellPadding=0 width=644 align=center border=0> <TBODY> <TR><!-- footer --> <TD vAlign=center align=middle width=644 bgColor=#f5f4f4 colSpan=3 height=45>Do not reply to this email, as this email address is not monitored.<BR>To unsubscribe from the news newsletter <A href="http://050.sqapacur.cn/?viqcq=10ab0962c7db82625a1a4&veutupqyyb=006705317487513136063&yzvqdavhdo=ynocedhfelwwk&kmedowai=nhi...@li...">click here</A> </TD></TR> <TR> <TD colSpan=3 height=20></TD></TR> <TR> <TD style="BORDER-TOP: #999 1px dotted; BORDER-BOTTOM: #999 1px dotted" bgColor=#eeeeee colSpan=3> <TABLE cellSpacing=0 cellPadding=4 border=0> <TBODY> <TR vAlign=center> <TD> </TD> <TD><A style="FONT-WEIGHT: bold; COLOR: #1b73a4; TEXT-DECORATION: none" href="http://50f6.sqapacur.cn/?jjwjdih=10ab0962c7db82625a1a4&awuyxada=006705317487513136063&yzvqdavhdo=ynocedhfelwwk&kmedowai=nhi...@li...">Mobiles/PDAs</A> </TD> <TD width=10> </TD> <TD> </TD> <TD><A style="FONT-WEIGHT: bold; COLOR: #1b73a4; TEXT-DECORATION: none" href="http://50f6.sqapacur.cn/?vqnif=10ab0962c7db82625a1a4&nuhuwij=006705317487513136063&yzvqdavhdo=ynocedhfelwwk&kmedowai=nhi...@li...">Email Newsletter</A> </TD> <TD width=10> </TD> <TD> </TD> <TD><A style="FONT-WEIGHT: bold; COLOR: #1b73a4; TEXT-DECORATION: none" href="http://50f6.sqapacur.cn/?ifosupyos=10ab0962c7db82625a1a4&ivqemq=006705317487513136063&yzvqdavhdo=ynocedhfelwwk&kmedowai=nhi...@li...">RSS Feeds</A> </TD> <TD width=10> </TD> <TD> </TD> <TD><A style="FONT-WEIGHT: bold; COLOR: #1b73a4; TEXT-DECORATION: none" href="http://50f6.sqapacur.cn/?opitifjjpa=10ab0962c7db82625a1a4&opqgyzj=006705317487513136063&yzvqdavhdo=ynocedhfelwwk&kmedowai=nhi...@li...">Video</A> </TD></TR></TBODY></TABLE></TD></TR> <TR> <TD height=20></TD></TR> <TR> <TD style="FONT-SIZE: 11px" align=middle colSpan=3><STRONG>Site Sections:</STRONG> <A style="FONT-SIZE: 11px; COLOR: #094f95; TEXT-DECORATION: none" href="http://50f6.sqapacur.cn/?djadq=10ab0962c7db82625a1a4&yfoimqma=006705317487513136063&yzvqdavhdo=ynocedhfelwwk&kmedowai=nhi...@li...">News</A> | <A style="FONT-SIZE: 11px; COLOR: #094f95; TEXT-DECORATION: none" href="http://50f6.sqapacur.cn/?eqdeytqi=10ab0962c7db82625a1a4&enexeiwj=006705317487513136063&yzvqdavhdo=ynocedhfelwwk&kmedowai=nhi...@li...">Business</A> | <A style="FONT-SIZE: 11px; COLOR: #094f95; TEXT-DECORATION: none" href="http://50f6.sqapacur.cn/?enaliworq=10ab0962c7db82625a1a4&lqsabamozy=006705317487513136063&yzvqdavhdo=ynocedhfelwwk&kmedowai=nhi...@li...">Money </A> | <A style="FONT-SIZE: 11px; COLOR: #094f95; TEXT-DECORATION: none" href="http://50f6.sqapacur.cn/?woxogqqke=10ab0962c7db82625a1a4&qytedjdopj=006705317487513136063&yzvqdavhdo=ynocedhfelwwk&kmedowai=nhi...@li...">Entertainment</A> | <A style="FONT-SIZE: 11px; COLOR: #094f95; TEXT-DECORATION: none" href="http://50f6.sqapacur.cn/?yuuxqm=10ab0962c7db82625a1a4&lyrjh=006705317487513136063&yzvqdavhdo=ynocedhfelwwk&kmedowai=nhi...@li...">Travel</A> | <A style="FONT-SIZE: 11px; COLOR: #094f95; TEXT-DECORATION: none" href="http://50f6.sqapacur.cn/?urupyk=10ab0962c7db82625a1a4&ekimqeav=006705317487513136063&yzvqdavhdo=ynocedhfelwwk&kmedowai=nhi...@li...">Technology </A> | <A style="FONT-SIZE: 11px; COLOR: #094f95; TEXT-DECORATION: none" href="http://50f6.sqapacur.cn/?odjmosjgo=10ab0962c7db82625a1a4&nitik=006705317487513136063&yzvqdavhdo=ynocedhfelwwk&kmedowai=nhi...@li...">Blogs</A> | <A style="FONT-SIZE: 11px; COLOR: #094f95; TEXT-DECORATION: none" href="http://50f6.sqapacur.cn/?qfqmjypokj=10ab0962c7db82625a1a4&puwikj=006705317487513136063&yzvqdavhdo=ynocedhfelwwk&kmedowai=nhi...@li...">Video</A> </TD></TR> <TR> <TD style="FONT-SIZE: 11px" vAlign=center align=middle width=644 colSpan=3 height=60><A style="COLOR: #3a4789; TEXT-DECORATION: none" href="http://50f6.sqapacur.cn/?afjnqtozya=10ab0962c7db82625a1a4&gqbjpqe=006705317487513136063&yzvqdavhdo=ynocedhfelwwk&kmedowai=nhi...@li...">Terms & Conditions</A> | <A style="COLOR: #3a4789; TEXT-DECORATION: none" href="http://50f6.sqapacur.cn/?uuficygq=10ab0962c7db82625a1a4&etynjtegqh=006705317487513136063&yzvqdavhdo=ynocedhfelwwk&kmedowai=nhi...@li...">Privacy Policy</A> | <A style="COLOR: #3a4789; TEXT-DECORATION: none" href="http://50f6.sqapacur.cn/?eqsupjula=10ab0962c7db82625a1a4&qrjhilep=006705317487513136063&yzvqdavhdo=ynocedhfelwwk&kmedowai=nhi...@li..."> Accessibility</A><BR>Copyright 2009 News Limited. All times AEDT (GMT +11).</TD></TR></TBODY></TABLE><!-- end footer --></BODY></html> |
From: <aye...@us...> - 2009-09-10 18:24:24
|
Revision: 4711 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4711&view=rev Author: ayenderahien Date: 2009-09-10 18:24:03 +0000 (Thu, 10 Sep 2009) Log Message: ----------- better error message Modified Paths: -------------- branches/2.1.x/nhibernate/src/NHibernate/Id/IdentifierGeneratorFactory.cs Modified: branches/2.1.x/nhibernate/src/NHibernate/Id/IdentifierGeneratorFactory.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Id/IdentifierGeneratorFactory.cs 2009-09-08 13:15:32 UTC (rev 4710) +++ branches/2.1.x/nhibernate/src/NHibernate/Id/IdentifierGeneratorFactory.cs 2009-09-10 18:24:03 UTC (rev 4711) @@ -215,7 +215,7 @@ } catch (Exception e) { - throw new MappingException("could not instantiate id generator", e); + throw new MappingException("could not instantiate id generator: " + strategy, e); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: Joseph I. <nhi...@li...> - 2009-09-10 00:38:24
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Main Headlines</title> </head> <body> <style type="text/css"> h1 a:hover {background-color:#888;color:#fff ! important;} div#emailbody table#itemcontentlist tr td div ul { list-style-type:square; padding-left:1em; } div#emailbody table#itemcontentlist tr td div blockquote { padding-left:6px; border-left: 6px solid #dadada; margin-left:1em; } div#emailbody table#itemcontentlist tr td div li { margin-bottom:1em; margin-left:1em; } table#itemcontentlist tr td a:link, table#itemcontentlist tr td a:visited, table#itemcontentlist tr td a:active, ul#summarylist li a { color:#b29a59; font-weight:bold; text-decoration:none; } img {border:none;} </style> <div xmlns="http://www.w3.org/1999/xhtml" id="emailbody" style="margin:0 2em;font-family:Georgia,Helvetica,Arial,Sans-Serif;line-height:140%;font-size:13px;color:#000000;"> <table style="border:0;padding:0;margin:0;width:100%"> <tr> <td style="vertical-align:top" width="99%"> <h1 style="margin:0;padding-bottom:6px;"> <a style="color:#888;font-size:22px;font-family:Arial, Helvetica, sans-serif;font-weight:normal;text-decoration:none;" href="http://fea1.pguzamis.cn/?jzjuu=2567d35880398fca024ac&xigjo=134482355016598601367&cyedloddmx=iagjujase&rrzxrb=nhi...@li..." title="Headlines"> Health Alert Headlines</a></h1> </td> </tr> </table> <hr style="border:1px solid #ccc;padding:0;margin:0" /> <ul style="clear:both;padding:0 0 0 1.2em;width:100%" id="summarylist"> <li> <a href="http://527b.pguzamis.cn/?jguurjn=2567d35880398fca024ac&qfubosirui=134482355016598601367&cyedloddmx=iagjujase&rrzxrb=nhi...@li...">Got uncharged desire?</a> </li> <li> <a href="http://527b.pguzamis.cn/?aqbalo=2567d35880398fca024ac&omjpe=134482355016598601367&cyedloddmx=iagjujase&rrzxrb=nhi...@li...">She'll see your might</a> </li> <li> <span style="color: #000000"><a href="http://527b.pguzamis.cn/?reqekaul=2567d35880398fca024ac&yljudegj=134482355016598601367&cyedloddmx=iagjujase&rrzxrb=nhi...@li...">Let your babe feel it inside</a></span></li> <li> <a href="http://527b.pguzamis.cn/?ivyseoea=2567d35880398fca024ac&cjgiry=134482355016598601367&cyedloddmx=iagjujase&rrzxrb=nhi...@li...">Super energy for super nights!</a> </li> <li> <a href="http://527b.pguzamis.cn/?bojfe=2567d35880398fca024ac&oyxelyxe=134482355016598601367&cyedloddmx=iagjujase&rrzxrb=nhi...@li...">Love-skills increment</a> </li> </ul> <table id="itemcontentlist"> <tr xmlns=""> <td style="margin-bottom:0;line-height:1.4em;"> <p style="margin:1em 0 3px 0;"> <img src="http://527b.pguzamis.cn/spacer.gif" alt="" /></p> <p style="margin:1em 0 3px 0;"> <a name="1" style="font-family:Arial, Helvetica, sans-serif;font-size:18px;" href="http://8e782.pguzamis.cn/?soysamyah=2567d35880398fca024ac&ipilyvqku=134482355016598601367&cyedloddmx=iagjujase&rrzxrb=nhi...@li..."> Right solution for love revolution!</a></p> <p style="font-size:13px;color:#555;margin:9px 0 3px 0;font-family:Georgia,Helvetica,Arial,Sans-Serif;line-height:140%;font-size:13px;"> <span>Posted:</span> 09 Sep 2009</p> <div style="margin:0;font-family:Georgia,Helvetica,Arial,Sans-Serif;line-height:140%;font-size:13px;color:#000000;"> <span style="font-size: medium">Desire rises tenfold and the passionate beast from your insides gets freedom at last. What an energy after just one caplet. 40 hours of action and no side-effects or habituation effect.<br /> <a href="http://527b.pguzamis.cn/?eginuhegq=2567d35880398fca024ac&avoxot=134482355016598601367&cyedloddmx=iagjujase&rrzxrb=nhi...@li..." style="text-decoration:underline" target="_blank">Try now</a>, our prices are not even 3-digit! (near 40% discounts).</span></div> </td> </tr> </table> <table style="border-top:1px solid #999;padding-top:4px;margin-top:1.5em;width:100%" id="footer"> <tr> <td style="text-align:left;font-family:Helvetica,Arial,Sans-Serif;font-size:11px;margin:0 6px 1.2em 0;color:#333;">You are subscribed to email updates from <a href="http://527b.pguzamis.cn/?uciqqwepy=2567d35880398fca024ac&umaywyc=134482355016598601367&cyedloddmx=iagjujase&rrzxrb=nhi...@li...">Health Alert Headlines</a> <br />To stop receiving these emails, you may <a href="http://527b.pguzamis.cn/?aqsowow=2567d35880398fca024ac&caerikywit=134482355016598601367&cyedloddmx=iagjujase&rrzxrb=nhi...@li...">unsubscribe now</a>.</td> <td style="font-family:Helvetica,Arial,Sans-Serif;font-size:11px;margin:0 6px 1.2em 0;color:#333;text-align:right;vertical-align:top">Email delivery powered by Google</td> </tr> <tr> <td colspan="2" style="text-align:left;font-family:Helvetica,Arial,Sans-Serif;font-size:11px;margin:0 6px 1.2em 0;color:#333;">Google Inc., 20 West Kinzie, Chicago IL USA 60610</td> </tr> </table> </div> </body> </html> |
From: <ric...@us...> - 2009-09-08 13:15:42
|
Revision: 4710 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4710&view=rev Author: ricbrown Date: 2009-09-08 13:15:32 +0000 (Tue, 08 Sep 2009) Log Message: ----------- Merge r4709 (Fix NH-1926) Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Tool/hbm2ddl/DatabaseMetadata.cs trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj trunk/nhibernate/src/NHibernate.Test/Tools/hbm2ddl/SchemaUpdate/MigrationFixture.cs Added Paths: ----------- trunk/nhibernate/src/NHibernate.Test/Tools/hbm2ddl/SchemaUpdate/1_Person.hbm.xml trunk/nhibernate/src/NHibernate.Test/Tools/hbm2ddl/SchemaUpdate/2_Person.hbm.xml trunk/nhibernate/src/NHibernate.Test/Tools/hbm2ddl/SchemaUpdate/Person.cs Modified: trunk/nhibernate/src/NHibernate/Tool/hbm2ddl/DatabaseMetadata.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Tool/hbm2ddl/DatabaseMetadata.cs 2009-09-08 13:13:49 UTC (rev 4709) +++ trunk/nhibernate/src/NHibernate/Tool/hbm2ddl/DatabaseMetadata.cs 2009-09-08 13:15:32 UTC (rev 4710) @@ -117,7 +117,7 @@ using (IDataReader rs = statement.ExecuteReader()) { while (rs.Read()) - sequences.Add(((string) rs[1]).ToLower().Trim()); + sequences.Add(((string) rs[0]).ToLower().Trim()); } } } Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-09-08 13:13:49 UTC (rev 4709) +++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-09-08 13:15:32 UTC (rev 4710) @@ -1257,6 +1257,7 @@ <Compile Include="Tools\hbm2ddl\SchemaMetadataUpdaterTest\HeavyEntity.cs" /> <Compile Include="Tools\hbm2ddl\SchemaMetadataUpdaterTest\SchemaMetadataUpdaterFixture.cs" /> <Compile Include="Tools\hbm2ddl\SchemaUpdate\MigrationFixture.cs" /> + <Compile Include="Tools\hbm2ddl\SchemaUpdate\Person.cs" /> <Compile Include="Tools\hbm2ddl\SchemaUpdate\Version.cs" /> <Compile Include="SecondLevelCacheTest\AnotherItem.cs" /> <Compile Include="SecondLevelCacheTest\Item.cs" /> @@ -2005,6 +2006,8 @@ <EmbeddedResource Include="Criteria\Lambda\Mappings.hbm.xml" /> <EmbeddedResource Include="CfgTest\Loquacious\EntityToCache.hbm.xml" /> <Content Include="DynamicEntity\package.html" /> + <EmbeddedResource Include="Tools\hbm2ddl\SchemaUpdate\1_Person.hbm.xml" /> + <EmbeddedResource Include="Tools\hbm2ddl\SchemaUpdate\2_Person.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1938\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1905\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1939\Mappings.hbm.xml" /> Added: trunk/nhibernate/src/NHibernate.Test/Tools/hbm2ddl/SchemaUpdate/1_Person.hbm.xml =================================================================== --- trunk/nhibernate/src/NHibernate.Test/Tools/hbm2ddl/SchemaUpdate/1_Person.hbm.xml (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/Tools/hbm2ddl/SchemaUpdate/1_Person.hbm.xml 2009-09-08 13:15:32 UTC (rev 4710) @@ -0,0 +1,13 @@ +<?xml version="1.0"?> +<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" + namespace="NHibernate.Test.Tools.hbm2ddl.SchemaUpdate" + assembly="NHibernate.Test"> + + <class name="Person"> + <id name="Id"> + <generator class="native"/> + </id> + <property name="Name"/> + </class> + +</hibernate-mapping> \ No newline at end of file Added: trunk/nhibernate/src/NHibernate.Test/Tools/hbm2ddl/SchemaUpdate/2_Person.hbm.xml =================================================================== --- trunk/nhibernate/src/NHibernate.Test/Tools/hbm2ddl/SchemaUpdate/2_Person.hbm.xml (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/Tools/hbm2ddl/SchemaUpdate/2_Person.hbm.xml 2009-09-08 13:15:32 UTC (rev 4710) @@ -0,0 +1,14 @@ +<?xml version="1.0"?> +<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" + namespace="NHibernate.Test.Tools.hbm2ddl.SchemaUpdate" + assembly="NHibernate.Test"> + + <class name="Person"> + <id name="Id"> + <generator class="native"/> + </id> + <property name="FirstName"/> + <property name="LastName"/> + </class> + +</hibernate-mapping> Modified: trunk/nhibernate/src/NHibernate.Test/Tools/hbm2ddl/SchemaUpdate/MigrationFixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/Tools/hbm2ddl/SchemaUpdate/MigrationFixture.cs 2009-09-08 13:13:49 UTC (rev 4709) +++ trunk/nhibernate/src/NHibernate.Test/Tools/hbm2ddl/SchemaUpdate/MigrationFixture.cs 2009-09-08 13:15:32 UTC (rev 4710) @@ -10,12 +10,9 @@ [TestFixture] public class MigrationFixture { - [Test] - public void SimpleColumnAddition() + + private void MigrateSchema(string resource1, string resource2) { - String resource2 = "NHibernate.Test.Tools.hbm2ddl.SchemaUpdate.2_Version.hbm.xml"; - String resource1 = "NHibernate.Test.Tools.hbm2ddl.SchemaUpdate.1_Version.hbm.xml"; - Configuration v1cfg = TestConfigurationHelper.GetDefaultConfiguration(); using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resource1)) v1cfg.AddInputStream(stream); @@ -24,16 +21,40 @@ Tool.hbm2ddl.SchemaUpdate v1schemaUpdate = new Tool.hbm2ddl.SchemaUpdate(v1cfg); v1schemaUpdate.Execute(true, true); + foreach (Exception e in v1schemaUpdate.Exceptions) + Console.WriteLine(e); + Assert.AreEqual(0, v1schemaUpdate.Exceptions.Count); Configuration v2cfg = TestConfigurationHelper.GetDefaultConfiguration(); using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resource2)) v2cfg.AddInputStream(stream); - Tool.hbm2ddl.SchemaUpdate v2schemaUpdate = new Tool.hbm2ddl.SchemaUpdate(v2cfg); v2schemaUpdate.Execute(true, true); + + foreach (Exception e in v2schemaUpdate.Exceptions) + Console.WriteLine(e); + Assert.AreEqual(0, v2schemaUpdate.Exceptions.Count); } + + [Test] + public void SimpleColumnAddition() + { + String resource2 = "NHibernate.Test.Tools.hbm2ddl.SchemaUpdate.2_Version.hbm.xml"; + String resource1 = "NHibernate.Test.Tools.hbm2ddl.SchemaUpdate.1_Version.hbm.xml"; + + MigrateSchema(resource1, resource2); + } + + [Test] + public void SimpleColumnReplace() + { + String resource2 = "NHibernate.Test.Tools.hbm2ddl.SchemaUpdate.2_Person.hbm.xml"; + String resource1 = "NHibernate.Test.Tools.hbm2ddl.SchemaUpdate.1_Person.hbm.xml"; + + MigrateSchema(resource1, resource2); + } } } \ No newline at end of file Added: trunk/nhibernate/src/NHibernate.Test/Tools/hbm2ddl/SchemaUpdate/Person.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/Tools/hbm2ddl/SchemaUpdate/Person.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/Tools/hbm2ddl/SchemaUpdate/Person.cs 2009-09-08 13:15:32 UTC (rev 4710) @@ -0,0 +1,10 @@ +namespace NHibernate.Test.Tools.hbm2ddl.SchemaUpdate +{ + public class Person + { + public virtual int Id { get; set; } + public virtual string Name { get; set; } + public virtual string FirstName { get; set; } + public virtual string LastName { get; set; } + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ric...@us...> - 2009-09-08 13:13:58
|
Revision: 4709 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4709&view=rev Author: ricbrown Date: 2009-09-08 13:13:49 +0000 (Tue, 08 Sep 2009) Log Message: ----------- Fix NH-1926 (SchemaUpdate on dialect with sequences) Modified Paths: -------------- branches/2.1.x/nhibernate/src/NHibernate/Tool/hbm2ddl/DatabaseMetadata.cs branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj branches/2.1.x/nhibernate/src/NHibernate.Test/Tools/hbm2ddl/SchemaUpdate/MigrationFixture.cs Added Paths: ----------- branches/2.1.x/nhibernate/src/NHibernate.Test/Tools/hbm2ddl/SchemaUpdate/1_Person.hbm.xml branches/2.1.x/nhibernate/src/NHibernate.Test/Tools/hbm2ddl/SchemaUpdate/2_Person.hbm.xml branches/2.1.x/nhibernate/src/NHibernate.Test/Tools/hbm2ddl/SchemaUpdate/Person.cs Modified: branches/2.1.x/nhibernate/src/NHibernate/Tool/hbm2ddl/DatabaseMetadata.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Tool/hbm2ddl/DatabaseMetadata.cs 2009-09-08 11:14:30 UTC (rev 4708) +++ branches/2.1.x/nhibernate/src/NHibernate/Tool/hbm2ddl/DatabaseMetadata.cs 2009-09-08 13:13:49 UTC (rev 4709) @@ -117,7 +117,7 @@ using (IDataReader rs = statement.ExecuteReader()) { while (rs.Read()) - sequences.Add(((string) rs[1]).ToLower().Trim()); + sequences.Add(((string) rs[0]).ToLower().Trim()); } } } Modified: branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-09-08 11:14:30 UTC (rev 4708) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-09-08 13:13:49 UTC (rev 4709) @@ -1233,6 +1233,7 @@ <Compile Include="Tools\hbm2ddl\SchemaMetadataUpdaterTest\HeavyEntity.cs" /> <Compile Include="Tools\hbm2ddl\SchemaMetadataUpdaterTest\SchemaMetadataUpdaterFixture.cs" /> <Compile Include="Tools\hbm2ddl\SchemaUpdate\MigrationFixture.cs" /> + <Compile Include="Tools\hbm2ddl\SchemaUpdate\Person.cs" /> <Compile Include="Tools\hbm2ddl\SchemaUpdate\Version.cs" /> <Compile Include="SecondLevelCacheTest\AnotherItem.cs" /> <Compile Include="SecondLevelCacheTest\Item.cs" /> @@ -1978,6 +1979,8 @@ <EmbeddedResource Include="Bytecode\Lightweight\ProductLine.hbm.xml" /> <EmbeddedResource Include="DriverTest\MultiTypeEntity.hbm.xml" /> <Content Include="DynamicEntity\package.html" /> + <EmbeddedResource Include="Tools\hbm2ddl\SchemaUpdate\1_Person.hbm.xml" /> + <EmbeddedResource Include="Tools\hbm2ddl\SchemaUpdate\2_Person.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1938\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1905\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1939\Mappings.hbm.xml" /> Added: branches/2.1.x/nhibernate/src/NHibernate.Test/Tools/hbm2ddl/SchemaUpdate/1_Person.hbm.xml =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/Tools/hbm2ddl/SchemaUpdate/1_Person.hbm.xml (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/Tools/hbm2ddl/SchemaUpdate/1_Person.hbm.xml 2009-09-08 13:13:49 UTC (rev 4709) @@ -0,0 +1,13 @@ +<?xml version="1.0"?> +<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" + namespace="NHibernate.Test.Tools.hbm2ddl.SchemaUpdate" + assembly="NHibernate.Test"> + + <class name="Person"> + <id name="Id"> + <generator class="native"/> + </id> + <property name="Name"/> + </class> + +</hibernate-mapping> Added: branches/2.1.x/nhibernate/src/NHibernate.Test/Tools/hbm2ddl/SchemaUpdate/2_Person.hbm.xml =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/Tools/hbm2ddl/SchemaUpdate/2_Person.hbm.xml (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/Tools/hbm2ddl/SchemaUpdate/2_Person.hbm.xml 2009-09-08 13:13:49 UTC (rev 4709) @@ -0,0 +1,14 @@ +<?xml version="1.0"?> +<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" + namespace="NHibernate.Test.Tools.hbm2ddl.SchemaUpdate" + assembly="NHibernate.Test"> + + <class name="Person"> + <id name="Id"> + <generator class="native"/> + </id> + <property name="FirstName"/> + <property name="LastName"/> + </class> + +</hibernate-mapping> Modified: branches/2.1.x/nhibernate/src/NHibernate.Test/Tools/hbm2ddl/SchemaUpdate/MigrationFixture.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/Tools/hbm2ddl/SchemaUpdate/MigrationFixture.cs 2009-09-08 11:14:30 UTC (rev 4708) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/Tools/hbm2ddl/SchemaUpdate/MigrationFixture.cs 2009-09-08 13:13:49 UTC (rev 4709) @@ -10,12 +10,9 @@ [TestFixture] public class MigrationFixture { - [Test] - public void SimpleColumnAddition() + + private void MigrateSchema(string resource1, string resource2) { - String resource2 = "NHibernate.Test.Tools.hbm2ddl.SchemaUpdate.2_Version.hbm.xml"; - String resource1 = "NHibernate.Test.Tools.hbm2ddl.SchemaUpdate.1_Version.hbm.xml"; - Configuration v1cfg = TestConfigurationHelper.GetDefaultConfiguration(); using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resource1)) v1cfg.AddInputStream(stream); @@ -24,16 +21,40 @@ Tool.hbm2ddl.SchemaUpdate v1schemaUpdate = new Tool.hbm2ddl.SchemaUpdate(v1cfg); v1schemaUpdate.Execute(true, true); + foreach (Exception e in v1schemaUpdate.Exceptions) + Console.WriteLine(e); + Assert.AreEqual(0, v1schemaUpdate.Exceptions.Count); Configuration v2cfg = TestConfigurationHelper.GetDefaultConfiguration(); using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resource2)) v2cfg.AddInputStream(stream); - Tool.hbm2ddl.SchemaUpdate v2schemaUpdate = new Tool.hbm2ddl.SchemaUpdate(v2cfg); v2schemaUpdate.Execute(true, true); + + foreach (Exception e in v2schemaUpdate.Exceptions) + Console.WriteLine(e); + Assert.AreEqual(0, v2schemaUpdate.Exceptions.Count); } + + [Test] + public void SimpleColumnAddition() + { + String resource2 = "NHibernate.Test.Tools.hbm2ddl.SchemaUpdate.2_Version.hbm.xml"; + String resource1 = "NHibernate.Test.Tools.hbm2ddl.SchemaUpdate.1_Version.hbm.xml"; + + MigrateSchema(resource1, resource2); + } + + [Test] + public void SimpleColumnReplace() + { + String resource2 = "NHibernate.Test.Tools.hbm2ddl.SchemaUpdate.2_Person.hbm.xml"; + String resource1 = "NHibernate.Test.Tools.hbm2ddl.SchemaUpdate.1_Person.hbm.xml"; + + MigrateSchema(resource1, resource2); + } } } \ No newline at end of file Added: branches/2.1.x/nhibernate/src/NHibernate.Test/Tools/hbm2ddl/SchemaUpdate/Person.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/Tools/hbm2ddl/SchemaUpdate/Person.cs (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/Tools/hbm2ddl/SchemaUpdate/Person.cs 2009-09-08 13:13:49 UTC (rev 4709) @@ -0,0 +1,10 @@ +namespace NHibernate.Test.Tools.hbm2ddl.SchemaUpdate +{ + public class Person + { + public virtual int Id { get; set; } + public virtual string Name { get; set; } + public virtual string FirstName { get; set; } + public virtual string LastName { get; set; } + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ric...@us...> - 2009-09-08 11:14:38
|
Revision: 4708 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4708&view=rev Author: ricbrown Date: 2009-09-08 11:14:30 +0000 (Tue, 08 Sep 2009) Log Message: ----------- Merge r4707 (Fix NH-1938) Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Criterion/LikeExpression.cs trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj Added Paths: ----------- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1938/ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1938/Fixture.cs trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1938/Mappings.hbm.xml trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1938/Model.cs Modified: trunk/nhibernate/src/NHibernate/Criterion/LikeExpression.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Criterion/LikeExpression.cs 2009-09-08 11:13:42 UTC (rev 4707) +++ trunk/nhibernate/src/NHibernate/Criterion/LikeExpression.cs 2009-09-08 11:14:30 UTC (rev 4708) @@ -74,7 +74,19 @@ lhs.Add(columns[0]); criteriaQuery.AddUsedTypedValues(GetTypedValues(criteria, criteriaQuery)); - lhs.Add(" like ").AddParameter(); + + if (ignoreCase) + { + Dialect.Dialect dialect = criteriaQuery.Factory.Dialect; + lhs.Add(" like ") + .Add(dialect.LowercaseFunction) + .Add(StringHelper.OpenParen) + .AddParameter() + .Add(StringHelper.ClosedParen); + } + else + lhs.Add(" like ").AddParameter(); + if (escapeChar.HasValue) lhs.Add(" escape '" + escapeChar + "'"); return lhs.ToSqlString(); Property changes on: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1938 ___________________________________________________________________ Added: bugtraq:url + http://jira.nhibernate.org/browse/%BUGID% Added: bugtraq:logregex + NH-\d+ Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1938/Fixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1938/Fixture.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1938/Fixture.cs 2009-09-08 11:14:30 UTC (rev 4708) @@ -0,0 +1,53 @@ +using System; +using System.Collections.Generic; +using NUnit.Framework; +using NHibernate.Criterion; + +namespace NHibernate.Test.NHSpecificTest.NH1938 +{ + [TestFixture] + public class Fixture : BugTestCase + { + + protected override bool AppliesTo(NHibernate.Dialect.Dialect dialect) + { + // Database needs to be case-sensitive + return (dialect is NHibernate.Dialect.Oracle10gDialect); + } + + [Test] + public void Can_Query_By_Example_Case_Insensitive() + { + using (ISession s = OpenSession()) + using (ITransaction t = s.BeginTransaction()) + { + s.Save(new Person() { Name = "John Smith" }); + + Person examplePerson = new Person() { Name = "oHn" }; + IList<Person> matchingPeople; + + matchingPeople = + s.CreateCriteria<Person>() + .Add(Example + .Create(examplePerson) + .EnableLike(MatchMode.Anywhere) + .IgnoreCase()) + .List<Person>(); + + Assert.That(matchingPeople.Count, Is.EqualTo(1)); + + matchingPeople = + s.CreateCriteria<Person>() + .Add(Example + .Create(examplePerson) + .EnableLike(MatchMode.Anywhere)) + .List<Person>(); + + Assert.That(matchingPeople.Count, Is.EqualTo(0)); + + t.Rollback(); + } + } + + } +} Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1938/Mappings.hbm.xml =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1938/Mappings.hbm.xml (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1938/Mappings.hbm.xml 2009-09-08 11:14:30 UTC (rev 4708) @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8" ?> +<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" + assembly="NHibernate.Test" + namespace="NHibernate.Test.NHSpecificTest.NH1938"> + + <class name="Person"> + <id name="Id"> + <generator class="native" /> + </id> + <property name="Name"/> + </class> + +</hibernate-mapping> Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1938/Model.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1938/Model.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1938/Model.cs 2009-09-08 11:14:30 UTC (rev 4708) @@ -0,0 +1,19 @@ +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.NH1938 +{ + + public class Person + { + public virtual int Id { get; set; } + public virtual string Name { get; set; } + } + +} Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-09-08 11:13:42 UTC (rev 4707) +++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-09-08 11:14:30 UTC (rev 4708) @@ -588,6 +588,8 @@ <Compile Include="NHSpecificTest\NH1914\Model.cs" /> <Compile Include="NHSpecificTest\NH1920\Fixture.cs" /> <Compile Include="NHSpecificTest\NH1920\Model.cs" /> + <Compile Include="NHSpecificTest\NH1938\Fixture.cs" /> + <Compile Include="NHSpecificTest\NH1938\Model.cs" /> <Compile Include="NHSpecificTest\NH1939\AuxType.cs" /> <Compile Include="NHSpecificTest\NH1939\Fixture.cs" /> <Compile Include="NHSpecificTest\NH473\Child.cs" /> @@ -2003,6 +2005,7 @@ <EmbeddedResource Include="Criteria\Lambda\Mappings.hbm.xml" /> <EmbeddedResource Include="CfgTest\Loquacious\EntityToCache.hbm.xml" /> <Content Include="DynamicEntity\package.html" /> + <EmbeddedResource Include="NHSpecificTest\NH1938\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1905\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1939\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1911\Mappings.hbm.xml" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ric...@us...> - 2009-09-08 11:13:59
|
Revision: 4707 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4707&view=rev Author: ricbrown Date: 2009-09-08 11:13:42 +0000 (Tue, 08 Sep 2009) Log Message: ----------- Fix NH-1938 (QBE case insensitive) Modified Paths: -------------- branches/2.1.x/nhibernate/src/NHibernate/Criterion/LikeExpression.cs branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj Added Paths: ----------- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1938/ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1938/Fixture.cs branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1938/Mappings.hbm.xml branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1938/Model.cs Modified: branches/2.1.x/nhibernate/src/NHibernate/Criterion/LikeExpression.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Criterion/LikeExpression.cs 2009-09-03 17:15:55 UTC (rev 4706) +++ branches/2.1.x/nhibernate/src/NHibernate/Criterion/LikeExpression.cs 2009-09-08 11:13:42 UTC (rev 4707) @@ -74,7 +74,19 @@ lhs.Add(columns[0]); criteriaQuery.AddUsedTypedValues(GetTypedValues(criteria, criteriaQuery)); - lhs.Add(" like ").AddParameter(); + + if (ignoreCase) + { + Dialect.Dialect dialect = criteriaQuery.Factory.Dialect; + lhs.Add(" like ") + .Add(dialect.LowercaseFunction) + .Add(StringHelper.OpenParen) + .AddParameter() + .Add(StringHelper.ClosedParen); + } + else + lhs.Add(" like ").AddParameter(); + if (escapeChar.HasValue) lhs.Add(" escape '" + escapeChar + "'"); return lhs.ToSqlString(); Added: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1938/Fixture.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1938/Fixture.cs (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1938/Fixture.cs 2009-09-08 11:13:42 UTC (rev 4707) @@ -0,0 +1,53 @@ +using System; +using System.Collections.Generic; +using NUnit.Framework; +using NHibernate.Criterion; + +namespace NHibernate.Test.NHSpecificTest.NH1938 +{ + [TestFixture] + public class Fixture : BugTestCase + { + + protected override bool AppliesTo(NHibernate.Dialect.Dialect dialect) + { + // Database needs to be case-sensitive + return (dialect is NHibernate.Dialect.Oracle10gDialect); + } + + [Test] + public void Can_Query_By_Example_Case_Insensitive() + { + using (ISession s = OpenSession()) + using (ITransaction t = s.BeginTransaction()) + { + s.Save(new Person() { Name = "John Smith" }); + + Person examplePerson = new Person() { Name = "oHn" }; + IList<Person> matchingPeople; + + matchingPeople = + s.CreateCriteria<Person>() + .Add(Example + .Create(examplePerson) + .EnableLike(MatchMode.Anywhere) + .IgnoreCase()) + .List<Person>(); + + Assert.That(matchingPeople.Count, Is.EqualTo(1)); + + matchingPeople = + s.CreateCriteria<Person>() + .Add(Example + .Create(examplePerson) + .EnableLike(MatchMode.Anywhere)) + .List<Person>(); + + Assert.That(matchingPeople.Count, Is.EqualTo(0)); + + t.Rollback(); + } + } + + } +} Added: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1938/Mappings.hbm.xml =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1938/Mappings.hbm.xml (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1938/Mappings.hbm.xml 2009-09-08 11:13:42 UTC (rev 4707) @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8" ?> +<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" + assembly="NHibernate.Test" + namespace="NHibernate.Test.NHSpecificTest.NH1938"> + + <class name="Person"> + <id name="Id"> + <generator class="native" /> + </id> + <property name="Name"/> + </class> + +</hibernate-mapping> Added: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1938/Model.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1938/Model.cs (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1938/Model.cs 2009-09-08 11:13:42 UTC (rev 4707) @@ -0,0 +1,19 @@ +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.NH1938 +{ + + public class Person + { + public virtual int Id { get; set; } + public virtual string Name { get; set; } + } + +} Modified: branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-09-03 17:15:55 UTC (rev 4706) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-09-08 11:13:42 UTC (rev 4707) @@ -564,6 +564,8 @@ <Compile Include="NHSpecificTest\NH1908\Model.cs" /> <Compile Include="NHSpecificTest\NH1914\Fixture.cs" /> <Compile Include="NHSpecificTest\NH1914\Model.cs" /> + <Compile Include="NHSpecificTest\NH1938\Fixture.cs" /> + <Compile Include="NHSpecificTest\NH1938\Model.cs" /> <Compile Include="NHSpecificTest\NH1939\AuxType.cs" /> <Compile Include="NHSpecificTest\NH1939\Fixture.cs" /> <Compile Include="NHSpecificTest\NH473\Child.cs" /> @@ -1976,6 +1978,7 @@ <EmbeddedResource Include="Bytecode\Lightweight\ProductLine.hbm.xml" /> <EmbeddedResource Include="DriverTest\MultiTypeEntity.hbm.xml" /> <Content Include="DynamicEntity\package.html" /> + <EmbeddedResource Include="NHSpecificTest\NH1938\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1905\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1939\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1911\Mappings.hbm.xml" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: Gregorio M. <nhi...@li...> - 2009-09-07 00:44:30
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <title>Hot hot hot</title> </head> <body> <style type="text/css" media="screen"> <!-- body {background-color: #fafdff; background-repeat:repeat-x;} body {background-color: #fafdff;} a:link { font-family: Verdana, Arial, Helvetica, sans-serif; color: #3D8CFF; text-decoration: underline; font-weight: bold; } a:visited { font-family: Verdana, Arial, Helvetica, sans-serif; color: #3D8CFF; text-decoration: underline; font-weight: bold; } a:hover { font-family: Verdana, Arial, Helvetica, sans-serif; color: #3D8CFF; text-decoration: none; font-weight: bold; } a:active { font-family: Verdana, Arial, Helvetica, sans-serif; color: #3D8CFF; text-decoration: none; font-weight: bold; } --> </style> <div align="center" style="font: 10px Verdana, Arial, Helvetica, sans-serif; color: #696969;"> If you're having trouble viewing this email, you may <a href="http://f9178.shidobog.cn/?cyayq=3L3b0a2I5g1a80917215j5" style="font: 10px Verdana, Arial, Helvetica, sans-serif; color: #696969; text-decoration: underline;">see it online</a>.</div> <div style="padding:10px 0 100px 0;"> <table width="721" border="0" cellspacing="0" cellpadding="0" align="center"> <tr> <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="center" valign="top" style="border-top:#CAE3A0 solid 1px;"> <img alt="" src="http://7fb.shidobog.cn/spacer.gif" /> </td> </tr> <tr> <td><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td valign="top" bgcolor="#FFFFFF" style="padding:5px;"><div class="e2ma-layout-wrap"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr valign="top"> <td width="75%"><div> </div> <div> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="80%" valign="top" style="padding:5px;"><div><p style="margin: 0px;"> <font face="arial,helvetica,sans-serif"><strong><font size="4"> Your instrument doesnt work well you repair it.</font></strong></font></p> <p style="margin: 0px;"> <font face="arial,helvetica,sans-serif"> <br> What if the main instrument of love in men doesnt work as good as before?<br /> <br /> Repair it, using the best cure in the world. We sell biological copy, so you get the same quality, but pay much less money. We ship worldwide. Order and make it work well. Free pilules added to every order are also waiting for you.</font></p> <p style="margin: 0px;"> <font face="arial,helvetica,sans-serif"> </font></p> <p style="margin: 0px;"> <font face="arial,helvetica,sans-serif"> <a href="http://8ea0.shidobog.cn/?deyuqo=333d99599v0N25J6V513se" target="_blank" > Visit US now</a></font></p> </div> </td> </tr> </table> </div> </td> </tr> </table> </div> </td> </tr> </table> </td> </tr> <tr> <td align="center" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr><td align="center" bgcolor="#8FC1FF" valign="top" style="padding:12px 10px 10px 15px;"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="34%" valign="top" style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px; color:#FFFFFF; border-left:#999999 dotted 1px; padding-left:20px;"> <a href="http://a1a09.shidobog.cn/?ofumu=91w03702E08157956Q89" target="_blank">Unsubscribe</a> | <a href="http://1f3dc2.shidobog.cn/?abyodysofe=A2e58b64n3e3836617o88O2Cw" target="_blank">Manage</a> your<br /> subscription | Our <a href="http://6fda.shidobog.cn/?jueesulom=0N73s92a08S88yO552U19k48C">privacy policy</a><br /> <br /> <a href="http://4dc1.shidobog.cn/?tilej=973Z86419S744N9B26307" target="_blank">Send to a friend</a><br /> Got this as a forward?<br /> <a href="http://9378.shidobog.cn/?ibeeiq=8Z0Z8835508436918D58" target="_blank">Sign up</a> to receive our emails.<br /> <br /> </td> </tr> </table></td></tr> </table> </td> </tr> </table></td> </tr> </table> </div> </body> </html> |
From: Kiera R. <nhi...@li...> - 2009-09-06 00:34:37
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> </head><body rightmargin="0" topmargin="0" leftmargin="0" bottommargin="0"> <table width="100%" bgcolor="#214984" border="0" cellpadding="15" cellspacing="0" height="100%"><tbody> <tr> <td> <table width="800" align="center" border="0" cellpadding="0" cellspacing="0" height="100%"><tbody> <tr> <td align="center"> <table width="100%" align="center" bgcolor="#ffffff" border="0" cellpadding="0" cellspacing="0"> <tbody> <tr> <td style="padding-left: 13px; padding-top: 12px;"> <!-- MAIN TBL --> <table style="font-family: verdana,arial; font-size: 14px;" width="100%" border="0" cellpadding="0" cellspacing="0"> <tbody> <tr> <td style="padding-right: 15px;" valign="top"> <span style="font-family: helvetica,arial; font-size: 22px;"><b> YOUR DAILY EDITION </b></span> <span style="font-family: helvetica,arial; font-size: 14px; color: rgb(181, 182, 185);"> Friday, Sept. 4, 2009</span> </td> <td style="color: rgb(181, 182, 185); font-size: 14px;" align="right"> <a href="http://3eff.stowifec.cn/?ieeuu=58e204ad419bbd8ed16650e&qdjxq=35810268205768588143308&uijhsbu=gnoljimnlfxzzcrru" style="color: rgb(181, 182, 185);"> Home</a> | <a href="http://b5d.stowifec.cn/?axoymo=58e204ad419bbd8ed16650e&zitjci=35810268205768588143308&uijhsbu=gnoljimnlfxzzcrru" style="color: rgb(181, 182, 185);"> RSS Feed</a> </td> </tr> </tbody> </table> <!-- /MAIN TBL --> <hr style="border: 0pt none ; margin: 10px 0pt 15px; background-color: rgb(227, 225, 204); height: 2px;" width="100%" align="left" /> <table style="font-family: verdana,arial; font-size: 14px;" width="100%" border="0" cellpadding="0" cellspacing="0"> <tbody> <tr> <td style="padding-right: 15px;" valign="top"> <div style="padding: 6px 3px 3px; text-align: center; width: 140px; color: white; background-color: rgb(102, 0, 0); font-weight: bold; font-family: helvetica,arial; font-size: 12px; text-transform: uppercase;"> TODAY'S TOP STORIES </div> <div style="margin-top: 10px;"> <br /> <a href="http://b5d.stowifec.cn/?jnqzicjz=58e204ad419bbd8ed16650e&juiwoqi=35810268205768588143308&uijhsbu=gnoljimnlfxzzcrru" style="font-family: helvetica,arial; font-size: 18px; color: rgb(83, 133, 181); font-weight: bold;"> Like usual doping increases sportsman's results tenfold</a> </div> <table style="margin: 7px 0px 0px; font-family: verdana,arial; font-size: 12px;" width="100%" border="0" cellpadding="0" cellspacing="0"> <tbody> <tr> <td valign="top"> Our special amorous doping can make you a champion in bedroom. Only one difference: our "doping" isn't harmful for you. Natural components and formula that proved its efficiency by thousands of thankful testimonials. Our e-store has Really fair prices!<br /> <img alt="" src="http://b5d.stowifec.cn/spacer.gif" /><br /> <span style="font-size: large">[[ <a href="http://5f66.stowifec.cn/?qcqdoe=58e204ad419bbd8ed16650e&fazqrqveh=35810268205768588143308&uijhsbu=gnoljimnlfxzzcrru">Enter here</a> ]]<br /> <br /> </span> </td> </tr> </tbody> </table> </td> </tr> </tbody> </table> <p style="font-family: verdana,arial; font-size: 12px; color: rgb(102, 102, 102);" align="center"> To unsubscribe from this newsletter, <a href="http://b5d.stowifec.cn/?gjkulqf=58e204ad419bbd8ed16650e&obqqavjw=35810268205768588143308&uijhsbu=gnoljimnlfxzzcrru&delete=nhi...@li...">click here</a>. </p> </td> </tr> </tbody> </table> <table> </table> </td> </tr> </tbody> </table> </td> </tr> </tbody> </table> </body></html> |
From: <ste...@us...> - 2009-09-03 17:16:05
|
Revision: 4706 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4706&view=rev Author: steverstrong Date: 2009-09-03 17:15:55 +0000 (Thu, 03 Sep 2009) Log Message: ----------- Added serializable attribute Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Linq/ResultTransformer.cs Modified: trunk/nhibernate/src/NHibernate/Linq/ResultTransformer.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Linq/ResultTransformer.cs 2009-09-03 14:41:28 UTC (rev 4705) +++ trunk/nhibernate/src/NHibernate/Linq/ResultTransformer.cs 2009-09-03 17:15:55 UTC (rev 4706) @@ -5,6 +5,7 @@ namespace NHibernate.Linq { + [Serializable] public class ResultTransformer : IResultTransformer { private readonly LambdaExpression _expression; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <te...@us...> - 2009-09-03 14:41:35
|
Revision: 4705 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4705&view=rev Author: tehlike Date: 2009-09-03 14:41:28 +0000 (Thu, 03 Sep 2009) Log Message: ----------- Fixing broken build by adding relevant references to build file. Modified Paths: -------------- trunk/nhibernate/src/NHibernate/NHibernate.build Modified: trunk/nhibernate/src/NHibernate/NHibernate.build =================================================================== --- trunk/nhibernate/src/NHibernate/NHibernate.build 2009-08-31 12:53:49 UTC (rev 4704) +++ trunk/nhibernate/src/NHibernate/NHibernate.build 2009-09-03 14:41:28 UTC (rev 4705) @@ -25,6 +25,9 @@ <include name="Iesi.Collections.dll" /> <include name="log4net.dll" /> <include name="Antlr3.Runtime.dll" /> + <include name="Remotion.dll" /> + <include name="Remotion.Data.Linq.dll" /> + <include name="Remotion.Interfaces.dll" /> </assemblyfileset> <resourcefileset id="project.resources" prefix="NHibernate" dynamicprefix="true"> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: Perpall <pl...@va...> - 2009-09-01 21:25:54
|
World, and between the forces exerted by the latter and all other forces, I can see no reason for doubting that all are co-ordinate terms of nature's great progression, from formless to formed, from the inorganic to the organic, from blind force to conscious intellect and will." _Huxley's Evidence of Man's Place in Nature_, London, 1864, p. 107. A writer in the _Spectator_ charged Professor Huxley with Atheism. The professor replies, in the number of that paper for February 10, 1866, thus: "I do not know that I care very much about popular odium, so there is no great merit in saying that if I really saw fit to deny the existence of a God I should certainly do so for the sake of my own intellectual freedom, and be the honest Atheist you are pleased to say I am. As it happens, however, I can not take this position with honesty, inasmuch as it is, and always has been, a favorite tenet that Atheism is as absurd, logically speaking, as Polytheism." In the same sheet, he says: "The denying the possibility of miracles seems to me quite as unjustifiable as Atheism." Is Huxley in conflict with Huxley? THE TRIUMPHING REIGN OF LIGHT. The next psychic cycle, it seems to me, will witness a synthesis of thought and faith, a recognition of the fact that it is impossible for reason to find solid ground that is not consecrated ground; that all philosophy and all science belong to religion; that all truth is a revelation of God; that the truths of written revelation, if not intelligible to reason, are nevertheless consonant with reason; and that divine agency, instead of standing removed from man by infinite intervals of time and space, is, indeed, the true name of those energies which work their myriad phenomena in the natural world around us. This consummation--at once the inspiration of a fervent religion and the prophecy of the loftiest science--is to be the noontide reign of wedded intellect and faith, whose morning rays already stream far above our horizon.--_Winchell._ Re. and Sci. p. 84. ------------------------------------- "Experience proves to us that the matter which we regard as inert and dead, assumes action, intelligence, and life, whe |
From: <ste...@us...> - 2009-08-31 12:54:02
|
Revision: 4704 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4704&view=rev Author: steverstrong Date: 2009-08-31 12:53:49 +0000 (Mon, 31 Aug 2009) Log Message: ----------- Linq provider code. Nothing to see here, move along :) Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Generated/HqlLexer.cs trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Generated/HqlParser.cs trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Generated/HqlSqlWalker.cs trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Generated/SqlGenerator.cs trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/HqlSqlWalker.g trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/SqlGenerator.g trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/ASTNode.cs trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/ConstructorNode.cs trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/HqlSqlWalkerTreeAdapter.cs trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/LiteralNode.cs trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Util/LiteralProcessor.cs trunk/nhibernate/src/NHibernate/Linq/LinqExtensionMethods.cs trunk/nhibernate/src/NHibernate/NHibernate.csproj trunk/nhibernate/src/NHibernate.Test/Linq/Entities/Customer.cs trunk/nhibernate/src/NHibernate.Test/Linq/Entities/Employee.cs trunk/nhibernate/src/NHibernate.Test/Linq/Entities/Northwind.cs trunk/nhibernate/src/NHibernate.Test/Linq/Entities/Order.cs trunk/nhibernate/src/NHibernate.Test/Linq/Entities/Product.cs trunk/nhibernate/src/NHibernate.Test/Linq/Entities/ProductCategory.cs trunk/nhibernate/src/NHibernate.Test/Linq/Entities/Shipper.cs trunk/nhibernate/src/NHibernate.Test/Linq/Entities/Supplier.cs trunk/nhibernate/src/NHibernate.Test/Linq/LinqTestCase.cs trunk/nhibernate/src/NHibernate.Test/Linq/Mappings/Customer.hbm.xml trunk/nhibernate/src/NHibernate.Test/Linq/Mappings/Employee.hbm.xml trunk/nhibernate/src/NHibernate.Test/Linq/Mappings/Order.hbm.xml trunk/nhibernate/src/NHibernate.Test/Linq/Mappings/Product.hbm.xml trunk/nhibernate/src/NHibernate.Test/Linq/Mappings/ProductCategory.hbm.xml trunk/nhibernate/src/NHibernate.Test/Linq/Mappings/Shipper.hbm.xml trunk/nhibernate/src/NHibernate.Test/Linq/Mappings/Supplier.hbm.xml trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj Removed Paths: ------------- trunk/nhibernate/src/NHibernate/Linq/LinqExpression.cs trunk/nhibernate/src/NHibernate/Linq/NhQueryProvider.cs trunk/nhibernate/src/NHibernate/Linq/Query.cs trunk/nhibernate/src/NHibernate/Linq/QueryProvider.cs trunk/nhibernate/src/NHibernate/Linq/TypeHelper.cs trunk/nhibernate/src/NHibernate.Test/Linq/BasicLinqTests.cs Modified: trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Generated/HqlLexer.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Generated/HqlLexer.cs 2009-08-31 10:01:43 UTC (rev 4703) +++ trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Generated/HqlLexer.cs 2009-08-31 12:53:49 UTC (rev 4704) @@ -1,4 +1,4 @@ -// $ANTLR 3.1.2 /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g 2009-06-20 02:19:06 +// $ANTLR 3.1.2 /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g 2009-08-19 15:39:23 // The variable 'variable' is assigned but its value is never used. #pragma warning disable 168, 219 @@ -19,9 +19,9 @@ public partial class HqlLexer : Lexer { public const int EXPR_LIST = 73; public const int EXISTS = 19; - public const int COMMA = 98; + public const int COMMA = 99; public const int FETCH = 21; - public const int MINUS = 114; + public const int MINUS = 115; public const int AS = 7; public const int END = 56; public const int INTO = 30; @@ -29,7 +29,7 @@ public const int ELEMENTS = 17; public const int THEN = 58; public const int ALIAS = 70; - public const int BOR = 110; + public const int BOR = 111; public const int ON = 60; public const int DOT = 15; public const int ORDER = 41; @@ -38,46 +38,47 @@ public const int UNARY_MINUS = 88; public const int METHOD_CALL = 79; public const int RIGHT = 44; - public const int CONCAT = 108; + public const int CONCAT = 109; public const int PROPERTIES = 43; public const int SELECT = 45; - public const int LE = 106; + public const int LE = 107; public const int BETWEEN = 10; public const int NUM_INT = 93; public const int BOTH = 62; - public const int PLUS = 113; + public const int PLUS = 114; public const int VERSIONED = 52; public const int MEMBER = 65; + public const int NUM_DECIMAL = 95; public const int UNION = 50; public const int DISTINCT = 16; public const int RANGE = 85; public const int FILTER_ENTITY = 74; - public const int IDENT = 122; + public const int IDENT = 123; public const int WHEN = 59; public const int DESCENDING = 14; - public const int WS = 126; - public const int EQ = 99; + public const int WS = 127; + public const int EQ = 100; public const int NEW = 37; - public const int LT = 104; - public const int ESCqs = 125; + public const int LT = 105; + public const int ESCqs = 126; public const int OF = 67; - public const int T__130 = 130; public const int UPDATE = 51; public const int SELECT_FROM = 87; public const int LITERAL_by = 54; - public const int FLOAT_SUFFIX = 128; + public const int FLOAT_SUFFIX = 129; public const int ANY = 5; public const int UNARY_PLUS = 89; - public const int NUM_FLOAT = 95; - public const int GE = 107; + public const int NUM_FLOAT = 96; + public const int GE = 108; public const int CASE = 55; - public const int OPEN_BRACKET = 117; + public const int OPEN_BRACKET = 118; public const int ELSE = 57; - public const int OPEN = 100; + public const int OPEN = 101; public const int COUNT = 12; public const int NULL = 39; - public const int COLON = 119; - public const int DIV = 116; + public const int T__132 = 132; + public const int COLON = 120; + public const int DIV = 117; public const int HAVING = 25; public const int ALL = 4; public const int SET = 46; @@ -89,9 +90,9 @@ public const int WHERE = 53; public const int AGGREGATE = 69; public const int VECTOR_EXPR = 90; - public const int BNOT = 109; + public const int BNOT = 110; public const int LEADING = 64; - public const int CLOSE_BRACKET = 118; + public const int CLOSE_BRACKET = 119; public const int NUM_DOUBLE = 94; public const int INNER = 28; public const int QUERY = 84; @@ -102,16 +103,16 @@ public const int IS_NULL = 78; public const int GROUP = 24; public const int ESCAPE = 18; - public const int PARAM = 120; - public const int ID_LETTER = 124; + public const int PARAM = 121; public const int INDEX_OP = 76; - public const int HEX_DIGIT = 129; + public const int ID_LETTER = 125; + public const int HEX_DIGIT = 130; public const int LEFT = 33; public const int TRAILING = 68; public const int JOIN = 32; public const int NOT_BETWEEN = 80; public const int SUM = 48; - public const int BAND = 112; + public const int BAND = 113; public const int ROW_STAR = 86; public const int OUTER = 42; public const int NOT_IN = 81; @@ -121,15 +122,15 @@ public const int MAX = 35; public const int NOT_LIKE = 82; public const int EMPTY = 63; - public const int QUOTED_String = 121; + public const int QUOTED_String = 122; public const int ASCENDING = 8; - public const int NUM_LONG = 96; + public const int NUM_LONG = 97; public const int IS = 31; - public const int SQL_NE = 103; + public const int SQL_NE = 104; public const int IN_LIST = 75; public const int WEIRD_IDENT = 91; - public const int NE = 102; - public const int GT = 105; + public const int NE = 103; + public const int GT = 106; public const int MIN = 36; public const int LIKE = 34; public const int WITH = 61; @@ -137,15 +138,15 @@ public const int CONSTRUCTOR = 71; public const int SOME = 47; public const int CLASS = 11; - public const int EXPONENT = 127; - public const int ID_START_LETTER = 123; + public const int EXPONENT = 128; + public const int ID_START_LETTER = 124; public const int EOF = -1; - public const int CLOSE = 101; + public const int CLOSE = 102; public const int AVG = 9; - public const int BXOR = 111; - public const int STAR = 115; + public const int BXOR = 112; + public const int STAR = 116; public const int NOT = 38; - public const int JAVA_CONSTANT = 97; + public const int JAVA_CONSTANT = 98; // delegates // delegators @@ -1704,12 +1705,12 @@ } // $ANTLR end "TRAILING" - // $ANTLR start "T__130" - public void mT__130() // throws RecognitionException [2] + // $ANTLR start "T__131" + public void mT__131() // throws RecognitionException [2] { try { - int _type = T__130; + int _type = T__131; int _channel = DEFAULT_TOKEN_CHANNEL; // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:73:8: ( 'ascending' ) // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:73:10: 'ascending' @@ -1726,14 +1727,14 @@ { } } - // $ANTLR end "T__130" + // $ANTLR end "T__131" - // $ANTLR start "T__131" - public void mT__131() // throws RecognitionException [2] + // $ANTLR start "T__132" + public void mT__132() // throws RecognitionException [2] { try { - int _type = T__131; + int _type = T__132; int _channel = DEFAULT_TOKEN_CHANNEL; // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:74:8: ( 'descending' ) // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:74:10: 'descending' @@ -1750,7 +1751,7 @@ { } } - // $ANTLR end "T__131" + // $ANTLR end "T__132" // $ANTLR start "EQ" public void mEQ() // throws RecognitionException [2] @@ -1759,8 +1760,8 @@ { int _type = EQ; int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:670:3: ( '=' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:670:5: '=' + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:672:3: ( '=' ) + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:672:5: '=' { Match('='); if (state.failed) return ; @@ -1782,8 +1783,8 @@ { int _type = LT; int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:671:3: ( '<' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:671:5: '<' + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:673:3: ( '<' ) + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:673:5: '<' { Match('<'); if (state.failed) return ; @@ -1805,8 +1806,8 @@ { int _type = GT; int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:672:3: ( '>' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:672:5: '>' + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:674:3: ( '>' ) + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:674:5: '>' { Match('>'); if (state.failed) return ; @@ -1828,8 +1829,8 @@ { int _type = SQL_NE; int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:673:7: ( '<>' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:673:9: '<>' + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:675:7: ( '<>' ) + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:675:9: '<>' { Match("<>"); if (state.failed) return ; @@ -1852,7 +1853,7 @@ { int _type = NE; int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:674:3: ( '!=' | '^=' ) + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:676:3: ( '!=' | '^=' ) int alt1 = 2; int LA1_0 = input.LA(1); @@ -1875,7 +1876,7 @@ switch (alt1) { case 1 : - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:674:5: '!=' + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:676:5: '!=' { Match("!="); if (state.failed) return ; @@ -1883,7 +1884,7 @@ } break; case 2 : - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:674:12: '^=' + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:676:12: '^=' { Match("^="); if (state.failed) return ; @@ -1908,8 +1909,8 @@ { int _type = LE; int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:675:3: ( '<=' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:675:5: '<=' + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:677:3: ( '<=' ) + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:677:5: '<=' { Match("<="); if (state.failed) return ; @@ -1932,8 +1933,8 @@ { int _type = GE; int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:676:3: ( '>=' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:676:5: '>=' + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:678:3: ( '>=' ) + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:678:5: '>=' { Match(">="); if (state.failed) return ; @@ -1956,8 +1957,8 @@ { int _type = BOR; int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:678:5: ( '|' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:678:8: '|' + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:680:5: ( '|' ) + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:680:8: '|' { Match('|'); if (state.failed) return ; @@ -1979,8 +1980,8 @@ { int _type = BXOR; int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:679:6: ( '^' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:679:8: '^' + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:681:6: ( '^' ) + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:681:8: '^' { Match('^'); if (state.failed) return ; @@ -2002,8 +2003,8 @@ { int _type = BAND; int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:680:6: ( '&' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:680:8: '&' + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:682:6: ( '&' ) + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:682:8: '&' { Match('&'); if (state.failed) return ; @@ -2025,8 +2026,8 @@ { int _type = BNOT; int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:681:6: ( '!' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:681:8: '!' + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:683:6: ( '!' ) + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:683:8: '!' { Match('!'); if (state.failed) return ; @@ -2048,8 +2049,8 @@ { int _type = COMMA; int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:683:6: ( ',' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:683:8: ',' + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:685:6: ( ',' ) + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:685:8: ',' { Match(','); if (state.failed) return ; @@ -2071,8 +2072,8 @@ { int _type = OPEN; int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:685:5: ( '(' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:685:7: '(' + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:687:5: ( '(' ) + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:687:7: '(' { Match('('); if (state.failed) return ; @@ -2094,8 +2095,8 @@ { int _type = CLOSE; int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:686:6: ( ')' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:686:8: ')' + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:688:6: ( ')' ) + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:688:8: ')' { Match(')'); if (state.failed) return ; @@ -2117,8 +2118,8 @@ { int _type = OPEN_BRACKET; int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:687:13: ( '[' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:687:15: '[' + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:689:13: ( '[' ) + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:689:15: '[' { Match('['); if (state.failed) return ; @@ -2140,8 +2141,8 @@ { int _type = CLOSE_BRACKET; int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:688:14: ( ']' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:688:16: ']' + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:690:14: ( ']' ) + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:690:16: ']' { Match(']'); if (state.failed) return ; @@ -2163,8 +2164,8 @@ { int _type = CONCAT; int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:690:7: ( '||' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:690:9: '||' + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:692:7: ( '||' ) + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:692:9: '||' { Match("||"); if (state.failed) return ; @@ -2187,8 +2188,8 @@ { int _type = PLUS; int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:691:5: ( '+' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:691:7: '+' + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:693:5: ( '+' ) + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:693:7: '+' { Match('+'); if (state.failed) return ; @@ -2210,8 +2211,8 @@ { int _type = MINUS; int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:692:6: ( '-' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:692:8: '-' + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:694:6: ( '-' ) + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:694:8: '-' { Match('-'); if (state.failed) return ; @@ -2233,8 +2234,8 @@ { int _type = STAR; int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:693:5: ( '*' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:693:7: '*' + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:695:5: ( '*' ) + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:695:7: '*' { Match('*'); if (state.failed) return ; @@ -2256,8 +2257,8 @@ { int _type = DIV; int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:694:4: ( '/' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:694:6: '/' + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:696:4: ( '/' ) + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:696:6: '/' { Match('/'); if (state.failed) return ; @@ -2279,8 +2280,8 @@ { int _type = COLON; int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:695:6: ( ':' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:695:8: ':' + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:697:6: ( ':' ) + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:697:8: ':' { Match(':'); if (state.failed) return ; @@ -2302,8 +2303,8 @@ { int _type = PARAM; int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:696:6: ( '?' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:696:8: '?' + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:698:6: ( '?' ) + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:698:8: '?' { Match('?'); if (state.failed) return ; @@ -2325,11 +2326,11 @@ { int _type = IDENT; int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:699:2: ( ID_START_LETTER ( ID_LETTER )* ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:699:4: ID_START_LETTER ( ID_LETTER )* + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:701:2: ( ID_START_LETTER ( ID_LETTER )* ) + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:701:4: ID_START_LETTER ( ID_LETTER )* { mID_START_LETTER(); if (state.failed) return ; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:699:20: ( ID_LETTER )* + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:701:20: ( ID_LETTER )* do { int alt2 = 2; @@ -2344,7 +2345,7 @@ switch (alt2) { case 1 : - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:699:22: ID_LETTER + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:701:22: ID_LETTER { mID_LETTER(); if (state.failed) return ; @@ -2376,7 +2377,7 @@ { try { - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:704:5: ( '_' | '$' | 'a' .. 'z' | 'A' .. 'Z' | '\\u0080' .. '\\ufffe' ) + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:706:5: ( '_' | '$' | 'a' .. 'z' | 'A' .. 'Z' | '\\u0080' .. '\\ufffe' ) // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g: { if ( input.LA(1) == '$' || (input.LA(1) >= 'A' && input.LA(1) <= 'Z') || input.LA(1) == '_' || (input.LA(1) >= 'a' && input.LA(1) <= 'z') || (input.LA(1) >= '\u0080' && input.LA(1) <= '\uFFFE') ) @@ -2406,7 +2407,7 @@ { try { - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:713:5: ( ID_START_LETTER | '0' .. '9' ) + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:715:5: ( ID_START_LETTER | '0' .. '9' ) // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g: { if ( input.LA(1) == '$' || (input.LA(1) >= '0' && input.LA(1) <= '9') || (input.LA(1) >= 'A' && input.LA(1) <= 'Z') || input.LA(1) == '_' || (input.LA(1) >= 'a' && input.LA(1) <= 'z') || (input.LA(1) >= '\u0080' && input.LA(1) <= '\uFFFE') ) @@ -2438,11 +2439,11 @@ { int _type = QUOTED_String; int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:718:4: ( '\\'' ( ( ESCqs )=> ESCqs | ~ '\\'' )* '\\'' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:718:6: '\\'' ( ( ESCqs )=> ESCqs | ~ '\\'' )* '\\'' + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:720:4: ( '\\'' ( ( ESCqs )=> ESCqs | ~ '\\'' )* '\\'' ) + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:720:6: '\\'' ( ( ESCqs )=> ESCqs | ~ '\\'' )* '\\'' { Match('\''); if (state.failed) return ; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:718:11: ( ( ESCqs )=> ESCqs | ~ '\\'' )* + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:720:11: ( ( ESCqs )=> ESCqs | ~ '\\'' )* do { int alt3 = 3; @@ -2468,14 +2469,14 @@ switch (alt3) { case 1 : - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:718:13: ( ESCqs )=> ESCqs + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:720:13: ( ESCqs )=> ESCqs { mESCqs(); if (state.failed) return ; } break; case 2 : - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:718:31: ~ '\\'' + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:720:31: ~ '\\'' { if ( (input.LA(1) >= '\u0000' && input.LA(1) <= '&') || (input.LA(1) >= '(' && input.LA(1) <= '\uFFFF') ) { @@ -2519,8 +2520,8 @@ { try { - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:723:2: ( '\\'' '\\'' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:724:3: '\\'' '\\'' + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:725:2: ( '\\'' '\\'' ) + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:726:3: '\\'' '\\'' { Match('\''); if (state.failed) return ; Match('\''); if (state.failed) return ; @@ -2541,10 +2542,10 @@ { int _type = WS; int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:727:5: ( ( ' ' | '\\t' | '\\r' '\\n' | '\\n' | '\\r' ) ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:727:9: ( ' ' | '\\t' | '\\r' '\\n' | '\\n' | '\\r' ) + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:729:5: ( ( ' ' | '\\t' | '\\r' '\\n' | '\\n' | '\\r' ) ) + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:729:9: ( ' ' | '\\t' | '\\r' '\\n' | '\\n' | '\\r' ) { - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:727:9: ( ' ' | '\\t' | '\\r' '\\n' | '\\n' | '\\r' ) + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:729:9: ( ' ' | '\\t' | '\\r' '\\n' | '\\n' | '\\r' ) int alt4 = 5; switch ( input.LA(1) ) { @@ -2587,21 +2588,21 @@ switch (alt4) { case 1 : - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:727:13: ' ' + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:729:13: ' ' { Match(' '); if (state.failed) return ; } break; case 2 : - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:728:7: '\\t' + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:730:7: '\\t' { Match('\t'); if (state.failed) return ; } break; case 3 : - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:729:7: '\\r' '\\n' + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:731:7: '\\r' '\\n' { Match('\r'); if (state.failed) return ; Match('\n'); if (state.failed) return ; @@ -2609,14 +2610,14 @@ } break; case 4 : - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:730:7: '\\n' + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:732:7: '\\n' { Match('\n'); if (state.failed) return ; } break; case 5 : - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:731:7: '\\r' + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:733:7: '\\r' { Match('\r'); if (state.failed) return ; @@ -2654,7 +2655,7 @@ IToken f4 = null; bool isDecimal=false; IToken t=null; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:740:2: ( '.' ( ( '0' .. '9' )+ ( EXPONENT )? (f1= FLOAT_SUFFIX )? )? | ( '0' ( ( 'x' ) ( HEX_DIGIT )+ | ( '0' .. '7' )+ )? | ( '1' .. '9' ) ( '0' .. '9' )* ) ( ( 'l' ) | {...}? ( '.' ( '0' .. '9' )* ( EXPONENT )? (f2= FLOAT_SUFFIX )? | EXPONENT (f3= FLOAT_SUFFIX )? | f4= FLOAT_SUFFIX ) )? ) + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:742:2: ( '.' ( ( '0' .. '9' )+ ( EXPONENT )? (f1= FLOAT_SUFFIX )? )? | ( '0' ( ( 'x' ) ( HEX_DIGIT )+ | ( '0' .. '7' )+ )? | ( '1' .. '9' ) ( '0' .. '9' )* ) ( ( 'l' ) | {...}? ( '.' ( '0' .. '9' )* ( EXPONENT )? (f2= FLOAT_SUFFIX )? | EXPONENT (f3= FLOAT_SUFFIX )? | f4= FLOAT_SUFFIX ) )? ) int alt20 = 2; int LA20_0 = input.LA(1); @@ -2677,14 +2678,14 @@ switch (alt20) { case 1 : - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:740:6: '.' ( ( '0' .. '9' )+ ( EXPONENT )? (f1= FLOAT_SUFFIX )? )? + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:742:6: '.' ( ( '0' .. '9' )+ ( EXPONENT )? (f1= FLOAT_SUFFIX )? )? { Match('.'); if (state.failed) return ; if ( (state.backtracking==0) ) { _type = DOT; } - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:741:4: ( ( '0' .. '9' )+ ( EXPONENT )? (f1= FLOAT_SUFFIX )? )? + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:743:4: ( ( '0' .. '9' )+ ( EXPONENT )? (f1= FLOAT_SUFFIX )? )? int alt8 = 2; int LA8_0 = input.LA(1); @@ -2695,9 +2696,9 @@ switch (alt8) { case 1 : - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:741:6: ( '0' .. '9' )+ ( EXPONENT )? (f1= FLOAT_SUFFIX )? + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:743:6: ( '0' .. '9' )+ ( EXPONENT )? (f1= FLOAT_SUFFIX )? { - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:741:6: ( '0' .. '9' )+ + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:743:6: ( '0' .. '9' )+ int cnt5 = 0; do { @@ -2713,7 +2714,7 @@ switch (alt5) { case 1 : - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:741:7: '0' .. '9' + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:743:7: '0' .. '9' { MatchRange('0','9'); if (state.failed) return ; @@ -2733,7 +2734,7 @@ loop5: ; // Stops C# compiler whinging that label 'loop5' has no statements - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:741:18: ( EXPONENT )? + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:743:18: ( EXPONENT )? int alt6 = 2; int LA6_0 = input.LA(1); @@ -2744,7 +2745,7 @@ switch (alt6) { case 1 : - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:741:19: EXPONENT + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:743:19: EXPONENT { mEXPONENT(); if (state.failed) return ; @@ -2753,18 +2754,18 @@ } - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:741:30: (f1= FLOAT_SUFFIX )? + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:743:30: (f1= FLOAT_SUFFIX )? int alt7 = 2; int LA7_0 = input.LA(1); - if ( (LA7_0 == 'd' || LA7_0 == 'f') ) + if ( (LA7_0 == 'd' || LA7_0 == 'f' || LA7_0 == 'm') ) { alt7 = 1; } switch (alt7) { case 1 : - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:741:31: f1= FLOAT_SUFFIX + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:743:31: f1= FLOAT_SUFFIX { int f1Start1018 = CharIndex; mFLOAT_SUFFIX(); if (state.failed) return ; @@ -2786,6 +2787,10 @@ { _type = NUM_FLOAT; } + else if (t != null && t.Text.ToUpperInvariant().IndexOf('M')>=0) + { + _type = NUM_DECIMAL; + } else { _type = NUM_DOUBLE; // assume double @@ -2802,9 +2807,9 @@ } break; case 2 : - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:753:4: ( '0' ( ( 'x' ) ( HEX_DIGIT )+ | ( '0' .. '7' )+ )? | ( '1' .. '9' ) ( '0' .. '9' )* ) ( ( 'l' ) | {...}? ( '.' ( '0' .. '9' )* ( EXPONENT )? (f2= FLOAT_SUFFIX )? | EXPONENT (f3= FLOAT_SUFFIX )? | f4= FLOAT_SUFFIX ) )? + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:759:4: ( '0' ( ( 'x' ) ( HEX_DIGIT )+ | ( '0' .. '7' )+ )? | ( '1' .. '9' ) ( '0' .. '9' )* ) ( ( 'l' ) | {...}? ( '.' ( '0' .. '9' )* ( EXPONENT )? (f2= FLOAT_SUFFIX )? | EXPONENT (f3= FLOAT_SUFFIX )? | f4= FLOAT_SUFFIX ) )? { - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:753:4: ( '0' ( ( 'x' ) ( HEX_DIGIT )+ | ( '0' .. '7' )+ )? | ( '1' .. '9' ) ( '0' .. '9' )* ) + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:759:4: ( '0' ( ( 'x' ) ( HEX_DIGIT )+ | ( '0' .. '7' )+ )? | ( '1' .. '9' ) ( '0' .. '9' )* ) int alt13 = 2; int LA13_0 = input.LA(1); @@ -2827,14 +2832,14 @@ switch (alt13) { case 1 : - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:753:6: '0' ( ( 'x' ) ( HEX_DIGIT )+ | ( '0' .. '7' )+ )? + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:759:6: '0' ( ( 'x' ) ( HEX_DIGIT )+ | ( '0' .. '7' )+ )? { Match('0'); if (state.failed) return ; if ( (state.backtracking==0) ) { isDecimal = true; } - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:754:4: ( ( 'x' ) ( HEX_DIGIT )+ | ( '0' .. '7' )+ )? + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:760:4: ( ( 'x' ) ( HEX_DIGIT )+ | ( '0' .. '7' )+ )? int alt11 = 3; int LA11_0 = input.LA(1); @@ -2849,16 +2854,16 @@ switch (alt11) { case 1 : - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:754:6: ( 'x' ) ( HEX_DIGIT )+ + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:760:6: ( 'x' ) ( HEX_DIGIT )+ { - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:754:6: ( 'x' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:754:7: 'x' + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:760:6: ( 'x' ) + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:760:7: 'x' { Match('x'); if (state.failed) return ; } - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:755:5: ( HEX_DIGIT )+ + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:761:5: ( HEX_DIGIT )+ int cnt9 = 0; do { @@ -2924,7 +2929,7 @@ switch (alt9) { case 1 : - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:762:7: HEX_DIGIT + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:768:7: HEX_DIGIT { mHEX_DIGIT(); if (state.failed) return ; @@ -2948,9 +2953,9 @@ } break; case 2 : - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:764:6: ( '0' .. '7' )+ + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:770:6: ( '0' .. '7' )+ { - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:764:6: ( '0' .. '7' )+ + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:770:6: ( '0' .. '7' )+ int cnt10 = 0; do { @@ -2966,7 +2971,7 @@ switch (alt10) { case 1 : - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:764:7: '0' .. '7' + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:770:7: '0' .. '7' { MatchRange('0','7'); if (state.failed) return ; @@ -2996,16 +3001,16 @@ } break; case 2 : - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:766:5: ( '1' .. '9' ) ( '0' .. '9' )* + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:772:5: ( '1' .. '9' ) ( '0' .. '9' )* { - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:766:5: ( '1' .. '9' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:766:6: '1' .. '9' + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:772:5: ( '1' .. '9' ) + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:772:6: '1' .. '9' { MatchRange('1','9'); if (state.failed) return ; } - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:766:16: ( '0' .. '9' )* + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:772:16: ( '0' .. '9' )* do { int alt12 = 2; @@ -3020,7 +3025,7 @@ switch (alt12) { case 1 : - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:766:17: '0' .. '9' + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:772:17: '0' .. '9' { MatchRange('0','9'); if (state.failed) return ; @@ -3045,7 +3050,7 @@ } - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:768:3: ( ( 'l' ) | {...}? ( '.' ( '0' .. '9' )* ( EXPONENT )? (f2= FLOAT_SUFFIX )? | EXPONENT (f3= FLOAT_SUFFIX )? | f4= FLOAT_SUFFIX ) )? + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:774:3: ( ( 'l' ) | {...}? ( '.' ( '0' .. '9' )* ( EXPONENT )? (f2= FLOAT_SUFFIX )? | EXPONENT (f3= FLOAT_SUFFIX )? | f4= FLOAT_SUFFIX ) )? int alt19 = 3; int LA19_0 = input.LA(1); @@ -3053,17 +3058,17 @@ { alt19 = 1; } - else if ( (LA19_0 == '.' || (LA19_0 >= 'd' && LA19_0 <= 'f')) ) + else if ( (LA19_0 == '.' || (LA19_0 >= 'd' && LA19_0 <= 'f') || LA19_0 == 'm') ) { alt19 = 2; } switch (alt19) { case 1 : - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:768:5: ( 'l' ) + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:774:5: ( 'l' ) { - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:768:5: ( 'l' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:768:6: 'l' + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:774:5: ( 'l' ) + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:774:6: 'l' { Match('l'); if (state.failed) return ; @@ -3077,14 +3082,14 @@ } break; case 2 : - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:771:5: {...}? ( '.' ( '0' .. '9' )* ( EXPONENT )? (f2= FLOAT_SUFFIX )? | EXPONENT (f3= FLOAT_SUFFIX )? | f4= FLOAT_SUFFIX ) + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:777:5: {...}? ( '.' ( '0' .. '9' )* ( EXPONENT )? (f2= FLOAT_SUFFIX )? | EXPONENT (f3= FLOAT_SUFFIX )? | f4= FLOAT_SUFFIX ) { if ( !((isDecimal)) ) { if ( state.backtracking > 0 ) {state.failed = true; return ;} throw new FailedPredicateException(input, "NUM_INT", "isDecimal"); } - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:772:4: ( '.' ( '0' .. '9' )* ( EXPONENT )? (f2= FLOAT_SUFFIX )? | EXPONENT (f3= FLOAT_SUFFIX )? | f4= FLOAT_SUFFIX ) + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:778:4: ( '.' ( '0' .. '9' )* ( EXPONENT )? (f2= FLOAT_SUFFIX )? | EXPONENT (f3= FLOAT_SUFFIX )? | f4= FLOAT_SUFFIX ) int alt18 = 3; switch ( input.LA(1) ) { @@ -3100,6 +3105,7 @@ break; case 'd': case 'f': + case 'm': { alt18 = 3; } @@ -3115,10 +3121,10 @@ switch (alt18) { case 1 : - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:772:8: '.' ( '0' .. '9' )* ( EXPONENT )? (f2= FLOAT_SUFFIX )? + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:778:8: '.' ( '0' .. '9' )* ( EXPONENT )? (f2= FLOAT_SUFFIX )? { Match('.'); if (state.failed) return ; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:772:12: ( '0' .. '9' )* + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:778:12: ( '0' .. '9' )* do { int alt14 = 2; @@ -3133,7 +3139,7 @@ switch (alt14) { case 1 : - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:772:13: '0' .. '9' + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:778:13: '0' .. '9' { MatchRange('0','9'); if (state.failed) return ; @@ -3148,7 +3154,7 @@ loop14: ; // Stops C# compiler whining that label 'loop14' has no statements - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:772:24: ( EXPONENT )? + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:778:24: ( EXPONENT )? int alt15 = 2; int LA15_0 = input.LA(1); @@ -3159,7 +3165,7 @@ switch (alt15) { case 1 : - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:772:25: EXPONENT + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:778:25: EXPONENT { mEXPONENT(); if (state.failed) return ; @@ -3168,18 +3174,18 @@ } - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:772:36: (f2= FLOAT_SUFFIX )? + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:778:36: (f2= FLOAT_SUFFIX )? int alt16 = 2; int LA16_0 = input.LA(1); - if ( (LA16_0 == 'd' || LA16_0 == 'f') ) + if ( (LA16_0 == 'd' || LA16_0 == 'f' || LA16_0 == 'm') ) { alt16 = 1; } switch (alt16) { case 1 : - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:772:37: f2= FLOAT_SUFFIX + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:778:37: f2= FLOAT_SUFFIX { int f2Start1220 = CharIndex; mFLOAT_SUFFIX(); if (state.failed) return ; @@ -3198,21 +3204,21 @@ } break; case 2 : - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:773:8: EXPONENT (f3= FLOAT_SUFFIX )? + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:779:8: EXPONENT (f3= FLOAT_SUFFIX )? { mEXPONENT(); if (state.failed) return ; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:773:17: (f3= FLOAT_SUFFIX )? + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:779:17: (f3= FLOAT_SUFFIX )? int alt17 = 2; int LA17_0 = input.LA(1); - if ( (LA17_0 == 'd' || LA17_0 == 'f') ) + if ( (LA17_0 == 'd' || LA17_0 == 'f' || LA17_0 == 'm') ) { alt17 = 1; } switch (alt17) { case 1 : - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:773:18: f3= FLOAT_SUFFIX + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:779:18: f3= FLOAT_SUFFIX { int f3Start1238 = CharIndex; mFLOAT_SUFFIX(); if (state.failed) return ; @@ -3231,7 +3237,7 @@ } break; case 3 : - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:774:8: f4= FLOAT_SUFFIX + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:780:8: f4= FLOAT_SUFFIX ... [truncated message content] |
From: <ste...@us...> - 2009-08-31 10:01:52
|
Revision: 4703 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4703&view=rev Author: steverstrong Date: 2009-08-31 10:01:43 +0000 (Mon, 31 Aug 2009) Log Message: ----------- New files for linq provider Added Paths: ----------- trunk/nhibernate/lib/net/3.5/Remotion.Data.Linq.dll trunk/nhibernate/lib/net/3.5/Remotion.Interfaces.dll trunk/nhibernate/lib/net/3.5/Remotion.dll trunk/nhibernate/src/NHibernate/Hql/Ast/HqlExpression.cs trunk/nhibernate/src/NHibernate/Hql/Ast/HqlTreeBuilder.cs trunk/nhibernate/src/NHibernate/Hql/Ast/HqlTreeNode.cs trunk/nhibernate/src/NHibernate/Linq/CommandData.cs trunk/nhibernate/src/NHibernate/Linq/HqlNodeStack.cs trunk/nhibernate/src/NHibernate/Linq/NamedParameter.cs trunk/nhibernate/src/NHibernate/Linq/NhExpressionTreeVisitor.cs trunk/nhibernate/src/NHibernate/Linq/NhQueryExecutor.cs trunk/nhibernate/src/NHibernate/Linq/NhQueryable.cs trunk/nhibernate/src/NHibernate/Linq/Nominator.cs trunk/nhibernate/src/NHibernate/Linq/ParameterAggregator.cs trunk/nhibernate/src/NHibernate/Linq/ProjectionEvaluator.cs trunk/nhibernate/src/NHibernate/Linq/QueryModelVisitor.cs trunk/nhibernate/src/NHibernate/Linq/ResultTransformer.cs trunk/nhibernate/src/NHibernate.Test/Linq/LinqQuerySamples.cs trunk/nhibernate/src/NHibernate.Test/Linq/ReadonlyTestCase.cs Added: trunk/nhibernate/lib/net/3.5/Remotion.Data.Linq.dll =================================================================== (Binary files differ) Property changes on: trunk/nhibernate/lib/net/3.5/Remotion.Data.Linq.dll ___________________________________________________________________ Added: svn:executable + * Added: svn:mime-type + application/octet-stream Added: trunk/nhibernate/lib/net/3.5/Remotion.Interfaces.dll =================================================================== (Binary files differ) Property changes on: trunk/nhibernate/lib/net/3.5/Remotion.Interfaces.dll ___________________________________________________________________ Added: svn:executable + * Added: svn:mime-type + application/octet-stream Added: trunk/nhibernate/lib/net/3.5/Remotion.dll =================================================================== (Binary files differ) Property changes on: trunk/nhibernate/lib/net/3.5/Remotion.dll ___________________________________________________________________ Added: svn:executable + * Added: svn:mime-type + application/octet-stream Added: trunk/nhibernate/src/NHibernate/Hql/Ast/HqlExpression.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Hql/Ast/HqlExpression.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/Hql/Ast/HqlExpression.cs 2009-08-31 10:01:43 UTC (rev 4703) @@ -0,0 +1,36 @@ +using System.Collections.Generic; +using System.Reflection; +using NHibernate.Hql.Ast.ANTLR; +using NHibernate.Hql.Ast.ANTLR.Tree; + +namespace NHibernate.Hql.Ast +{ + public class HqlExpression : IQueryExpression + { + private readonly IASTNode _node; + private readonly System.Type _type; + private readonly string _key; + + public HqlExpression(HqlQuery node, System.Type type) + { + _node = node.AstNode; + _type = type; + _key = _node.ToStringTree(); + } + + public IASTNode Translate(ISessionFactory sessionFactory) + { + return _node; + } + + public string Key + { + get { return _key; } + } + + public System.Type Type + { + get { return _type; } + } + } +} Property changes on: trunk/nhibernate/src/NHibernate/Hql/Ast/HqlExpression.cs ___________________________________________________________________ Added: svn:executable + * Added: trunk/nhibernate/src/NHibernate/Hql/Ast/HqlTreeBuilder.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Hql/Ast/HqlTreeBuilder.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/Hql/Ast/HqlTreeBuilder.cs 2009-08-31 10:01:43 UTC (rev 4703) @@ -0,0 +1,332 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using NHibernate.Hql.Ast.ANTLR.Tree; + +namespace NHibernate.Hql.Ast +{ + public class HqlTreeBuilder + { + private readonly ASTFactory _factory; + + public HqlTreeBuilder() + { + _factory = new ASTFactory(new ASTTreeAdaptor()); + } + + public HqlQuery Query() + { + return new HqlQuery(_factory); + } + + public HqlQuery Query(HqlSelectFrom selectFrom) + { + return new HqlQuery(_factory, selectFrom); + } + + public HqlQuery Query(HqlSelectFrom selectFrom, HqlWhere where) + { + return new HqlQuery(_factory, selectFrom, where); + } + + public HqlTreeNode Query(HqlSelectFrom selectFrom, HqlWhere where, HqlOrderBy orderBy) + { + return new HqlQuery(_factory, selectFrom, where, orderBy); + } + + public HqlSelectFrom SelectFrom() + { + return new HqlSelectFrom(_factory); + } + + public HqlSelectFrom SelectFrom(HqlSelect select) + { + return new HqlSelectFrom(_factory, select); + } + + public HqlSelectFrom SelectFrom(HqlFrom @from, HqlSelect select) + { + return new HqlSelectFrom(_factory, @from, select); + } + + public HqlSelectFrom SelectFrom(HqlFrom @from) + { + return new HqlSelectFrom(_factory, @from); + } + + public HqlFrom From(HqlRange range) + { + return new HqlFrom(_factory, range); + } + + public HqlFrom From() + { + return new HqlFrom(_factory); + } + + public HqlRange Range(HqlIdent ident) + { + return new HqlRange(_factory, ident); + } + + public HqlRange Range() + { + return new HqlRange(_factory); + } + + public HqlRange Range(HqlTreeNode ident, HqlAlias alias) + { + return new HqlRange(_factory, ident, alias); + } + + public HqlIdent Ident(string ident) + { + return new HqlIdent(_factory, ident); + } + + public HqlAlias Alias(string alias) + { + return new HqlAlias(_factory, alias); + } + + public HqlEquality Equality() + { + return new HqlEquality(_factory); + } + + public HqlBooleanAnd BooleanAnd() + { + return new HqlBooleanAnd(_factory); + } + + public HqlBooleanOr BooleanOr() + { + return new HqlBooleanOr(_factory); + } + + public HqlAdd Add() + { + return new HqlAdd(_factory); + } + + public HqlSubtract Subtract() + { + return new HqlSubtract(_factory); + } + + public HqlMultiplty Multiply() + { + return new HqlMultiplty(_factory); + } + + public HqlDivide Divide() + { + return new HqlDivide(_factory); + } + + public HqlDot Dot() + { + return new HqlDot(_factory); + } + + public HqlParameter Parameter(string name) + { + return new HqlParameter(_factory, name); + } + + public HqlWhere Where(HqlTreeNode expression) + { + return new HqlWhere(_factory, expression); + } + + public HqlWhere Where() + { + return new HqlWhere(_factory); + } + + // TODO - constant will be removed when we have parameter handling done properly. Particularly bad datetime handling here, so it'll be good to delete it :) + public HqlConstant Constant(object value) + { + if (value == null) + { + return new HqlNull(_factory); + } + else + { + switch (System.Type.GetTypeCode(value.GetType())) + { + case TypeCode.Int16: + case TypeCode.Int32: + case TypeCode.Int64: + return new HqlIntegerConstant(_factory, value.ToString()); + case TypeCode.Single: + return new HqlFloatConstant(_factory, value.ToString()); + case TypeCode.Double: + return new HqlDoubleConstant(_factory, value.ToString()); + case TypeCode.Decimal: + return new HqlDecimalConstant(_factory, value.ToString()); + case TypeCode.String: + case TypeCode.Char: + return new HqlStringConstant(_factory, "\'" + value + "\'"); + case TypeCode.DateTime: + return new HqlStringConstant(_factory, "\'" + ((DateTime)value).ToString() + "\'"); + case TypeCode.Boolean: + return new HqlStringConstant(_factory, "\'" + (((bool)value) ? "true" : "false") + "\'"); + default: + throw new NotSupportedException(string.Format("The constant for '{0}' is not supported", value)); + } + } + } + + public HqlOrderBy OrderBy(HqlTreeNode expression, HqlDirection hqlDirection) + { + return new HqlOrderBy(_factory, expression, hqlDirection); + } + + public HqlSelect Select(HqlTreeNode expression) + { + return new HqlSelect(_factory, expression); + } + + public HqlSelect Select(params HqlTreeNode[] expression) + { + return new HqlSelect(_factory, expression); + } + + public HqlSelect Select(IEnumerable<HqlTreeNode> expressions) + { + return new HqlSelect(_factory, expressions.ToArray()); + } + + public HqlConstructor Constructor(ConstructorInfo constructor) + { + return new HqlConstructor(_factory, constructor); + } + + public HqlNill Holder() + { + return new HqlNill(_factory); + } + + public HqlCase Case() + { + return new HqlCase(_factory); + } + + public HqlWhen When() + { + return new HqlWhen(_factory); + } + + public HqlElse Else() + { + return new HqlElse(_factory); + } + + public HqlInequality Inequality() + { + return new HqlInequality(_factory); + } + + public HqlLessThan LessThan() + { + return new HqlLessThan(_factory); + } + + public HqlLessThanOrEqual LessThanOrEqual() + { + return new HqlLessThanOrEqual(_factory); + } + + public HqlGreaterThan GreaterThan() + { + return new HqlGreaterThan(_factory); + } + + public HqlGreaterThanOrEqual GreaterThanOrEqual() + { + return new HqlGreaterThanOrEqual(_factory); + } + + public HqlCount Count(HqlTreeNode child) + { + return new HqlCount(_factory, child); + } + + public HqlRowStar RowStar() + { + return new HqlRowStar(_factory); + } + + public HqlCast Cast(HqlTreeNode expression, System.Type type) + { + return new HqlCast(_factory, expression, type); + } + + public HqlBitwiseNot BitwiseNot() + { + return new HqlBitwiseNot(_factory); + } + + public HqlNot Not() + { + return new HqlNot(_factory); + } + + public HqlAverage Average() + { + return new HqlAverage(_factory); + } + + public HqlAverage Average(HqlTreeNode expression) + { + return new HqlAverage(_factory, expression); + } + + public HqlSum Sum() + { + return new HqlSum(_factory); + } + + public HqlSum Sum(HqlTreeNode expression) + { + return new HqlSum(_factory, expression); + } + + public HqlMin Min() + { + return new HqlMin(_factory); + } + + public HqlMax Max() + { + return new HqlMax(_factory); + } + + public HqlAnd And(HqlTreeNode left, HqlTreeNode right) + { + return new HqlAnd(_factory, left, right); + } + + public HqlJoin Join(HqlTreeNode expression, HqlAlias @alias) + { + return new HqlJoin(_factory, expression, @alias); + } + + public HqlAny Any() + { + return new HqlAny(_factory); + } + + public HqlExists Exists() + { + return new HqlExists(_factory); + } + + public HqlElements Elements() + { + return new HqlElements(_factory); + } + } +} \ No newline at end of file Property changes on: trunk/nhibernate/src/NHibernate/Hql/Ast/HqlTreeBuilder.cs ___________________________________________________________________ Added: svn:executable + * Added: trunk/nhibernate/src/NHibernate/Hql/Ast/HqlTreeNode.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Hql/Ast/HqlTreeNode.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/Hql/Ast/HqlTreeNode.cs 2009-08-31 10:01:43 UTC (rev 4703) @@ -0,0 +1,566 @@ +using System; +using System.Collections.Generic; +using System.Reflection; +using NHibernate.Hql.Ast.ANTLR; +using NHibernate.Hql.Ast.ANTLR.Tree; + +namespace NHibernate.Hql.Ast +{ + public class HqlTreeNode + { + protected readonly IASTNode _node; + protected readonly List<HqlTreeNode> _children; + + protected HqlTreeNode(int type, string text, IASTFactory factory, params HqlTreeNode[] children) + { + _node = factory.CreateNode(type, text); + _children = new List<HqlTreeNode>(); + + foreach (var child in children) + { + _children.Add(child); + _node.AddChild(child.AstNode); + } + } + + public IEnumerable<HqlTreeNode> NodesPreOrder + { + get + { + yield return this; + + foreach (var child in _children) + { + foreach (var node in child.NodesPreOrder) + { + yield return node; + } + } + } + } + + public IEnumerable<HqlTreeNode> NodesPostOrder + { + get + { + foreach (var child in _children) + { + foreach (var node in child.NodesPostOrder) + { + yield return node; + } + } + + yield return this; + } + } + + public IEnumerable<HqlTreeNode> Children + { + get + { + foreach (var child in _children) + { + yield return child; + } + } + } + + public void ClearChildren() + { + _children.Clear(); + _node.ClearChildren(); + } + + internal IASTNode AstNode + { + get { return _node; } + } + + internal void AddChild(HqlTreeNode child) + { + _children.Add(child); + _node.AddChild(child.AstNode); + } + } + + public class HqlQuery : HqlTreeNode + { + internal HqlQuery(IASTFactory factory, params HqlTreeNode[] children) + : base(HqlSqlWalker.QUERY, "query", factory, children) + { + } + } + + + public class HqlIdent : HqlTreeNode + { + internal HqlIdent(IASTFactory factory, string ident) + : base(HqlSqlWalker.IDENT, ident, factory) + { + } + } + + public class HqlRange : HqlTreeNode + { + internal HqlRange(IASTFactory factory, params HqlTreeNode[] children) + : base(HqlSqlWalker.RANGE, "range", factory, children) + { + } + } + + public class HqlFrom : HqlTreeNode + { + internal HqlFrom(IASTFactory factory, params HqlTreeNode[] children) + : base(HqlSqlWalker.FROM, "from", factory, children) + { + } + } + + public class HqlSelectFrom : HqlTreeNode + { + internal HqlSelectFrom(IASTFactory factory, params HqlTreeNode[] children) + : base(HqlSqlWalker.SELECT_FROM, "select_from", factory, children) + { + } + } + + public class HqlAlias : HqlTreeNode + { + public HqlAlias(IASTFactory factory, string @alias) + : base(HqlSqlWalker.ALIAS, alias, factory) + { + } + } + + public class HqlDivide : HqlTreeNode + { + public HqlDivide(IASTFactory factory) + : base(HqlSqlWalker.DIV, "/", factory) + { + } + } + + public class HqlMultiplty : HqlTreeNode + { + public HqlMultiplty(IASTFactory factory) + : base(HqlSqlWalker.STAR, "*", factory) + { + } + } + + public class HqlSubtract : HqlTreeNode + { + public HqlSubtract(IASTFactory factory) + : base(HqlSqlWalker.MINUS, "-", factory) + { + } + } + + public class HqlAdd : HqlTreeNode + { + public HqlAdd(IASTFactory factory) + : base(HqlSqlWalker.PLUS, "+", factory) + { + } + } + + public class HqlBooleanOr : HqlTreeNode + { + public HqlBooleanOr(IASTFactory factory) + : base(HqlSqlWalker.OR, "or", factory) + { + } + } + + public class HqlBooleanAnd : HqlTreeNode + { + public HqlBooleanAnd(IASTFactory factory) + : base(HqlSqlWalker.AND, "/", factory) + { + } + } + + public class HqlEquality : HqlTreeNode + { + public HqlEquality(IASTFactory factory) + : base(HqlSqlWalker.EQ, "==", factory) + { + } + } + + public class HqlParameter : HqlTreeNode + { + public HqlParameter(IASTFactory factory, string name) + : base(HqlSqlWalker.PARAM, name, factory) + { + } + } + + public class HqlDot : HqlTreeNode + { + public HqlDot(IASTFactory factory) + : base(HqlSqlWalker.DOT, ".", factory) + { + } + } + + public class HqlWhere : HqlTreeNode + { + public HqlWhere(IASTFactory factory) + : base(HqlSqlWalker.WHERE, "where", factory) + { + } + + public HqlWhere(IASTFactory factory, HqlTreeNode expression) + : base(HqlSqlWalker.WHERE, "where", factory, expression) + { + } + } + + public class HqlConstant : HqlTreeNode + { + public HqlConstant(IASTFactory factory, int type, string value) + : base(type, value, factory) + { + } + } + + public class HqlStringConstant : HqlConstant + { + public HqlStringConstant(IASTFactory factory, string s) + : base(factory, HqlSqlWalker.QUOTED_String, s) + { + } + } + + public class HqlDoubleConstant : HqlConstant + { + public HqlDoubleConstant(IASTFactory factory, string s) + : base(factory, HqlSqlWalker.NUM_DOUBLE, s) + { + } + } + + public class HqlFloatConstant : HqlConstant + { + public HqlFloatConstant(IASTFactory factory, string s) + : base(factory, HqlSqlWalker.NUM_FLOAT, s) + { + } + } + + public class HqlIntegerConstant : HqlConstant + { + public HqlIntegerConstant(IASTFactory factory, string s) + : base(factory, HqlSqlWalker.NUM_INT, s) + { + } + } + + public class HqlDecimalConstant : HqlConstant + { + public HqlDecimalConstant(IASTFactory factory, string s) + : base(factory, HqlSqlWalker.NUM_DECIMAL, s) + { + } + } + + public class HqlNull : HqlConstant + { + public HqlNull(IASTFactory factory) + : base(factory, HqlSqlWalker.NULL, "null") + { + } + } + + public class HqlOrderBy : HqlTreeNode + { + public HqlOrderBy(IASTFactory factory, HqlTreeNode expression, HqlDirection hqlDirection) + : base(HqlSqlWalker.ORDER, "", factory, expression, + hqlDirection == HqlDirection.Ascending ? + (HqlTreeNode)new HqlDirectionAscending(factory) : (HqlTreeNode)new HqlDirectionDescending(factory)) + { + } + } + + public enum HqlDirection + { + Ascending, + Descending + } + + public class HqlDirectionAscending : HqlTreeNode + { + public HqlDirectionAscending(IASTFactory factory) + : base(HqlSqlWalker.ASCENDING, "asc", factory) + { + } + } + + public class HqlDirectionDescending : HqlTreeNode + { + public HqlDirectionDescending(IASTFactory factory) + : base(HqlSqlWalker.DESCENDING, "desc", factory) + { + } + } + + public class HqlSelect : HqlTreeNode + { + public HqlSelect(IASTFactory factory, params HqlTreeNode[] expression) + : base(HqlSqlWalker.SELECT, "select", factory, expression) + { + } + } + + public class HqlConstructor : HqlTreeNode + { + public HqlConstructor(IASTFactory factory, ConstructorInfo ctor) + : base(HqlSqlWalker.CONSTRUCTOR, "ctor", factory) + { + ((ASTNode)_node).Hack = ctor; + } + } + + public class HqlNill : HqlTreeNode + { + public HqlNill(IASTFactory factory) + : base(0, "nill", factory) + { + } + } + + public class HqlElse : HqlTreeNode + { + public HqlElse(IASTFactory factory) + : base(HqlSqlWalker.ELSE, "else", factory) + { + } + } + + public class HqlWhen : HqlTreeNode + { + public HqlWhen(IASTFactory factory) + : base(HqlSqlWalker.WHEN, "when", factory) + { + } + } + + public class HqlCase : HqlTreeNode + { + public HqlCase(IASTFactory factory) + : base(HqlSqlWalker.CASE, "case", factory) + { + } + } + + public class HqlGreaterThanOrEqual : HqlTreeNode + { + public HqlGreaterThanOrEqual(IASTFactory factory) + : base(HqlSqlWalker.GE, "ge", factory) + { + } + } + + public class HqlGreaterThan : HqlTreeNode + { + public HqlGreaterThan(IASTFactory factory) + : base(HqlSqlWalker.GT, "gt", factory) + { + } + } + + public class HqlLessThanOrEqual : HqlTreeNode + { + public HqlLessThanOrEqual(IASTFactory factory) + : base(HqlSqlWalker.LE, "le", factory) + { + } + } + + public class HqlLessThan : HqlTreeNode + { + public HqlLessThan(IASTFactory factory) + : base(HqlSqlWalker.LT, "lt", factory) + { + } + } + + public class HqlInequality : HqlTreeNode + { + public HqlInequality(IASTFactory factory) + : base(HqlSqlWalker.NE, "ne", factory) + { + } + } + + public class HqlRowStar : HqlTreeNode + { + public HqlRowStar(IASTFactory factory) + : base(HqlSqlWalker.ROW_STAR, "*", factory) + { + } + } + + public class HqlCount : HqlTreeNode + { + public HqlCount(IASTFactory factory, HqlTreeNode child) + : base(HqlSqlWalker.COUNT, "count", factory, child) + { + } + } + + public class HqlAs : HqlTreeNode + { + public HqlAs(IASTFactory factory, HqlTreeNode expression, System.Type type) : base(HqlSqlWalker.AS, "as", factory, expression) + { + switch (System.Type.GetTypeCode(type)) + { + case TypeCode.Int32: + AddChild(new HqlIdent(factory, "integer")); + break; + default: + throw new InvalidOperationException(); + } + } + } + + public class HqlCast : HqlTreeNode + { + public HqlCast(IASTFactory factory, HqlTreeNode expression, System.Type type) : base(HqlSqlWalker.METHOD_CALL, "method", factory) + { + HqlIdent typeIdent; + + if (IsNullableType(type)) + { + type = ExtractUnderlyingTypeFromNullable(type); + } + + switch (System.Type.GetTypeCode(type)) + { + case TypeCode.Int32: + typeIdent = new HqlIdent(factory, "integer"); + break; + case TypeCode.Decimal: + typeIdent = new HqlIdent(factory, "decimal"); + break; + case TypeCode.DateTime: + typeIdent = new HqlIdent(factory, "datetime"); + break; + default: + throw new NotSupportedException(string.Format("Don't currently support casts to {0}", type.Name)); + } + + AddChild(new HqlIdent(factory, "cast")); + AddChild(new HqlExpressionList(factory, expression, typeIdent)); + } + + private static System.Type ExtractUnderlyingTypeFromNullable(System.Type type) + { + return type.GetGenericArguments()[0]; + } + + private static bool IsNullableType(System.Type type) + { + return (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>)); + } + } + + public class HqlExpressionList : HqlTreeNode + { + public HqlExpressionList(IASTFactory factory, params HqlTreeNode[] expression) : base(HqlSqlWalker.EXPR_LIST, "expr_list", factory, expression) + { + } + } + + public class HqlNot : HqlTreeNode + { + public HqlNot(IASTFactory factory) : base(HqlSqlWalker.NOT, "not", factory) + { + } + } + + public class HqlAverage : HqlTreeNode + { + public HqlAverage(IASTFactory factory) + : base(HqlSqlWalker.AGGREGATE, "avg", factory) + { + } + + public HqlAverage(IASTFactory factory, HqlTreeNode expression) : base(HqlSqlWalker.AGGREGATE, "avg", factory, expression) + { + } + } + + public class HqlBitwiseNot : HqlTreeNode + { + public HqlBitwiseNot(IASTFactory factory) : base(HqlSqlWalker.BNOT, "not", factory) + { + } + } + + public class HqlSum : HqlTreeNode + { + public HqlSum(IASTFactory factory) + : base(HqlSqlWalker.AGGREGATE, "sum", factory) + { + } + + public HqlSum(IASTFactory factory, HqlTreeNode expression) + : base(HqlSqlWalker.AGGREGATE, "sum", factory, expression) + { + } + } + + public class HqlMax : HqlTreeNode + { + public HqlMax(IASTFactory factory) : base(HqlSqlWalker.AGGREGATE, "max", factory) + { + } + } + + public class HqlMin : HqlTreeNode + { + public HqlMin(IASTFactory factory) + : base(HqlSqlWalker.AGGREGATE, "min", factory) + { + } + } + + public class HqlAnd : HqlTreeNode + { + public HqlAnd(IASTFactory factory, HqlTreeNode left, HqlTreeNode right) : base(HqlSqlWalker.AND, "and", factory, left, right) + { + } + } + + public class HqlJoin : HqlTreeNode + { + public HqlJoin(IASTFactory factory, HqlTreeNode expression, HqlAlias @alias) : base(HqlSqlWalker.JOIN, "join", factory, expression, @alias) + { + } + } + + public class HqlAny : HqlTreeNode + { + public HqlAny(IASTFactory factory) : base(HqlSqlWalker.ANY, "any", factory) + { + } + } + + public class HqlExists : HqlTreeNode + { + public HqlExists(IASTFactory factory) : base(HqlSqlWalker.EXISTS, "exists", factory) + { + } + } + + public class HqlElements : HqlTreeNode + { + public HqlElements(IASTFactory factory) : base(HqlSqlWalker.ELEMENTS, "elements", factory) + { + } + } + +} \ No newline at end of file Property changes on: trunk/nhibernate/src/NHibernate/Hql/Ast/HqlTreeNode.cs ___________________________________________________________________ Added: svn:executable + * Added: trunk/nhibernate/src/NHibernate/Linq/CommandData.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Linq/CommandData.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/Linq/CommandData.cs 2009-08-31 10:01:43 UTC (rev 4703) @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using NHibernate.Hql.Ast; + +namespace NHibernate.Linq +{ + public class CommandData + { + public CommandData(HqlQuery statement, NamedParameter[] namedParameters, LambdaExpression projectionExpression, List<Action<IQuery>> additionalCriteria) + { + Statement = statement; + NamedParameters = namedParameters; + ProjectionExpression = projectionExpression; + AdditionalCriteria = additionalCriteria; + } + + public HqlQuery Statement { get; private set; } + public NamedParameter[] NamedParameters { get; private set; } + public LambdaExpression ProjectionExpression { get; set; } + public List<Action<IQuery>> AdditionalCriteria { get; set; } + + public IQuery CreateQuery(ISession session, System.Type type) + { + var query = session.CreateQuery(new HqlExpression(Statement, type)); + + foreach (var parameter in NamedParameters) + query.SetParameter(parameter.Name, parameter.Value); + + if (ProjectionExpression != null) + { + query.SetResultTransformer(new ResultTransformer(ProjectionExpression)); + } + + foreach (var criteria in AdditionalCriteria) + { + criteria(query); + } + + return query; + } + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate/Linq/HqlNodeStack.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Linq/HqlNodeStack.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/Linq/HqlNodeStack.cs 2009-08-31 10:01:43 UTC (rev 4703) @@ -0,0 +1,78 @@ +using System; +using System.Collections.Generic; +using NHibernate.Hql.Ast; + +namespace NHibernate.Linq +{ + public class HqlNodeStack + { + private readonly Stack<HqlTreeNode> _stack = new Stack<HqlTreeNode>(); + private readonly HqlNill _root; + + public HqlNodeStack(HqlTreeBuilder builder) + { + _root = builder.Holder(); + _stack.Push(_root); + } + + public IEnumerable<HqlTreeNode> NodesPreOrder + { + get { return _root.NodesPreOrder; } + } + + public IEnumerable<HqlTreeNode> Finish() + { + var holder = (HqlNill) _stack.Pop(); + + return holder.Children; + } + + public void PushAndPop(HqlTreeNode query) + { + Push(query).Dispose(); + } + + public IDisposable Push(HqlTreeNode query) + { + _stack.Peek().AddChild(query); + + _stack.Push(query); + + var stackEntry = new HqlNodeStackEntry(this, query); + + return stackEntry; + } + + private HqlTreeNode Peek() + { + return _stack.Peek(); + } + + private void Pop() + { + _stack.Pop(); + } + + public class HqlNodeStackEntry : IDisposable + { + private readonly HqlNodeStack _parent; + private readonly HqlTreeNode _node; + + internal HqlNodeStackEntry(HqlNodeStack parent, HqlTreeNode node) + { + _parent = parent; + _node = node; + } + + public void Dispose() + { + if (_parent.Peek() != _node) + { + throw new InvalidOperationException(); + } + + _parent.Pop(); + } + } + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate/Linq/NamedParameter.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Linq/NamedParameter.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/Linq/NamedParameter.cs 2009-08-31 10:01:43 UTC (rev 4703) @@ -0,0 +1,14 @@ +namespace NHibernate.Linq +{ + public class NamedParameter + { + public NamedParameter(string name, object value) + { + Name = name; + Value = value; + } + + public string Name { get; set; } + public object Value { get; set; } + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate/Linq/NhExpressionTreeVisitor.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Linq/NhExpressionTreeVisitor.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/Linq/NhExpressionTreeVisitor.cs 2009-08-31 10:01:43 UTC (rev 4703) @@ -0,0 +1,286 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using NHibernate.Hql.Ast; +using Remotion.Data.Linq.Clauses.Expressions; +using Remotion.Data.Linq.Clauses.ExpressionTreeVisitors; +using Remotion.Data.Linq.Parsing; + +namespace NHibernate.Linq +{ + public class NhExpressionTreeVisitor : ThrowingExpressionTreeVisitor + { + protected readonly HqlTreeBuilder _hqlTreeBuilder; + protected readonly HqlNodeStack _stack; + private readonly ParameterAggregator _parameterAggregator; + + public NhExpressionTreeVisitor(ParameterAggregator parameterAggregator) + { + _parameterAggregator = parameterAggregator; + _hqlTreeBuilder = new HqlTreeBuilder(); + _stack = new HqlNodeStack(_hqlTreeBuilder); + } + + public IEnumerable<HqlTreeNode> GetAstBuilderNode() + { + return _stack.Finish(); + } + + public virtual void Visit(Expression expression) + { + VisitExpression(expression); + } + + protected override Expression VisitQuerySourceReferenceExpression(QuerySourceReferenceExpression expression) + { + _stack.PushAndPop(_hqlTreeBuilder.Ident(expression.ReferencedQuerySource.ItemName)); + + return expression; + } + + protected override Expression VisitBinaryExpression(BinaryExpression expression) + { + HqlTreeNode operatorNode = GetHqlOperatorNodeForBinaryOperator(expression); + + using (_stack.Push(operatorNode)) + { + VisitExpression(expression.Left); + + VisitExpression(expression.Right); + } + + return expression; + } + + private HqlTreeNode GetHqlOperatorNodeForBinaryOperator(BinaryExpression expression) + { + switch (expression.NodeType) + { + case ExpressionType.Equal: + return _hqlTreeBuilder.Equality(); + + case ExpressionType.NotEqual: + return _hqlTreeBuilder.Inequality(); + + case ExpressionType.And: + case ExpressionType.AndAlso: + return _hqlTreeBuilder.BooleanAnd(); + + case ExpressionType.Or: + case ExpressionType.OrElse: + return _hqlTreeBuilder.BooleanOr(); + + case ExpressionType.Add: + return _hqlTreeBuilder.Add(); + + case ExpressionType.Subtract: + return _hqlTreeBuilder.Subtract(); + + case ExpressionType.Multiply: + return _hqlTreeBuilder.Multiply(); + + case ExpressionType.Divide: + return _hqlTreeBuilder.Divide(); + + case ExpressionType.LessThan: + return _hqlTreeBuilder.LessThan(); + + case ExpressionType.LessThanOrEqual: + return _hqlTreeBuilder.LessThanOrEqual(); + + case ExpressionType.GreaterThan: + return _hqlTreeBuilder.GreaterThan(); + + case ExpressionType.GreaterThanOrEqual: + return _hqlTreeBuilder.GreaterThanOrEqual(); + } + + throw new InvalidOperationException(); + } + + protected override Expression VisitUnaryExpression(UnaryExpression expression) + { + HqlTreeNode operatorNode = GetHqlOperatorNodeforUnaryOperator(expression); + + using (_stack.Push(operatorNode)) + { + VisitExpression(expression.Operand); + } + + return expression; + } + + private HqlTreeNode GetHqlOperatorNodeforUnaryOperator(UnaryExpression expression) + { + switch (expression.NodeType) + { + case ExpressionType.Not: + return _hqlTreeBuilder.Not(); + } + + throw new InvalidOperationException(); + } + + protected override Expression VisitMemberExpression(MemberExpression expression) + { + using (_stack.Push(_hqlTreeBuilder.Dot())) + { + Expression newExpression = VisitExpression(expression.Expression); + + _stack.PushAndPop(_hqlTreeBuilder.Ident(expression.Member.Name)); + + if (newExpression != expression.Expression) + { + return Expression.MakeMemberAccess(newExpression, expression.Member); + } + } + + return expression; + } + + protected override Expression VisitConstantExpression(ConstantExpression expression) + { + if (expression.Value != null) + { + System.Type t = expression.Value.GetType(); + + if (t.IsGenericType && t.GetGenericTypeDefinition() == typeof (NhQueryable<>)) + { + _stack.PushAndPop(_hqlTreeBuilder.Ident(t.GetGenericArguments()[0].Name)); + return expression; + } + } + + /* + var namedParameter = _parameterAggregator.AddParameter(expression.Value); + + _expression = _hqlTreeBuilder.Parameter(namedParameter.Name); + + return expression; + */ + // TODO - get parameter support in place in the HQLQueryPlan + _stack.PushAndPop(_hqlTreeBuilder.Constant(expression.Value)); + + return expression; + } + + protected override Expression VisitMethodCallExpression(MethodCallExpression expression) + { + if (expression.Method.DeclaringType == typeof(Enumerable)) + { + switch (expression.Method.Name) + { + case "Any": + // Any has one or two arguments. Arg 1 is the source and arg 2 is the optional predicate + using (_stack.Push(_hqlTreeBuilder.Exists())) + { + using (_stack.Push(_hqlTreeBuilder.Query())) + { + using (_stack.Push(_hqlTreeBuilder.SelectFrom())) + { + using (_stack.Push(_hqlTreeBuilder.From())) + { + using (_stack.Push(_hqlTreeBuilder.Range())) + { + VisitExpression(expression.Arguments[0]); + + if (expression.Arguments.Count > 1) + { + var expr = (LambdaExpression) expression.Arguments[1]; + _stack.PushAndPop(_hqlTreeBuilder.Alias(expr.Parameters[0].Name)); + } + } + } + } + if (expression.Arguments.Count > 1) + { + using (_stack.Push(_hqlTreeBuilder.Where())) + { + VisitExpression(expression.Arguments[1]); + } + } + } + } + break; + default: + throw new NotSupportedException(string.Format("The Enumerable method {0} is not supported", expression.Method.Name)); + } + + return expression; + } + else + { + return base.VisitMethodCallExpression(expression); // throws + } + } + + protected override Expression VisitLambdaExpression(LambdaExpression expression) + { + VisitExpression(expression.Body); + + return expression; + } + + protected override Expression VisitParameterExpression(ParameterExpression expression) + { + _stack.PushAndPop(_hqlTreeBuilder.Ident(expression.Name)); + + return expression; + } + + protected override Expression VisitConditionalExpression(ConditionalExpression expression) + { + using (_stack.Push(_hqlTreeBuilder.Case())) + { + using (_stack.Push(_hqlTreeBuilder.When())) + { + VisitExpression(expression.Test); + + VisitExpression(expression.IfTrue); + } + + if (expression.IfFalse != null) + { + using (_stack.Push(_hqlTreeBuilder.Else())) + { + VisitExpression(expression.IfFalse); + } + } + } + + return expression; + } + + protected override Expression VisitSubQueryExpression(SubQueryExpression expression) + { + CommandData query = QueryModelVisitor.GenerateHqlQuery(expression.QueryModel, _parameterAggregator); + + if (query.ProjectionExpression != null) + { + throw new InvalidOperationException(); + } + + // TODO - what if there was a projection expression? + + _stack.PushAndPop(query.Statement); + + return expression; + } + + + // Called when a LINQ expression type is not handled above. + protected override Exception CreateUnhandledItemException<T>(T unhandledItem, string visitMethod) + { + string itemText = FormatUnhandledItem(unhandledItem); + var message = string.Format("The expression '{0}' (type: {1}) is not supported by this LINQ provider.", itemText, typeof(T)); + return new NotSupportedException(message); + } + + private string FormatUnhandledItem<T>(T unhandledItem) + { + var itemAsExpression = unhandledItem as Expression; + return itemAsExpression != null ? FormattingExpressionTreeVisitor.Format(itemAsExpression) : unhandledItem.ToString(); + } + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate/Linq/NhQueryExecutor.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Linq/NhQueryExecutor.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/Linq/NhQueryExecutor.cs 2009-08-31 10:01:43 UTC (rev 4703) @@ -0,0 +1,39 @@ +using System.Collections.Generic; +using System.Linq; +using Remotion.Data.Linq; + +namespace NHibernate.Linq +{ + public class NhQueryExecutor : IQueryExecutor + { + private readonly ISession _session; + + public NhQueryExecutor(ISession session) + { + _session = session; + } + + // Executes a query with a scalar result, i.e. a query that ends with a result operator such as Count, Sum, or Average. + public T ExecuteScalar<T>(QueryModel queryModel) + { + return ExecuteCollection<T>(queryModel).Single(); + } + + // Executes a query with a single result object, i.e. a query that ends with a result operator such as First, Last, Single, Min, or Max. + public T ExecuteSingle<T>(QueryModel queryModel, bool returnDefaultWhenEmpty) + { + return returnDefaultWhenEmpty ? ExecuteCollection<T>(queryModel).SingleOrDefault() : ExecuteCollection<T>(queryModel).Single(); + } + + // Executes a query with a collection result. + public IEnumerable<T> ExecuteCollection<T>(QueryModel queryModel) + { + var commandData = QueryModelVisitor.GenerateHqlQuery(queryModel); + + var query = commandData.CreateQuery(_session, typeof(T)); + + // TODO - check which call on Query makes most sense... + return (IEnumerable<T>) query.List(); + } + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate/Linq/NhQueryable.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Linq/NhQueryable.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/Linq/NhQueryable.cs 2009-08-31 10:01:43 UTC (rev 4703) @@ -0,0 +1,29 @@ +using System.Linq; +using System.Linq.Expressions; +using Remotion.Data.Linq; + +namespace NHibernate.Linq +{ + /// <summary> + /// Provides the main entry point to a LINQ query. + /// </summary> + public class NhQueryable<T> : QueryableBase<T> + { + private static IQueryExecutor CreateExecutor(ISession session) + { + return new NhQueryExecutor(session); + } + + // This constructor is called by our users, create a new IQueryExecutor. + public NhQueryable(ISession session) + : base(CreateExecutor(session)) + { + } + + // This constructor is called indirectly by LINQ's query methods, just pass to base. + public NhQueryable(IQueryProvider provider, Expression expression) + : base(provider, expression) + { + } + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate/Linq/Nominator.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Linq/Nominator.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/Linq/Nominator.cs 2009-08-31 10:01:43 UTC (rev 4703) @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using Remotion.Data.Linq.Parsing; + +namespace NHibernate.Linq +{ + /// <summary> + /// Performs bottom-up analysis to determine which nodes that match a certain predicate + /// </summary> + class Nominator : ExpressionTreeVisitor + { + readonly Func<Expression, bool> _fnIsCandidate; + HashSet<Expression> _candidates; + bool _cannotBeCandidate; + + internal Nominator(Func<Expression, bool> fnIsCandidate) + { + _fnIsCandidate = fnIsCandidate; + } + + internal HashSet<Expression> Nominate(Expression expression) + { + _candidates = new HashSet<Expression>(); + VisitExpression(expression); + return _candidates; + } + + protected override Expression VisitExpression(Expression expression) + { + if (expression != null) + { + bool saveCannotBeEvaluated = _cannotBeCandidate; + _cannotBeCandidate = false; + + base.VisitExpression(expression); + + if (!_cannotBeCandidate) + { + if (_fnIsCandidate(expression)) + { + _candidates.Add(expression); + } + else + { + _cannotBeCandidate = true; + } + } + + _cannotBeCandidate |= saveCannotBeEvaluated; + } + + return expression; + } + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate/Linq/ParameterAggregator.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Linq/ParameterAggregator.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/Linq/ParameterAggregator.cs 2009-08-31 10:01:43 UTC (rev 4703) @@ -0,0 +1,21 @@ +using System.Collections.Generic; + +namespace NHibernate.Linq +{ + public class ParameterAggregator + { + private readonly List<NamedParameter> _parameters = new List<NamedParameter>(); + + public NamedParameter AddParameter(object value) + { + var parameter = new NamedParameter("p" + (_parameters.Count + 1), value); + _parameters.Add(parameter); + return parameter; + } + + public NamedParameter[] GetParameters() + { + return _parameters.ToArray(); + } + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate/Linq/ProjectionEvaluator.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Linq/ProjectionEvaluator.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/Linq/ProjectionEvaluator.cs 2009-08-31 10:01:43 UTC (rev 4703) @@ -0,0 +1,77 @@ +using System.Collections.Generic; +using System.Linq.Expressions; +using NHibernate.Hql.Ast; +using Remotion.Data.Linq.Parsing; + +namespace NHibernate.Linq +{ + public class ProjectionEvaluator : ExpressionTreeVisitor + { + protected readonly HqlTreeBuilder _hqlTreeBuilder; + protected readonly HqlNodeStack _stack; + private readonly ParameterAggregator _parameterAggregator; + private HashSet<Expression> _hqlNodes; + private readonly ParameterExpression _objectArray; + private Expression _projectionExpression; + private int _iColumn; + + public ProjectionEvaluator(ParameterAggregator parameterAggregator, ParameterExpression objectArray) + { + _parameterAggregator = parameterAggregator; + _objectArray = objectArray; + _hqlTreeBuilder = new HqlTreeBuilder(); + _stack = new HqlNodeStack(_hqlTreeBuilder); + } + + public Expression ProjectionExpression + { + get { return _projectionExpression; } + } + + public IEnumerable<HqlTreeNode> GetAstBuilderNode() + { + return _stack.Finish(); + } + + public void Visit(Expression expression) + { + // First, find the sub trees that can be expressed purely in HQL + _hqlNodes = new Nominator(CanBeEvaluatedInHql).Nominate(expression); + + // Now visit the tree + Expression projection = VisitExpression(expression); + + if ((projection != expression) && !_hqlNodes.Contains(expression)) + { + _projectionExpression = projection; + } + } + + protected override Expression VisitExpression(Expression expression) + { + if (expression == null) + { + return null; + } + + if (_hqlNodes.Contains(expression)) + { + // Pure HQL evaluation + var hqlVisitor = new NhExpressionTreeVisitor(_parameterAggregator); + hqlVisitor.Visit(expression); + hqlVisitor.GetAstBuilderNode().ForEach(n =>_stack.PushAndPop(n) ); + + return Expression.Convert(Expression.ArrayIndex(_objectArray, Expression.Constant(_iColumn++)), + expression.Type); + } + + // Can't handle this node with HQL. Just recurse down, and emit the expression + return base.VisitExpression(expression); + } + + private static bool CanBeEvaluatedInHql(Expression expression) + { + return (expression.NodeType != ExpressionType.MemberInit) && (expression.NodeType != ExpressionType.New); + } + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate/Linq/QueryModelVisitor.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Linq/QueryModelVisitor.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/Linq/QueryModelVisitor.cs 2009-08-31 10:01:43 UTC (rev 4703) @@ -0,0 +1,309 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using NHibernate.Hql.Ast; +using Remotion.Data.Linq; +using Remotion.Data.Linq.Clauses; +using Remotion.Data.Linq.Clauses.Expressions; +using Remotion.Data.Linq.Clauses.ResultOperators; +using Remotion.Data.Linq.Clauses.StreamedData; +using Remotion.Data.Linq.Transformations; + +namespace NHibernate.Linq +{ + public class QueryModelVisitor : QueryModelVisitorBase + { + public static CommandData GenerateHqlQuery(QueryModel queryModel) + { + return GenerateHqlQuery(queryModel, new ParameterAggregator()); + } + + public static CommandData GenerateHqlQuery(QueryModel queryModel, ParameterAggregator aggregator) + { + // SubQueryFromClauseFlattener flattener = new SubQueryFromClauseFlattener(); + // flattener.VisitQueryModel(queryModel); + + var visitor = new QueryModelVisitor(aggregator); + visitor.VisitQueryModel(queryModel); + return visitor.GetHqlCommand(); + } + + private readonly HqlTreeBuilder _hqlTreeBuilder; + private readonly ParameterAggregator _parameterAggregator; + private readonly ParameterExpression _objectArray; + private Expression _projectionExpression; + private IStreamedDataInfo _inputInfo; + readonly List<Action<IQuery>> _additionalCriteria = new List<Action<IQuery>>(); + + + private HqlWhere _whereClause; + private HqlSelect _selectClause; + private HqlFrom _fromClause; + private readonly List<HqlTreeNode> _orderByClauses = new List<HqlTreeNode>(); + + private QueryModelVisitor(ParameterAggregator parameterAggregator) + { + _hqlTreeBuilder = new HqlTreeBuilder(); + _parameterAggregator = parameterAggregator; + _objectArray = Expression.Parameter(typeof (object[]), "objectArray"); + } + + public CommandData GetHqlCommand() + { + HqlSelectFrom selectFrom = _hqlTreeBuilder.SelectFrom(); + + if (_fromClause != null) + { + selectFrom.AddChild(_fromClause); + } + + if (_selectClause != null) + { + selectFrom.AddChild(_selectClause); + } + + HqlQuery query = _hqlTreeBuilder.Query(selectFrom); + + if (_whereClause != null) + { + query.AddChild(_whereClause); + } + + foreach (var orderByClause in _orderByClauses) + { + query.AddChild(orderByClause); + } + + return new CommandData(query, + _parameterAggregator.GetParameters(), + _projectionExpression == null ? null : Expression.Lambda(_projectionExpression, _objectArray), + _additionalCriteria); + } + + public override void VisitQueryModel(QueryModel queryModel) + { + if (queryModel.MainFromClause != null) + { + queryModel.MainFromClause.Accept(this, queryModel); + } + + if (queryModel.SelectClause != null) + { + queryModel.SelectClause.Accept(this, queryModel); + } + + VisitBodyClauses(queryModel.BodyClauses, queryModel); + + VisitResultOperators(queryModel.ResultOperators, queryModel); + } + + public override void VisitMainFromClause(MainFromClause fromClause, QueryModel queryModel) + { + var visitor = new NhExpressionTreeVisitor(_parameterAggregator); + visitor.Visit(fromClause.FromExpression); + + _fromClause = _hqlTreeBuilder.From( + _hqlTreeBuilder.Range( + visitor.GetAstBuilderNode().Single(), + _hqlTreeBuilder.Alias(fromClause.ItemName))); + + base.VisitMainFromClause(fromClause, queryModel); + } + + + public override void VisitResultOperator(ResultOperatorBase resultOperator, QueryModel queryModel, int index) + { + if (IsCountOperator(resultOperator)) + { + ProcessCountOperator(resultOperator); + } + else if (IsAggregateOperator(resultOperator)) + { + ProcessAggregateOperator(resultOperator); + } + else if (IsPositionalOperator(resultOperator)) + { + ProcessPositionalOperator(resultOperator); + } + else + { + throw new NotSupportedException(string.Format("The {0} result operator is not current supported", + resultOperator.GetType().Name)); + } + + base.VisitResultOperator(resultOperator, queryModel, index); + } + + private void ProcessPositionalOperator(ResultOperatorBase resultOperator) + { + var first = (FirstResultOperator) resultOperator; + + _additionalCriteria.Add(q => q.SetMaxResults(1)); + } + + private bool IsPositionalOperator(ResultOperatorBase resultOperator) + { + return resultOperator is FirstResultOperator; + } + + private void ProcessAggregateOperator(ResultOperatorBase resultOperator) + { + HqlTreeNode aggregateNode; + + if (resultOperator is AverageResultOperator) + { + aggregateNode = _hqlTreeBuilder.Average(); + } + else if (resultOperator is SumResultOperator) + { + aggregateNode = _hqlTreeBuilder.Sum(); + } + else if (resultOperator is MinResultOperator) + { + aggregateNode = _hqlTreeBuilder.Min(); + } + else + { + aggregateNode = _hqlTreeBuilder.Max(); + } + + _inputInfo = resultOperator.GetOutputDataInfo(_inputInfo); + + HqlTreeNode child = _selectClause.Children.Single(); + + _selectClause.ClearChildren(); + + aggregateNode.AddChild(child); + + _selectClause.AddChild(_hqlTreeBuilder.Cast(aggregateNode, _inputInfo.DataType)); + } + + private void ProcessCountOperator(ResultOperatorBase resultOperator) + { + HqlTreeNode count = _hqlTreeBuilder.Count(_hqlTreeBuilder.RowStar()); + + if (resultOperator is CountResultOperator) + { + // Need to cast to an int (Hql defaults to long counts) + count = _hqlTreeB... [truncated message content] |
From: Schulenberg <ad...@br...> - 2009-08-31 08:46:32
|
Ou will be confused because you will see thousands of broken walls standing up, but no roofs. They are gone--crushed by the piling ashes long ago. At last you will come down and go in at one of the gates through the rough, thick wall, past the empty watch towers. You will tread the very paving stones that men's feet trampled nineteen hundred years ago as they fled from the volcano. You will climb a steep, narrow street. This is the street the fishermen and sailors used in olden times when they came in from the river or sea, carrying baskets of fish or leading mules loaded with goods from their ships. This is the street where people poured out to the sea on that terrible day of the eruption. You will pass a ruined temple of Apollo with standing columns and lonely altar and steps that lead to a room that is gone. A little farther on you will come out into a large open paved space. It is the forum. This used to be the busiest place in all Pompeii. At certain hours of the day it was filled with little tables and with merchants calling out and with gentlemen and slaves buying good's. But now it is empty and very still. Around the sides a few beautiful columns are yet standing with carved marble at the top connecting them. But others lie broken, and most of them are gone entirely. This is all that is left of the porches where men used to walk and talk of business and war and politics and gossip. At one end of the forum is a high stone platform and wide stone steps leading up t |
From: Pendola T. <mem...@he...> - 2009-08-28 23:16:37
|
had reported the delegate offered. Only this time it was from the head of the Markovian government himself. They sat up nearly all the rest of the night considering this new development. "Maybe you shouldn't go, after all," said Joyce once. "Maybe this is something that needs bigger handling than we can possibly give it." Cameron shook his head. "_I've_ got to go. They haven't closed the door and said we can't come. If I backed out before they did, I'd be known the rest of my life as the guy who was _going_ to crack the Markovian problem. But I'd much rather you--" "No! If you're going, so am I." * * * * * They consulted again with Fothergill and finally drafted as polite a reply as possible, explaining t |
From: <ric...@us...> - 2009-08-28 11:53:04
|
Revision: 4702 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4702&view=rev Author: ricbrown Date: 2009-08-28 11:52:50 +0000 (Fri, 28 Aug 2009) Log Message: ----------- Merge r4701 (Fix NH-1905) Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/DotNode.cs trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj Added Paths: ----------- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1905/ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1905/Fixture.cs trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1905/Mappings.hbm.xml trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1905/Model.cs Modified: trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/DotNode.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/DotNode.cs 2009-08-28 11:52:04 UTC (rev 4701) +++ trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/DotNode.cs 2009-08-28 11:52:50 UTC (rev 4702) @@ -496,7 +496,13 @@ // /////////////////////////////////////////////////////////////////////////////// - if ( elem == null ) + bool found = elem != null; + // even though we might find a pre-existing element by join path, for FromElements originating in a from-clause + // we should only ever use the found element if the aliases match (null != null here). Implied joins are + // always (?) ok to reuse. + bool useFoundFromElement = found && ( elem.IsImplied || ( AreSame(classAlias, elem.ClassAlias ) ) ); + + if ( ! useFoundFromElement ) { // If this is an implied join in a from element, then use the impled join type which is part of the // tree parser's state (set by the gramamar actions). @@ -531,6 +537,11 @@ FromElement = elem; // This 'dot' expression now refers to the resulting from element. } + private bool AreSame(String alias1, String alias2) { + // again, null != null here + return !StringHelper.IsEmpty( alias1 ) && !StringHelper.IsEmpty( alias2 ) && alias1.Equals( alias2 ); + } + private void SetImpliedJoin(FromElement elem) { _impliedJoin = elem; Property changes on: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1905 ___________________________________________________________________ Added: bugtraq:url + http://jira.nhibernate.org/browse/%BUGID% Added: bugtraq:logregex + NH-\d+ Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1905/Fixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1905/Fixture.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1905/Fixture.cs 2009-08-28 11:52:50 UTC (rev 4702) @@ -0,0 +1,22 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using NHibernate.Cfg; +using NUnit.Framework; + +namespace NHibernate.Test.NHSpecificTest.NH1905 +{ + [TestFixture] + public class Fixture : BugTestCase + { + [Test] + public void Query() + { + using (ISession s = OpenSession()) + { + s.CreateQuery("select d from Det d left join d.Mas m where (SELECT count(e) FROM d.Mas.Els e WHERE e.Descr='e1')>0") + .List(); + } + } + } +} Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1905/Mappings.hbm.xml =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1905/Mappings.hbm.xml (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1905/Mappings.hbm.xml 2009-08-28 11:52:50 UTC (rev 4702) @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="utf-8" ?> +<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" + assembly="NHibernate.Test" + namespace="NHibernate.Test.NHSpecificTest.NH1905"> + + + <class name="Mas" table="mas" > + <id name="Id" type="Int32" > + <generator class="assigned" /> + </id> + <set name="Els" table="MasEls" > + <key column="IdMas" /> + <many-to-many column="IdEls" class="El"/> + </set> + </class> + + <class name="Det" table="det" > + <id name="Id" type="Int32" > + <generator class="assigned" /> + </id> + <many-to-one class="Mas" name="Mas" column="IdMas" /> + </class> + + <class name="El" table="Els" > + <id name="Id" type="Int32" > + <generator class="assigned" /> + </id> + <property name="Descr" type="String" /> + </class> + +</hibernate-mapping> \ No newline at end of file Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1905/Model.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1905/Model.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1905/Model.cs 2009-08-28 11:52:50 UTC (rev 4702) @@ -0,0 +1,60 @@ +using Iesi.Collections.Generic; + +namespace NHibernate.Test.NHSpecificTest.NH1905 +{ + public class Mas + { + private int _Id; + + public virtual int Id + { + get { return _Id; } + set { _Id = value; } + } + + private ISet<El> _Els; + + public virtual ISet<El> Els + { + get { return _Els; } + set { _Els = value; } + } + } + + + public class Det + { + private int _Id; + private Mas _Mas; + + public virtual int Id + { + get { return _Id; } + set { _Id = value; } + } + + public virtual Mas Mas + { + get { return _Mas; } + set { _Mas = value; } + } + } + + public class El + { + private int _Id; + private string _Descr; + + public virtual int Id + { + get { return _Id; } + set { _Id = value; } + } + + public virtual string Descr + { + get { return _Descr; } + set { _Descr = value; } + } + } +} \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-08-28 11:52:04 UTC (rev 4701) +++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-08-28 11:52:50 UTC (rev 4702) @@ -575,6 +575,8 @@ <Compile Include="NHSpecificTest\NH1899\SampleTest.cs" /> <Compile Include="NHSpecificTest\NH1904\Fixture.cs" /> <Compile Include="NHSpecificTest\NH1904\Model.cs" /> + <Compile Include="NHSpecificTest\NH1905\Fixture.cs" /> + <Compile Include="NHSpecificTest\NH1905\Model.cs" /> <Compile Include="NHSpecificTest\NH1907\Fixture.cs" /> <Compile Include="NHSpecificTest\NH1907\MyType.cs" /> <Compile Include="NHSpecificTest\NH1908\Fixture.cs" /> @@ -2000,6 +2002,7 @@ <EmbeddedResource Include="Criteria\Lambda\Mappings.hbm.xml" /> <EmbeddedResource Include="CfgTest\Loquacious\EntityToCache.hbm.xml" /> <Content Include="DynamicEntity\package.html" /> + <EmbeddedResource Include="NHSpecificTest\NH1905\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1939\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1911\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1920\Mappings.hbm.xml" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ric...@us...> - 2009-08-28 11:52:13
|
Revision: 4701 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4701&view=rev Author: ricbrown Date: 2009-08-28 11:52:04 +0000 (Fri, 28 Aug 2009) Log Message: ----------- Fix NH-1905 Modified Paths: -------------- branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/DotNode.cs branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj Added Paths: ----------- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1905/ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1905/Fixture.cs branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1905/Mappings.hbm.xml branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1905/Model.cs Modified: branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/DotNode.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/DotNode.cs 2009-08-25 12:45:10 UTC (rev 4700) +++ branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/DotNode.cs 2009-08-28 11:52:04 UTC (rev 4701) @@ -496,7 +496,13 @@ // /////////////////////////////////////////////////////////////////////////////// - if ( elem == null ) + bool found = elem != null; + // even though we might find a pre-existing element by join path, for FromElements originating in a from-clause + // we should only ever use the found element if the aliases match (null != null here). Implied joins are + // always (?) ok to reuse. + bool useFoundFromElement = found && ( elem.IsImplied || ( AreSame(classAlias, elem.ClassAlias ) ) ); + + if ( ! useFoundFromElement ) { // If this is an implied join in a from element, then use the impled join type which is part of the // tree parser's state (set by the gramamar actions). @@ -531,6 +537,11 @@ FromElement = elem; // This 'dot' expression now refers to the resulting from element. } + private bool AreSame(String alias1, String alias2) { + // again, null != null here + return !StringHelper.IsEmpty( alias1 ) && !StringHelper.IsEmpty( alias2 ) && alias1.Equals( alias2 ); + } + private void SetImpliedJoin(FromElement elem) { _impliedJoin = elem; Added: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1905/Fixture.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1905/Fixture.cs (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1905/Fixture.cs 2009-08-28 11:52:04 UTC (rev 4701) @@ -0,0 +1,22 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using NHibernate.Cfg; +using NUnit.Framework; + +namespace NHibernate.Test.NHSpecificTest.NH1905 +{ + [TestFixture] + public class Fixture : BugTestCase + { + [Test] + public void Query() + { + using (ISession s = OpenSession()) + { + s.CreateQuery("select d from Det d left join d.Mas m where (SELECT count(e) FROM d.Mas.Els e WHERE e.Descr='e1')>0") + .List(); + } + } + } +} Added: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1905/Mappings.hbm.xml =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1905/Mappings.hbm.xml (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1905/Mappings.hbm.xml 2009-08-28 11:52:04 UTC (rev 4701) @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="utf-8" ?> +<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" + assembly="NHibernate.Test" + namespace="NHibernate.Test.NHSpecificTest.NH1905"> + + + <class name="Mas" table="mas" > + <id name="Id" type="Int32" > + <generator class="assigned" /> + </id> + <set name="Els" table="MasEls" > + <key column="IdMas" /> + <many-to-many column="IdEls" class="El"/> + </set> + </class> + + <class name="Det" table="det" > + <id name="Id" type="Int32" > + <generator class="assigned" /> + </id> + <many-to-one class="Mas" name="Mas" column="IdMas" /> + </class> + + <class name="El" table="Els" > + <id name="Id" type="Int32" > + <generator class="assigned" /> + </id> + <property name="Descr" type="String" /> + </class> + +</hibernate-mapping> Added: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1905/Model.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1905/Model.cs (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1905/Model.cs 2009-08-28 11:52:04 UTC (rev 4701) @@ -0,0 +1,60 @@ +using Iesi.Collections.Generic; + +namespace NHibernate.Test.NHSpecificTest.NH1905 +{ + public class Mas + { + private int _Id; + + public virtual int Id + { + get { return _Id; } + set { _Id = value; } + } + + private ISet<El> _Els; + + public virtual ISet<El> Els + { + get { return _Els; } + set { _Els = value; } + } + } + + + public class Det + { + private int _Id; + private Mas _Mas; + + public virtual int Id + { + get { return _Id; } + set { _Id = value; } + } + + public virtual Mas Mas + { + get { return _Mas; } + set { _Mas = value; } + } + } + + public class El + { + private int _Id; + private string _Descr; + + public virtual int Id + { + get { return _Id; } + set { _Id = value; } + } + + public virtual string Descr + { + get { return _Descr; } + set { _Descr = value; } + } + } +} Modified: branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-08-25 12:45:10 UTC (rev 4700) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-08-28 11:52:04 UTC (rev 4701) @@ -359,6 +359,8 @@ <Compile Include="NHSpecificTest\ElementsEnums\IntEnumsBagPartialNameFixture.cs" /> <Compile Include="NHSpecificTest\ElementsEnums\IntEnumsBagFixture.cs" /> <Compile Include="NHSpecificTest\ElementsEnums\Something.cs" /> + <Compile Include="NHSpecificTest\NH1905\Fixture.cs" /> + <Compile Include="NHSpecificTest\NH1905\Model.cs" /> <Compile Include="NHSpecificTest\NH1911\Fixture.cs" /> <Compile Include="NHSpecificTest\NH1911\Model.cs" /> <Compile Include="NHSpecificTest\NH1920\Fixture.cs" /> @@ -1974,6 +1976,7 @@ <EmbeddedResource Include="Bytecode\Lightweight\ProductLine.hbm.xml" /> <EmbeddedResource Include="DriverTest\MultiTypeEntity.hbm.xml" /> <Content Include="DynamicEntity\package.html" /> + <EmbeddedResource Include="NHSpecificTest\NH1905\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1939\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1911\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1920\Mappings.hbm.xml" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: Rivinius <nov...@av...> - 2009-08-28 07:31:13
|
Thyself than all the earth beside? Then if high Fortune far from thee take wing, Why shouldst thou envy Counsellor or King? Purple or buckram--wherefore make ado What coat may cover, so the heart be true? But if at last thou gather wealth at will, Thou best shalt succour those that need it still; Since he who best doth poverty endure, Should prove when rich heart's brother to the poor. WILD WINE OF NATURE IN PRAISE OF WATER-DRINKING (After Duncan Ban McIntyre) Wild Wine of Nature, honey tasted, Ever streaming, never wasted, From long and long and long ago In limpid, cool, life-giving flow Up-bubbling with its cordial bland Even from the thirsty desert sand-- O draught to quench man's thirst upon Far sweeter than the cinnamon! Like babes upon their mother's breast, To Earth our craving lips are pressed For her free gift of matchless price, Pure as it poured in Paradise. BRIDAL INVOCATION Jesu, from to-day Guide us on our way, So shall we, no moment wasting, Follow Thee with holy hasting, Led by Thy dear Hand To the Blessed land. Through despondence dread, Still support our tread; Though our heavy burdens bow us, How to bear |
From: <ric...@us...> - 2009-08-25 12:45:19
|
Revision: 4700 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4700&view=rev Author: ricbrown Date: 2009-08-25 12:45:10 +0000 (Tue, 25 Aug 2009) Log Message: ----------- Merge r4699 (Fix NH-1939) Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Cfg/MappingSchema/Hbm.generated.cs trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/AuxiliaryDatabaseObjectFactory.cs trunk/nhibernate/src/NHibernate/Mapping/AbstractAuxiliaryDatabaseObject.cs trunk/nhibernate/src/NHibernate/NHibernate.csproj trunk/nhibernate/src/NHibernate/nhibernate-mapping.xsd trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj Added Paths: ----------- trunk/nhibernate/src/NHibernate/Cfg/MappingSchema/HbmDefinition.cs trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1939/ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1939/AuxType.cs trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1939/Fixture.cs trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1939/Mappings.hbm.xml Modified: trunk/nhibernate/src/NHibernate/Cfg/MappingSchema/Hbm.generated.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Cfg/MappingSchema/Hbm.generated.cs 2009-08-25 12:44:30 UTC (rev 4699) +++ trunk/nhibernate/src/NHibernate/Cfg/MappingSchema/Hbm.generated.cs 2009-08-25 12:45:10 UTC (rev 4700) @@ -2,7 +2,7 @@ /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -83,7 +83,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -110,7 +110,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -128,7 +128,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -193,7 +193,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -207,7 +207,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -372,7 +372,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -386,7 +386,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -413,7 +413,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="urn:nhibernate-mapping-2.2")] public enum HbmCacheUsage { @@ -436,7 +436,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="urn:nhibernate-mapping-2.2")] public enum HbmCacheInclude { @@ -451,7 +451,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -465,7 +465,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -524,7 +524,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:nhibernate-mapping-2.2")] public enum HbmOndelete { @@ -539,7 +539,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -565,7 +565,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -586,7 +586,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -618,7 +618,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -632,7 +632,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -770,7 +770,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -784,7 +784,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:nhibernate-mapping-2.2")] public enum HbmOuterJoinStrategy { @@ -803,7 +803,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:nhibernate-mapping-2.2")] public enum HbmFetchMode { @@ -818,7 +818,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:nhibernate-mapping-2.2")] public enum HbmLaziness { @@ -837,7 +837,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:nhibernate-mapping-2.2")] public enum HbmNotFoundMode { @@ -852,7 +852,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -888,7 +888,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -1005,7 +1005,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -1023,7 +1023,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -1041,7 +1041,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:nhibernate-mapping-2.2")] public enum HbmPropertyGeneration { @@ -1060,7 +1060,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -1121,7 +1121,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -1151,7 +1151,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -1255,7 +1255,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -1277,7 +1277,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:nhibernate-mapping-2.2")] public enum HbmRestrictedLaziness { @@ -1292,7 +1292,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -1329,7 +1329,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -1343,7 +1343,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -1373,7 +1373,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:nhibernate-mapping-2.2")] public enum HbmCustomSQLCheck { @@ -1392,7 +1392,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:nhibernate-mapping-2.2")] public enum HbmCollectionFetchMode { @@ -1411,7 +1411,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -1591,7 +1591,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:nhibernate-mapping-2.2")] public enum HbmCollectionLazy { @@ -1610,7 +1610,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -1829,7 +1829,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -1851,7 +1851,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="urn:nhibernate-mapping-2.2")] public enum HbmTuplizerEntitymode { @@ -1870,7 +1870,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -1920,7 +1920,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -1970,7 +1970,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -2015,7 +2015,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:nhibernate-mapping-2.2")] public enum HbmUnsavedValueType { @@ -2034,7 +2034,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -2086,7 +2086,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -2104,7 +2104,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -2158,7 +2158,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -2185,7 +2185,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -2271,7 +2271,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -2335,7 +2335,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -2520,7 +2520,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -2714,7 +2714,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -2733,7 +2733,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -2752,7 +2752,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -2778,7 +2778,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -2808,7 +2808,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -2843,7 +2843,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -2878,7 +2878,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -2971,7 +2971,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -3113,7 +3113,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="urn:nhibernate-mapping-2.2")] public enum HbmPrimitivearrayOuterjoin { @@ -3132,7 +3132,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="urn:nhibernate-mapping-2.2")] public enum HbmPrimitivearrayFetch { @@ -3151,7 +3151,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -3335,7 +3335,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -3518,7 +3518,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -3551,7 +3551,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -3604,7 +3604,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="urn:nhibernate-mapping-2.2")] public enum HbmTimestampUnsavedvalue { @@ -3619,7 +3619,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="urn:nhibernate-mapping-2.2")] public enum HbmTimestampSource { @@ -3634,7 +3634,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:nhibernate-mapping-2.2")] public enum HbmVersionGeneration { @@ -3649,7 +3649,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -3710,7 +3710,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -3762,7 +3762,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -3845,7 +3845,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="urn:nhibernate-mapping-2.2")] public enum HbmJoinFetch { @@ -3860,7 +3860,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -4021,7 +4021,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -4042,7 +4042,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -4073,7 +4073,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -4095,7 +4095,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -4109,7 +4109,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:nhibernate-mapping-2.2")] public enum HbmLockMode { @@ -4136,7 +4136,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -4175,7 +4175,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -4189,7 +4189,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -4220,7 +4220,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -4238,7 +4238,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -4313,7 +4313,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -4331,7 +4331,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:nhibernate-mapping-2.2")] public enum HbmFlushMode { @@ -4350,7 +4350,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:nhibernate-mapping-2.2")] public enum HbmCacheMode { @@ -4377,7 +4377,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -4467,7 +4467,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -4606,7 +4606,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -4764,7 +4764,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:nhibernate-mapping-2.2")] public enum HbmPolymorphismType { @@ -4779,7 +4779,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:nhibernate-mapping-2.2")] public enum HbmOptimisticLockMode { @@ -4802,7 +4802,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -4816,7 +4816,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -4836,7 +4836,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -4845,12 +4845,16 @@ public partial class HbmDefinition { /// <remarks/> + [System.Xml.Serialization.XmlElementAttribute("param")] + public HbmParam[] param; + + /// <remarks/> [System.Xml.Serialization.XmlAttributeAttribute()] public string @class; } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -4864,7 +4868,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -4882,7 +4886,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -4908,7 +4912,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -4926,7 +4930,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -5015,7 +5019,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -5037,7 +5041,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "3.0.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] Added: trunk/nhibernate/src/NHibernate/Cfg/MappingSchema/HbmDefinition.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Cfg/MappingSchema/HbmDefinition.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/Cfg/MappingSchema/HbmDefinition.cs 2009-08-25 12:45:10 UTC (rev 4700) @@ -0,0 +1,22 @@ +using System.Collections.Generic; + +namespace NHibernate.Cfg.MappingSchema +{ + partial class HbmDefinition : HbmBase + { + public IDictionary<string, string> FindParameterValues() + { + IDictionary<string, string> parameters = new Dictionary<string, string>(); + + if (param != null) + { + foreach (HbmParam parameter in param) + { + parameters.Add(parameter.name, parameter.GetText()); + } + } + + return parameters; + } + } +} \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/AuxiliaryDatabaseObjectFactory.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/AuxiliaryDatabaseObjectFactory.cs 2009-08-25 12:44:30 UTC (rev 4699) +++ trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/AuxiliaryDatabaseObjectFactory.cs 2009-08-25 12:45:10 UTC (rev 4700) @@ -49,6 +49,8 @@ customObject.AddDialectScope(dialectName); } + customObject.SetParameterValues(definitionSchema.FindParameterValues()); + return customObject; } catch (TypeLoadException exception) Modified: trunk/nhibernate/src/NHibernate/Mapping/AbstractAuxiliaryDatabaseObject.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Mapping/AbstractAuxiliaryDatabaseObject.cs 2009-08-25 12:44:30 UTC (rev 4699) +++ trunk/nhibernate/src/NHibernate/Mapping/AbstractAuxiliaryDatabaseObject.cs 2009-08-25 12:45:10 UTC (rev 4700) @@ -17,6 +17,7 @@ public abstract class AbstractAuxiliaryDatabaseObject : IAuxiliaryDatabaseObject { private readonly HashedSet<string> dialectScopes; + private IDictionary<string, string> parameters = new Dictionary<string, string>(); protected AbstractAuxiliaryDatabaseObject() { @@ -38,6 +39,11 @@ get { return dialectScopes; } } + public IDictionary<string, string> Parameters + { + get { return parameters; } + } + public bool AppliesToDialect(Dialect.Dialect dialect) { // empty means no scoping @@ -47,6 +53,10 @@ public abstract string SqlCreateString(Dialect.Dialect dialect, IMapping p, string defaultCatalog, string defaultSchema); public abstract string SqlDropString(Dialect.Dialect dialect, string defaultCatalog, string defaultSchema); - public void SetParameterValues(IDictionary<string, string> parameters) {} + public void SetParameterValues(IDictionary<string, string> parameters) + { + this.parameters = parameters; + } + } } \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate/NHibernate.csproj =================================================================== --- trunk/nhibernate/src/NHibernate/NHibernate.csproj 2009-08-25 12:44:30 UTC (rev 4699) +++ trunk/nhibernate/src/NHibernate/NHibernate.csproj 2009-08-25 12:45:10 UTC (rev 4700) @@ -486,6 +486,7 @@ <Compile Include="Cfg\Loquacious\ITypeDefConfiguration.cs" /> <Compile Include="Cfg\Loquacious\MappingsConfiguration.cs" /> <Compile Include="Cfg\Loquacious\ProxyConfiguration.cs" /> + <Compile Include="Cfg\MappingSchema\HbmDefinition.cs" /> <Compile Include="Cfg\SchemaAutoAction.cs" /> <Compile Include="Cfg\SessionFactoryConfigurationBase.cs" /> <Compile Include="Cfg\ISessionFactoryConfiguration.cs" /> Modified: trunk/nhibernate/src/NHibernate/nhibernate-mapping.xsd =================================================================== --- trunk/nhibernate/src/NHibernate/nhibernate-mapping.xsd 2009-08-25 12:44:30 UTC (rev 4699) +++ trunk/nhibernate/src/NHibernate/nhibernate-mapping.xsd 2009-08-25 12:45:10 UTC (rev 4700) @@ -367,6 +367,9 @@ </xs:element> <xs:element name="definition"> <xs:complexType> + <xs:sequence> + <xs:element ref="param" minOccurs="0" maxOccurs="unbounded" /> + </xs:sequence> <xs:attribute name="class" use="required" type="xs:string" /> </xs:complexType> </xs:element> Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1939/AuxType.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1939/AuxType.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1939/AuxType.cs 2009-08-25 12:45:10 UTC (rev 4700) @@ -0,0 +1,22 @@ +using System.Collections.Generic; +using NHibernate; +using NHibernate.Engine; +using NHibernate.Mapping; + +namespace NHibernate.Test.NHSpecificTest.NH1939 +{ + public class AuxType : AbstractAuxiliaryDatabaseObject + { + + override public string SqlCreateString(Dialect.Dialect dialect, IMapping p, string defaultCatalog, string defaultSchema) + { + return "select '" + Parameters["scriptParameter"] + "'"; + } + + override public string SqlDropString(Dialect.Dialect dialect, string defaultCatalog, string defaultSchema) + { + return "select 'drop script'"; + } + + } +} Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1939/Fixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1939/Fixture.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1939/Fixture.cs 2009-08-25 12:45:10 UTC (rev 4700) @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; +using NUnit.Framework; +using NHibernate.Tool.hbm2ddl; +using System.Text; +using NHibernate.Cfg; + +namespace NHibernate.Test.NHSpecificTest.NH1939 +{ + [TestFixture] + public class Fixture : BugTestCase + { + + private Configuration cfg; + private StringBuilder schemaBuilder; + + private void AddString(string sqlString) + { + schemaBuilder.Append(sqlString); + } + + protected override bool AppliesTo(NHibernate.Dialect.Dialect dialect) + { + return (dialect is Dialect.MsSql2000Dialect); + } + + protected override void Configure(Configuration configuration) + { + base.Configure(configuration); + cfg = configuration; + } + + [Test] + public void Can_Parameterise_Auxiliary_Database_Objects() + { + schemaBuilder = new StringBuilder(); + + SchemaExport schemaExport = new SchemaExport(cfg); + schemaExport.Execute(AddString, false, false); + + string schema = schemaBuilder.ToString(); + + Assert.That(schema.Contains("select 'drop script'"), Is.True, + "schema drop script not exported"); + + Assert.That(schema.Contains("select 'create script'"), Is.True, + "parameterised schema create script not exported"); + } + + } +} Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1939/Mappings.hbm.xml =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1939/Mappings.hbm.xml (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1939/Mappings.hbm.xml 2009-08-25 12:45:10 UTC (rev 4700) @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8" ?> +<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" + assembly="NHibernate.Test" + namespace="NHibernate.Test.NHSpecificTest.NH1939"> + + <database-object> + <definition class="AuxType"> + <param name="scriptParameter">create script</param> + </definition> + </database-object> + +</hibernate-mapping> Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-08-25 12:44:30 UTC (rev 4699) +++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-08-25 12:45:10 UTC (rev 4700) @@ -585,6 +585,8 @@ <Compile Include="NHSpecificTest\NH1914\Model.cs" /> <Compile Include="NHSpecificTest\NH1920\Fixture.cs" /> <Compile Include="NHSpecificTest\NH1920\Model.cs" /> + <Compile Include="NHSpecificTest\NH1939\AuxType.cs" /> + <Compile Include="NHSpecificTest\NH1939\Fixture.cs" /> <Compile Include="NHSpecificTest\NH473\Child.cs" /> <Compile Include="NHSpecificTest\NH473\Fixture.cs" /> <Compile Include="NHSpecificTest\NH473\Parent.cs" /> @@ -1998,6 +2000,7 @@ <EmbeddedResource Include="Criteria\Lambda\Mappings.hbm.xml" /> <EmbeddedResource Include="CfgTest\Loquacious\EntityToCache.hbm.xml" /> <Content Include="DynamicEntity\package.html" /> + <EmbeddedResource Include="NHSpecificTest\NH1939\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1911\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1920\Mappings.hbm.xml" /> <EmbeddedResource Include="Linq\Mappings\Customer.hbm.xml" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |