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: <fab...@us...> - 2009-06-14 13:06:56
|
Revision: 4462 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4462&view=rev Author: fabiomaulo Date: 2009-06-14 13:06:55 +0000 (Sun, 14 Jun 2009) Log Message: ----------- Test for NH-1835 Modified Paths: -------------- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj Added Paths: ----------- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1835/ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1835/Document.cs trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1835/Fixture.cs trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1835/Mappings.hbm.xml Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1835/Document.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1835/Document.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1835/Document.cs 2009-06-14 13:06:55 UTC (rev 4462) @@ -0,0 +1,10 @@ +using System; + +namespace NHibernate.Test.NHSpecificTest.NH1835 +{ + public class Document + { + public virtual Guid Id { get; set; } + public virtual byte[] Contents { get; set; } + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1835/Fixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1835/Fixture.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1835/Fixture.cs 2009-06-14 13:06:55 UTC (rev 4462) @@ -0,0 +1,16 @@ +using NUnit.Framework; + +namespace NHibernate.Test.NHSpecificTest.NH1835 +{ + [TestFixture] + public class Fixture: BugTestCase + { + [Test, Ignore("Not fixed yet.")] + public void ColumnTypeBinaryBlob() + { + var pc = sessions.GetEntityPersister(typeof (Document).FullName); + var type = pc.GetPropertyType("Contents"); + Assert.That(type.SqlTypes(sessions)[0].Length, Is.EqualTo(3000)); + } + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1835/Mappings.hbm.xml =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1835/Mappings.hbm.xml (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1835/Mappings.hbm.xml 2009-06-14 13:06:55 UTC (rev 4462) @@ -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.NH1835"> + + <class name="Document" table="documents_document"> + <id name="Id"> + <generator class="guid.comb" /> + </id> + <property name="Contents"> + <column name="Contents" sql-type="varbinary(3000)"/> + </property> + </class> +</hibernate-mapping> \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-06-14 10:01:50 UTC (rev 4461) +++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-06-14 13:06:55 UTC (rev 4462) @@ -505,6 +505,8 @@ <Compile Include="NHSpecificTest\NH1821\Fixture.cs" /> <Compile Include="NHSpecificTest\NH1834\A.cs" /> <Compile Include="NHSpecificTest\NH1834\Fixture.cs" /> + <Compile Include="NHSpecificTest\NH1835\Document.cs" /> + <Compile Include="NHSpecificTest\NH1835\Fixture.cs" /> <Compile Include="NHSpecificTest\NH645\HQLFunctionFixture.cs" /> <Compile Include="HQL\HQLFunctions.cs" /> <Compile Include="HQL\Human.cs" /> @@ -1905,6 +1907,7 @@ <EmbeddedResource Include="Classic\EntityWithLifecycle.hbm.xml" /> <EmbeddedResource Include="Bytecode\Lightweight\ProductLine.hbm.xml" /> <Content Include="DynamicEntity\package.html" /> + <EmbeddedResource Include="NHSpecificTest\NH1835\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1834\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1821\Mappings.hbm.xml" /> <EmbeddedResource Include="TypeParameters\EntityCustomId.hbm.xml" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <te...@us...> - 2009-06-14 10:01:51
|
Revision: 4461 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4461&view=rev Author: tehlike Date: 2009-06-14 10:01:50 +0000 (Sun, 14 Jun 2009) Log Message: ----------- Fix NH-1837 Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Impl/CriteriaImpl.cs Modified: trunk/nhibernate/src/NHibernate/Impl/CriteriaImpl.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Impl/CriteriaImpl.cs 2009-06-13 22:06:02 UTC (rev 4460) +++ trunk/nhibernate/src/NHibernate/Impl/CriteriaImpl.cs 2009-06-14 10:01:50 UTC (rev 4461) @@ -751,7 +751,7 @@ } else { - return (T) UniqueResult(); + return (T) result; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2009-06-13 22:06:04
|
Revision: 4460 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4460&view=rev Author: fabiomaulo Date: 2009-06-13 22:06:02 +0000 (Sat, 13 Jun 2009) Log Message: ----------- Fix minor bug (method not used inside NH) Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Mapping/Table.cs Modified: trunk/nhibernate/src/NHibernate/Mapping/Table.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Mapping/Table.cs 2009-06-13 21:17:59 UTC (rev 4459) +++ trunk/nhibernate/src/NHibernate/Mapping/Table.cs 2009-06-13 22:06:02 UTC (rev 4460) @@ -551,7 +551,7 @@ public Column GetColumn(int n) { IEnumerator<Column> iter = columns.Values.GetEnumerator(); - for (int i = 0; i < n; i++) + for (int i = 0; i <= n; i++) { iter.MoveNext(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2009-06-13 21:18:00
|
Revision: 4459 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4459&view=rev Author: fabiomaulo Date: 2009-06-13 21:17:59 +0000 (Sat, 13 Jun 2009) Log Message: ----------- Fix NH-1834 Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Cfg/HbmConstants.cs trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/ClassBinder.cs trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj Added Paths: ----------- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1834/ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1834/A.cs trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1834/Fixture.cs trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1834/Mappings.hbm.xml Modified: trunk/nhibernate/src/NHibernate/Cfg/HbmConstants.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Cfg/HbmConstants.cs 2009-06-12 15:34:31 UTC (rev 4458) +++ trunk/nhibernate/src/NHibernate/Cfg/HbmConstants.cs 2009-06-13 21:17:59 UTC (rev 4459) @@ -8,6 +8,7 @@ public const string nsPrefix = "hbm"; public const string nsKey = nsPrefix + ":key"; public const string nsColumn = nsPrefix + ":column"; + public const string nsFormula = nsPrefix + ":formula"; public const string nsOneToMany = nsPrefix + ":one-to-many"; public const string nsParam = nsPrefix + ":param"; public const string nsIndex = nsPrefix + ":index"; Modified: trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/ClassBinder.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/ClassBinder.cs 2009-06-12 15:34:31 UTC (rev 4458) +++ trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/ClassBinder.cs 2009-06-13 21:17:59 UTC (rev 4459) @@ -849,17 +849,30 @@ private void BindColumnsOrFormula(XmlNode node, SimpleValue simpleValue, string path, bool isNullable) { - XmlAttribute formulaNode = node.Attributes["formula"]; - if (formulaNode != null) + var formula = GetFormula(node); + if (formula != null) { - Formula f = new Formula(); - f.FormulaString = formulaNode.InnerText; + var f = new Formula { FormulaString = formula }; simpleValue.AddFormula(f); } else BindColumns(node, simpleValue, isNullable, true, path); } + protected string GetFormula(XmlNode node) + { + XmlAttribute attribute = node.Attributes["formula"]; + if (attribute != null) + { + return attribute.InnerText; + } + else + { + var fcn = node.SelectSingleNode(HbmConstants.nsFormula, namespaceManager); + return fcn != null && !string.IsNullOrEmpty(fcn.InnerText) ? fcn.InnerText : null; + } + } + private void AddManyToOneSecondPass(ManyToOne manyToOne) { mappings.AddSecondPass(delegate(IDictionary<string, PersistentClass> persistentClasses) Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1834/A.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1834/A.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1834/A.cs 2009-06-13 21:17:59 UTC (rev 4459) @@ -0,0 +1,14 @@ +namespace NHibernate.Test.NHSpecificTest.NH1834 +{ + public class A + { + public int Id { get; set; } + } + + public class B + { + public int Id { get; set; } + public A A { get; set; } + public A A2 { get; set; } + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1834/Fixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1834/Fixture.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1834/Fixture.cs 2009-06-13 21:17:59 UTC (rev 4459) @@ -0,0 +1,49 @@ +using NUnit.Framework; + +namespace NHibernate.Test.NHSpecificTest.NH1834 +{ + [TestFixture] + public class Fixture : BugTestCase + { + protected override void OnSetUp() + { + base.OnSetUp(); + var a = new A {Id = 1}; + var a2 = new A {Id = 2}; + var b = new B {Id = 1}; + + using (ISession session = base.OpenSession()) + { + session.Save(a); + session.Save(a2); + session.Save(b); + session.Flush(); + } + } + + protected override void OnTearDown() + { + base.OnTearDown(); + using (ISession session = base.OpenSession()) + { + session.Delete("from B"); + session.Delete("from A"); + session.Flush(); + } + } + + [Test] + public void OneToManyPropertyWithFormulaNodeShouldWorkLikeFormulaAttrib() + { + using (ISession session = base.OpenSession()) + { + session.Clear(); + + var b = session.Get<B>(1); + Assert.IsNotNull(b.A2); + Assert.IsNotNull(b.A); + Assert.That(b.A.Id == b.A2.Id); + } + } + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1834/Mappings.hbm.xml =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1834/Mappings.hbm.xml (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1834/Mappings.hbm.xml 2009-06-13 21:17:59 UTC (rev 4459) @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8" ?> +<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="NHibernate.Test" + namespace="NHibernate.Test.NHSpecificTest.NH1834" + default-lazy="false"> + + + + <class name="A"> + <id name="Id" type="Int32"> + <generator class="assigned" /> + </id> + </class> + + <class name="B"> + <id name="Id" type="Int32"> + <generator class="assigned" /> + </id> + + <!--formula attrib should work like formula node--> + <many-to-one name="A" class="A" insert="false" update="false"> + <formula><![CDATA[(select max(A.Id) from A)]]></formula> + </many-to-one> + + <many-to-one name="A2" class="A" insert="false" update="false" formula="(select max(A.Id) from A)"/> + + </class> +</hibernate-mapping> \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-06-12 15:34:31 UTC (rev 4458) +++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-06-13 21:17:59 UTC (rev 4459) @@ -503,6 +503,8 @@ <Compile Include="NHSpecificTest\NH1813\Fixture.cs" /> <Compile Include="NHSpecificTest\NH1821\Entity.cs" /> <Compile Include="NHSpecificTest\NH1821\Fixture.cs" /> + <Compile Include="NHSpecificTest\NH1834\A.cs" /> + <Compile Include="NHSpecificTest\NH1834\Fixture.cs" /> <Compile Include="NHSpecificTest\NH645\HQLFunctionFixture.cs" /> <Compile Include="HQL\HQLFunctions.cs" /> <Compile Include="HQL\Human.cs" /> @@ -1903,6 +1905,7 @@ <EmbeddedResource Include="Classic\EntityWithLifecycle.hbm.xml" /> <EmbeddedResource Include="Bytecode\Lightweight\ProductLine.hbm.xml" /> <Content Include="DynamicEntity\package.html" /> + <EmbeddedResource Include="NHSpecificTest\NH1834\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1821\Mappings.hbm.xml" /> <EmbeddedResource Include="TypeParameters\EntityCustomId.hbm.xml" /> <EmbeddedResource Include="Tools\hbm2ddl\SchemaMetadataUpdaterTest\HeavyEntity.hbm.xml" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2009-06-12 15:34:45
|
Revision: 4458 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4458&view=rev Author: fabiomaulo Date: 2009-06-12 15:34:31 +0000 (Fri, 12 Jun 2009) Log Message: ----------- Fix NH-1623 Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Bytecode/AbstractBytecodeProvider.cs trunk/nhibernate/src/NHibernate/Cfg/Configuration.cs trunk/nhibernate/src/NHibernate/Cfg/Environment.cs trunk/nhibernate/src/NHibernate/NHibernate.csproj trunk/nhibernate/src/NHibernate/nhibernate-configuration.xsd trunk/nhibernate/src/NHibernate.Test/Bytecode/Lightweight/BytecodeProviderFixture.cs trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj Added Paths: ----------- trunk/nhibernate/src/NHibernate/Bytecode/IInjectableCollectionTypeFactoryClass.cs trunk/nhibernate/src/NHibernate.Test/Bytecode/Lightweight/ProductLine.hbm.xml Modified: trunk/nhibernate/src/NHibernate/Bytecode/AbstractBytecodeProvider.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Bytecode/AbstractBytecodeProvider.cs 2009-06-11 21:49:52 UTC (rev 4457) +++ trunk/nhibernate/src/NHibernate/Bytecode/AbstractBytecodeProvider.cs 2009-06-12 15:34:31 UTC (rev 4458) @@ -4,11 +4,12 @@ namespace NHibernate.Bytecode { - public abstract class AbstractBytecodeProvider : IBytecodeProvider, IInjectableProxyFactoryFactory + public abstract class AbstractBytecodeProvider : IBytecodeProvider, IInjectableProxyFactoryFactory, IInjectableCollectionTypeFactoryClass { private readonly IObjectsFactory objectsFactory = new ActivatorObjectsFactory(); protected System.Type proxyFactoryFactory; private ICollectionTypeFactory collectionTypeFactory; + private System.Type collectionTypeFactoryClass = typeof(Type.DefaultCollectionTypeFactory); #region IBytecodeProvider Members @@ -39,7 +40,7 @@ get { return objectsFactory; } } - public ICollectionTypeFactory CollectionTypeFactory + public virtual ICollectionTypeFactory CollectionTypeFactory { get { @@ -48,7 +49,7 @@ try { collectionTypeFactory = - (ICollectionTypeFactory) ObjectsFactory.CreateInstance(typeof (Type.DefaultCollectionTypeFactory)); + (ICollectionTypeFactory) ObjectsFactory.CreateInstance(collectionTypeFactoryClass); } catch (Exception e) { @@ -57,14 +58,6 @@ } return collectionTypeFactory; } - protected set - { - if(value == null) - { - throw new InvalidOperationException("The CollectionTypeFactory can't be null."); - } - collectionTypeFactory = value; - } } #endregion @@ -92,5 +85,36 @@ } #endregion + + #region Implementation of IInjectableCollectionTypeFactoryClass + + public void SetCollectionTypeFactoryClass(string typeAssemblyQualifiedName) + { + if (string.IsNullOrEmpty(typeAssemblyQualifiedName)) + { + throw new ArgumentNullException("typeAssemblyQualifiedName"); + } + System.Type ctf= ReflectHelper.ClassForName(typeAssemblyQualifiedName); + SetCollectionTypeFactoryClass(ctf); + } + + public void SetCollectionTypeFactoryClass(System.Type type) + { + if (type == null) + { + throw new ArgumentNullException("type"); + } + if (typeof(ICollectionTypeFactory).IsAssignableFrom(type) == false) + { + throw new HibernateByteCodeException(type.FullName + " does not implement " + typeof(ICollectionTypeFactory).FullName); + } + if (collectionTypeFactory != null) + { + throw new InvalidOperationException("CollectionTypeFactory in use, can't change it."); + } + collectionTypeFactoryClass = type; + } + + #endregion } } \ No newline at end of file Added: trunk/nhibernate/src/NHibernate/Bytecode/IInjectableCollectionTypeFactoryClass.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Bytecode/IInjectableCollectionTypeFactoryClass.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/Bytecode/IInjectableCollectionTypeFactoryClass.cs 2009-06-12 15:34:31 UTC (rev 4458) @@ -0,0 +1,8 @@ +namespace NHibernate.Bytecode +{ + public interface IInjectableCollectionTypeFactoryClass + { + void SetCollectionTypeFactoryClass(string typeAssemblyQualifiedName); + void SetCollectionTypeFactoryClass(System.Type type); + } +} \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate/Cfg/Configuration.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Cfg/Configuration.cs 2009-06-11 21:49:52 UTC (rev 4457) +++ trunk/nhibernate/src/NHibernate/Cfg/Configuration.cs 2009-06-12 15:34:31 UTC (rev 4458) @@ -55,6 +55,7 @@ public const string DefaultHibernateCfgFileName = "hibernate.cfg.xml"; private string currentDocumentName; + private bool preMappingBuildProcessed; protected IDictionary<string, PersistentClass> classes; // entityName, PersistentClass protected IDictionary<string, NHibernate.Mapping.Collection> collections; @@ -523,12 +524,38 @@ /// </summary> public Mappings CreateMappings(Dialect.Dialect dialect) { + ProcessPreMappingBuildProperties(); return new Mappings(classes, collections, tables, NamedQueries, NamedSQLQueries, SqlResultSetMappings, Imports, secondPasses, propertyReferences, namingStrategy, typeDefs, FilterDefinitions, extendsQueue, auxiliaryDatabaseObjects, tableNameBinding, columnNameBindingPerTable, defaultAssembly, defaultNamespace, dialect); } + private void ProcessPreMappingBuildProperties() + { + if(preMappingBuildProcessed) + { + return; + } + ConfigureCollectionTypeFactory(); + preMappingBuildProcessed = true; + } + + private void ConfigureCollectionTypeFactory() + { + var ctfc = GetProperty(Environment.CollectionTypeFactoryClass); + if(string.IsNullOrEmpty(ctfc)) + { + return; + } + var ictfc = Environment.BytecodeProvider as IInjectableCollectionTypeFactoryClass; + if(ictfc == null) + { + return; + } + ictfc.SetCollectionTypeFactoryClass(ctfc); + } + /// <summary> /// Read mappings from a <see cref="Stream" />. /// </summary> Modified: trunk/nhibernate/src/NHibernate/Cfg/Environment.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Cfg/Environment.cs 2009-06-11 21:49:52 UTC (rev 4457) +++ trunk/nhibernate/src/NHibernate/Cfg/Environment.cs 2009-06-12 15:34:31 UTC (rev 4458) @@ -158,6 +158,8 @@ public const string DefaultBatchFetchSize = "default_batch_fetch_size"; + public const string CollectionTypeFactoryClass = "collectiontype.factory_class"; + private static readonly Dictionary<string, string> GlobalProperties; private static IBytecodeProvider BytecodeProviderInstance; Modified: trunk/nhibernate/src/NHibernate/NHibernate.csproj =================================================================== --- trunk/nhibernate/src/NHibernate/NHibernate.csproj 2009-06-11 21:49:52 UTC (rev 4457) +++ trunk/nhibernate/src/NHibernate/NHibernate.csproj 2009-06-12 15:34:31 UTC (rev 4458) @@ -451,6 +451,7 @@ <Compile Include="Bytecode\AbstractBytecodeProvider.cs" /> <Compile Include="Bytecode\ActivatorObjectsFactory.cs" /> <Compile Include="Bytecode\HibernateByteCodeException.cs" /> + <Compile Include="Bytecode\IInjectableCollectionTypeFactoryClass.cs" /> <Compile Include="Bytecode\IObjectsFactory.cs" /> <Compile Include="Bytecode\ProxyFactoryFactoryNotConfiguredException.cs" /> <Compile Include="Bytecode\UnableToLoadProxyFactoryFactoryException.cs" /> Modified: trunk/nhibernate/src/NHibernate/nhibernate-configuration.xsd =================================================================== --- trunk/nhibernate/src/NHibernate/nhibernate-configuration.xsd 2009-06-11 21:49:52 UTC (rev 4457) +++ trunk/nhibernate/src/NHibernate/nhibernate-configuration.xsd 2009-06-12 15:34:31 UTC (rev 4458) @@ -102,6 +102,7 @@ <xs:enumeration value="default_entity_mode" /> <xs:enumeration value="use_sql_comments" /> <xs:enumeration value="format_sql" /> + <xs:enumeration value="collectiontype.factory_class" /> </xs:restriction> </xs:simpleType> </xs:attribute> Modified: trunk/nhibernate/src/NHibernate.Test/Bytecode/Lightweight/BytecodeProviderFixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/Bytecode/Lightweight/BytecodeProviderFixture.cs 2009-06-11 21:49:52 UTC (rev 4457) +++ trunk/nhibernate/src/NHibernate.Test/Bytecode/Lightweight/BytecodeProviderFixture.cs 2009-06-12 15:34:31 UTC (rev 4458) @@ -1,6 +1,8 @@ +using System; using NHibernate.Bytecode; using NHibernate.Bytecode.Lightweight; using NUnit.Framework; +using Environment=NHibernate.Cfg.Environment; namespace NHibernate.Test.Bytecode.Lightweight { @@ -71,5 +73,85 @@ Assert.That(e.Message,Text.StartsWith("Failed to create an instance of")); } } + + [Test] + public void NotConfiguredCollectionTypeFactory() + { + // our BytecodeProvider should ever have a CollectionTypeFactory + var bcp = new BytecodeProviderImpl(); + Assert.That(bcp.CollectionTypeFactory, Is.Not.Null); + } + + [Test] + public void SetCollectionTypeFactoryClassByName() + { + string nullName = null; + var bcp = new BytecodeProviderImpl(); + + Assert.Throws<ArgumentNullException>(() => bcp.SetCollectionTypeFactoryClass(nullName)); + Assert.Throws<ArgumentNullException>(() => bcp.SetCollectionTypeFactoryClass(string.Empty)); + Assert.Throws<TypeLoadException>(() => bcp.SetCollectionTypeFactoryClass("whatever")); + } + + [Test] + public void SetCollectionTypeFactoryClassByType() + { + System.Type nullType = null; + var bcp = new BytecodeProviderImpl(); + Assert.Throws<ArgumentNullException>(() => bcp.SetCollectionTypeFactoryClass(nullType)); + Assert.Throws<HibernateByteCodeException>(() => bcp.SetCollectionTypeFactoryClass(GetType()), "should allow only ICollectionTypeFactory type"); + } + + private class NoDefaultCtor: Type.DefaultCollectionTypeFactory + { + public NoDefaultCtor(int something) {} + } + + [Test] + public void InvalidCollectionTypeFactoryCtor() + { + ICollectionTypeFactory ctf; + var bcp = new BytecodeProviderImpl(); + bcp.SetCollectionTypeFactoryClass(typeof (NoDefaultCtor)); + Assert.Throws<HibernateByteCodeException>(() => ctf = bcp.CollectionTypeFactory); + } + + [Test] + public void CollectionTypeFactoryCantChangeAfterUsage() + { + ICollectionTypeFactory ctf; + var bcp = new BytecodeProviderImpl(); + ctf = bcp.CollectionTypeFactory; // initialize the instance + // try to set it + Assert.Throws<InvalidOperationException>(() => bcp.SetCollectionTypeFactoryClass(typeof(Type.DefaultCollectionTypeFactory))); + } + + private class CustomCollectionTypeFactory : Type.DefaultCollectionTypeFactory + { + } + + [Test] + [Explicit("The BytecodeProvider is static and can't be different in the same application.")] + public void AllowCustomCollectionTypeFactoryBeforeBuildFirstMapping() + { + // Allow set of CustomCollectionTypeFactory class after configure BUT before add the first mapping. + // for real we need CustomCollectionTypeFactory before BuildSessionFactory but for possible future + // "mapping-sources" is better to limitate the moment of injectability. + var cfg = TestConfigurationHelper.GetDefaultConfiguration(); + cfg.SetProperty(Environment.CollectionTypeFactoryClass, typeof(CustomCollectionTypeFactory).AssemblyQualifiedName); + Dialect.Dialect dialect = Dialect.Dialect.GetDialect(cfg.Properties); + cfg.CreateMappings(dialect); + Assert.That(Environment.BytecodeProvider.CollectionTypeFactory, Is.TypeOf<CustomCollectionTypeFactory>()); + } + + [Test] + [Explicit("The BytecodeProvider is static and can't be different in the same application.")] + public void WorkAddingMappings() + { + var cfg = TestConfigurationHelper.GetDefaultConfiguration(); + cfg.SetProperty(Environment.CollectionTypeFactoryClass, typeof(CustomCollectionTypeFactory).AssemblyQualifiedName); + cfg.AddResource("NHibernate.Test.Bytecode.Lightweight.ProductLine.hbm.xml", GetType().Assembly); + Assert.That(Environment.BytecodeProvider.CollectionTypeFactory, Is.TypeOf<CustomCollectionTypeFactory>()); + } } } \ No newline at end of file Added: trunk/nhibernate/src/NHibernate.Test/Bytecode/Lightweight/ProductLine.hbm.xml =================================================================== --- trunk/nhibernate/src/NHibernate.Test/Bytecode/Lightweight/ProductLine.hbm.xml (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/Bytecode/Lightweight/ProductLine.hbm.xml 2009-06-12 15:34:31 UTC (rev 4458) @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8" ?> + +<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"> + + <class entity-name="ProductLine"> + <id name="Id" type="int"> + <generator class="hilo"/> + </id> + <property name="Description" not-null="true" length="200" type="string"/> + + <bag name="Models" cascade="all" inverse="true"> + <key column="productId"/> + <one-to-many class="Model"/> + </bag> + + </class> + + <class entity-name="Model"> + <id name="Id" type="int"> + <generator class="hilo"/> + </id> + + <property name="Name" not-null="true" length="25" type="string"/> + <property name="Description" not-null="true" length="200" type="string"/> + <many-to-one name="ProductLine" column="productId" not-null="true" class="ProductLine"/> + </class> + +</hibernate-mapping> Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-06-11 21:49:52 UTC (rev 4457) +++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-06-12 15:34:31 UTC (rev 4458) @@ -1901,6 +1901,7 @@ <EmbeddedResource Include="Ado\AlmostSimple.hbm.xml" /> <EmbeddedResource Include="CacheTest\EntityWithFilters.xml" /> <EmbeddedResource Include="Classic\EntityWithLifecycle.hbm.xml" /> + <EmbeddedResource Include="Bytecode\Lightweight\ProductLine.hbm.xml" /> <Content Include="DynamicEntity\package.html" /> <EmbeddedResource Include="NHSpecificTest\NH1821\Mappings.hbm.xml" /> <EmbeddedResource Include="TypeParameters\EntityCustomId.hbm.xml" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2009-06-11 21:49:58
|
Revision: 4457 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4457&view=rev Author: fabiomaulo Date: 2009-06-11 21:49:52 +0000 (Thu, 11 Jun 2009) Log Message: ----------- One more step for injectable ICollectionTypeFactory Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Bytecode/AbstractBytecodeProvider.cs trunk/nhibernate/src/NHibernate/Bytecode/IBytecodeProvider.cs trunk/nhibernate/src/NHibernate/Bytecode/IObjectsFactory.cs trunk/nhibernate/src/NHibernate/NHibernate.csproj trunk/nhibernate/src/NHibernate/Type/TypeFactory.cs Added Paths: ----------- trunk/nhibernate/src/NHibernate/Bytecode/ICollectionTypeFactory.cs trunk/nhibernate/src/NHibernate/Type/DefaultCollectionTypeFactory.cs Removed Paths: ------------- trunk/nhibernate/src/NHibernate/Type/CollectionTypeFactory.cs trunk/nhibernate/src/NHibernate/Type/ICollectionTypeFactory.cs Modified: trunk/nhibernate/src/NHibernate/Bytecode/AbstractBytecodeProvider.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Bytecode/AbstractBytecodeProvider.cs 2009-06-11 19:17:20 UTC (rev 4456) +++ trunk/nhibernate/src/NHibernate/Bytecode/AbstractBytecodeProvider.cs 2009-06-11 21:49:52 UTC (rev 4457) @@ -8,6 +8,7 @@ { private readonly IObjectsFactory objectsFactory = new ActivatorObjectsFactory(); protected System.Type proxyFactoryFactory; + private ICollectionTypeFactory collectionTypeFactory; #region IBytecodeProvider Members @@ -38,6 +39,34 @@ get { return objectsFactory; } } + public ICollectionTypeFactory CollectionTypeFactory + { + get + { + if (collectionTypeFactory == null) + { + try + { + collectionTypeFactory = + (ICollectionTypeFactory) ObjectsFactory.CreateInstance(typeof (Type.DefaultCollectionTypeFactory)); + } + catch (Exception e) + { + throw new HibernateByteCodeException("Failed to create an instance of CollectionTypeFactory!", e); + } + } + return collectionTypeFactory; + } + protected set + { + if(value == null) + { + throw new InvalidOperationException("The CollectionTypeFactory can't be null."); + } + collectionTypeFactory = value; + } + } + #endregion #region IInjectableProxyFactoryFactory Members Modified: trunk/nhibernate/src/NHibernate/Bytecode/IBytecodeProvider.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Bytecode/IBytecodeProvider.cs 2009-06-11 19:17:20 UTC (rev 4456) +++ trunk/nhibernate/src/NHibernate/Bytecode/IBytecodeProvider.cs 2009-06-11 21:49:52 UTC (rev 4457) @@ -20,8 +20,19 @@ /// <returns>The reflection optimization delegate.</returns> IReflectionOptimizer GetReflectionOptimizer(System.Type clazz, IGetter[] getters, ISetter[] setters); + /// <summary> + /// NHibernate's object instaciator. + /// </summary> + /// <remarks> + /// For entities <see cref="IReflectionOptimizer"/> and its implementations. + /// </remarks> IObjectsFactory ObjectsFactory { get; } + /// <summary> + /// Instanciator of NHibernate's collections default types. + /// </summary> + ICollectionTypeFactory CollectionTypeFactory { get; } + // <summary> Generate a ClassTransformer capable of performing bytecode manipulation. </summary> // <param name="classFilter"> // filter used to limit which classes are to be instrumented via this ClassTransformer. Copied: trunk/nhibernate/src/NHibernate/Bytecode/ICollectionTypeFactory.cs (from rev 4455, trunk/nhibernate/src/NHibernate/Type/ICollectionTypeFactory.cs) =================================================================== --- trunk/nhibernate/src/NHibernate/Bytecode/ICollectionTypeFactory.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/Bytecode/ICollectionTypeFactory.cs 2009-06-11 21:49:52 UTC (rev 4457) @@ -0,0 +1,250 @@ +using System.Collections; +using System.Collections.Generic; +using NHibernate.Type; + +namespace NHibernate.Bytecode +{ + /// <summary> + /// Type factory for collections types. + /// </summary> + public interface ICollectionTypeFactory + { + /// <summary> + /// Creates a new <see cref="CollectionType"/> for an <see cref="System.Array"/>. + /// </summary> + /// <param name="role">The role the collection is in.</param> + /// <param name="propertyRef">The name of the property in the + /// owner object containing the collection ID, or <see langword="null" /> if it is + /// the primary key.</param> + /// <param name="elementClass">The <see cref="System.Type"/> to use to create the array.</param> + /// <param name="embedded">Is embedded in XML (not supported yet)</param> + /// <returns> + /// An <see cref="ArrayType"/> for the specified role. + /// </returns> + CollectionType Array(string role, string propertyRef, bool embedded, System.Type elementClass); + + /// <summary> + /// Creates a new <see cref="CollectionType"/> for an <see cref="IList"/> + /// with bag semantics. + /// </summary> + /// <param name="role">The role the collection is in.</param> + /// <param name="propertyRef">The name of the property in the + /// owner object containing the collection ID, or <see langword="null" /> if it is + /// the primary key.</param> + /// <param name="embedded">Is embedded in XML (not supported yet)</param> + /// <returns> + /// A <see cref="BagType"/> for the specified role. + /// </returns> + CollectionType Bag(string role, string propertyRef, bool embedded); + + /// <summary> + /// Creates a new <see cref="CollectionType"/> for an + /// <see cref="System.Collections.Generic.IList{T}"/> with bag semantics. + /// </summary> + /// <typeparam name="T">The type of elements in the list.</typeparam> + /// <param name="role">The role the collection is in.</param> + /// <param name="propertyRef"> + /// The name of the property in the owner object containing the collection ID, + /// or <see langword="null" /> if it is the primary key. + /// </param> + /// <param name="embedded">Is embedded in XML (not supported yet)</param> + /// <returns> + /// A <see cref="GenericBagType{T}"/> for the specified role. + /// </returns> + CollectionType Bag<T>(string role, string propertyRef, bool embedded); + + /// <summary> + /// Creates a new <see cref="CollectionType"/> for an <see cref="IList"/>. + /// </summary> + /// <param name="role">The role the collection is in.</param> + /// <param name="propertyRef">The name of the property in the + /// owner object containing the collection ID, or <see langword="null" /> if it is + /// the primary key.</param> + /// <param name="embedded">Is embedded in XML (not supported yet)</param> + /// <returns> + /// A <see cref="ListType"/> for the specified role. + /// </returns> + CollectionType List(string role, string propertyRef, bool embedded); + + /// <summary> + /// Creates a new <see cref="CollectionType"/> for an + /// <see cref="System.Collections.Generic.IList<T>"/> with list + /// semantics. + /// </summary> + /// <typeparam name="T">The type of elements in the list.</typeparam> + /// <param name="role">The role the collection is in.</param> + /// <param name="propertyRef"> + /// The name of the property in the + /// owner object containing the collection ID, or <see langword="null" /> if it is + /// the primary key. + /// </param> + /// <param name="embedded">Is embedded in XML (not supported yet)</param> + /// <returns> + /// A <see cref="ListType"/> for the specified role. + /// </returns> + CollectionType List<T>(string role, string propertyRef, bool embedded); + + /// <summary> + /// Creates a new <see cref="CollectionType"/> for an <see cref="IList"/> + /// with id-bag semantics. + /// </summary> + /// <param name="role">The role the collection is in.</param> + /// <param name="propertyRef">The name of the property in the + /// owner object containing the collection ID, or <see langword="null" /> if it is + /// the primary key.</param> + /// <param name="embedded">Is embedded in XML (not supported yet)</param> + /// <returns> + /// A <see cref="IdentifierBagType"/> for the specified role. + /// </returns> + CollectionType IdBag(string role, string propertyRef, bool embedded); + + /// <summary> + /// Creates a new <see cref="CollectionType"/> for an + /// <see cref="System.Collections.Generic.IList{T}"/> with identifier + /// bag semantics. + /// </summary> + /// <typeparam name="T">The type of elements in the list.</typeparam> + /// <param name="role">The role the collection is in.</param> + /// <param name="propertyRef">The name of the property in the + /// owner object containing the collection ID, or <see langword="null" /> if it is + /// the primary key. + /// </param> + /// <param name="embedded">Is embedded in XML (not supported yet)</param> + /// <returns> + /// A <see cref="GenericIdentifierBagType{T}"/> for the specified role. + /// </returns> + CollectionType IdBag<T>(string role, string propertyRef, bool embedded); + + /// <summary> + /// Creates a new <see cref="CollectionType"/> for an <see cref="Iesi.Collections.ISet"/>. + /// </summary> + /// <param name="role">The role the collection is in.</param> + /// <param name="propertyRef">The name of the property in the + /// owner object containing the collection ID, or <see langword="null" /> if it is + /// the primary key.</param> + /// <param name="embedded">Is embedded in XML (not supported yet)</param> + /// <returns> + /// A <see cref="SetType"/> for the specified role. + /// </returns> + CollectionType Set(string role, string propertyRef, bool embedded); + + CollectionType OrderedSet(string role, string propertyRef, bool embedded); + + /// <summary> + /// Creates a new <see cref="CollectionType"/> for an <see cref="Iesi.Collections.ISet"/> + /// that is sorted by an <see cref="IComparer"/>. + /// </summary> + /// <param name="role">The role the collection is in.</param> + /// <param name="propertyRef">The name of the property in the + /// owner object containing the collection ID, or <see langword="null" /> if it is + /// the primary key.</param> + /// <param name="comparer">The <see cref="IComparer"/> that does the sorting.</param> + /// <param name="embedded">Is embedded in XML (not supported yet)</param> + /// <returns> + /// A <see cref="SortedSetType"/> for the specified role. + /// </returns> + CollectionType SortedSet(string role, string propertyRef, bool embedded, IComparer comparer); + + /// <summary> + /// Creates a new <see cref="CollectionType"/> for an <see cref="Iesi.Collections.Generic.ISet{T}" />. + /// </summary> + /// <typeparam name="T">The type of elements in the collection.</typeparam> + /// <param name="role">The role the collection is in.</param> + /// <param name="propertyRef">The name of the property in the + /// owner object containing the collection ID, or <see langword="null" /> if it is + /// the primary key.</param> + /// <param name="embedded">Is embedded in XML (not supported yet)</param> + /// <returns>A <see cref="GenericSetType{T}" /> for the specified role.</returns> + CollectionType Set<T>(string role, string propertyRef, bool embedded); + + /// <summary> + /// Creates a new <see cref="CollectionType"/> for a sorted <see cref="Iesi.Collections.Generic.ISet{T}" />. + /// </summary> + /// <typeparam name="T">The type of elements in the collection.</typeparam> + /// <param name="role">The role the collection is in.</param> + /// <param name="propertyRef">The name of the property in the + /// owner object containing the collection ID, or <see langword="null" /> if it is + /// the primary key.</param> + /// <param name="embedded">Is embedded in XML (not supported yet)</param> + /// <param name="comparer">The <see cref="System.Collections.Generic.IComparer{T}" /> to use for the set.</param> + /// <returns>A <see cref="GenericSetType{T}" /> for the specified role.</returns> + CollectionType SortedSet<T>(string role, string propertyRef, bool embedded, IComparer<T> comparer); + + /// <summary> + /// Creates a new <see cref="CollectionType"/> for an ordered <see cref="Iesi.Collections.Generic.ISet{T}" />. + /// </summary> + /// <typeparam name="T">The type of elements in the collection.</typeparam> + /// <param name="role">The role the collection is in.</param> + /// <param name="propertyRef"> + /// The name of the property in the owner object containing the collection ID, + /// or <see langword="null" /> if it is the primary key. + /// </param> + /// <param name="embedded">Is embedded in XML (not supported yet)</param> + /// <returns>A <see cref="GenericSetType{T}" /> for the specified role.</returns> + CollectionType OrderedSet<T>(string role, string propertyRef, bool embedded); + + /// <summary> + /// Creates a new <see cref="CollectionType"/> for an <see cref="IDictionary"/>. + /// </summary> + /// <param name="role">The role the collection is in.</param> + /// <param name="propertyRef"> + /// The name of the property in the + /// owner object containing the collection ID, or <see langword="null" /> if it is + /// the primary key.</param> + /// <param name="embedded">Is embedded in XML (not supported yet)</param> + /// <returns> + /// A <see cref="MapType"/> for the specified role. + /// </returns> + CollectionType Map(string role, string propertyRef, bool embedded); + + /// <summary> + /// Creates a new <see cref="CollectionType"/> for an <see cref="IDictionary"/> + /// that maintains insertion order of elements. + /// </summary> + /// <param name="role">The role the collection is in.</param> + /// <param name="propertyRef">The name of the property in the + /// owner object containing the collection ID, or <see langword="null" /> if it is + /// the primary key.</param> + /// <param name="embedded">Is embedded in XML (not supported yet)</param> + /// <returns> + /// A <see cref="OrderedMapType"/> for the specified role. + /// </returns> + CollectionType OrderedMap(string role, string propertyRef, bool embedded); + + /// <summary> + /// Creates a new <see cref="CollectionType"/> for an <see cref="IDictionary"/> + /// that is sorted by an <see cref="IComparer"/>. + /// </summary> + /// <param name="role">The role the collection is in.</param> + /// <param name="propertyRef">The name of the property in the + /// owner object containing the collection ID, or <see langword="null" /> if it is + /// the primary key.</param> + /// <param name="comparer">The <see cref="IComparer"/> that does the sorting.</param> + /// <param name="embedded">Is embedded in XML (not supported yet)</param> + /// <returns> + /// A <see cref="SortedMapType"/> for the specified role. + /// </returns> + CollectionType SortedMap(string role, string propertyRef, bool embedded, IComparer comparer); + + /// <summary> + /// Creates a new <see cref="CollectionType"/> for an + /// <see cref="System.Collections.Generic.IDictionary<TKey,TValue>"/>. + /// </summary> + /// <typeparam name="TKey">The type of keys in the dictionary.</typeparam> + /// <typeparam name="TValue">The type of values in the dictionary.</typeparam> + /// <param name="role">The role the collection is in.</param> + /// <param name="propertyRef">The name of the property in the + /// owner object containing the collection ID, or <see langword="null" /> if it is + /// the primary key.< + /// /param> + /// <param name="embedded">Is embedded in XML (not supported yet)</param> + /// <returns> + /// A <see cref="MapType"/> for the specified role. + /// </returns> + CollectionType Map<TKey, TValue>(string role, string propertyRef, bool embedded); + + + CollectionType SortedDictionary<TKey, TValue>(string role, string propertyRef, bool embedded, IComparer<TKey> comparer); + CollectionType SortedList<TKey, TValue>(string role, string propertyRef, bool embedded, IComparer<TKey> comparer); + } +} \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate/Bytecode/IObjectsFactory.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Bytecode/IObjectsFactory.cs 2009-06-11 19:17:20 UTC (rev 4456) +++ trunk/nhibernate/src/NHibernate/Bytecode/IObjectsFactory.cs 2009-06-11 21:49:52 UTC (rev 4457) @@ -1,5 +1,8 @@ namespace NHibernate.Bytecode { + /// <summary> + /// Interface for instanciate all NHibernate objects. + /// </summary> public interface IObjectsFactory { /// <summary> Modified: trunk/nhibernate/src/NHibernate/NHibernate.csproj =================================================================== --- trunk/nhibernate/src/NHibernate/NHibernate.csproj 2009-06-11 19:17:20 UTC (rev 4456) +++ trunk/nhibernate/src/NHibernate/NHibernate.csproj 2009-06-11 21:49:52 UTC (rev 4457) @@ -603,8 +603,8 @@ <Compile Include="Tool\hbm2ddl\SchemaMetadataUpdater.cs" /> <Compile Include="Transaction\AdoNetWithDistrubtedTransactionFactory.cs" /> <Compile Include="Transform\ToListResultTransformer.cs" /> - <Compile Include="Type\CollectionTypeFactory.cs" /> - <Compile Include="Type\ICollectionTypeFactory.cs" /> + <Compile Include="Type\DefaultCollectionTypeFactory.cs" /> + <Compile Include="Bytecode\ICollectionTypeFactory.cs" /> <Compile Include="Util\NullableDictionary.cs" /> <Compile Include="Hql\Ast\ANTLR\Util\PathHelper.cs" /> <Compile Include="Hql\Ast\ANTLR\Util\SyntheticAndFactory.cs" /> Deleted: trunk/nhibernate/src/NHibernate/Type/CollectionTypeFactory.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Type/CollectionTypeFactory.cs 2009-06-11 19:17:20 UTC (rev 4456) +++ trunk/nhibernate/src/NHibernate/Type/CollectionTypeFactory.cs 2009-06-11 21:49:52 UTC (rev 4457) @@ -1,103 +0,0 @@ -using System.Collections; -using System.Collections.Generic; - -namespace NHibernate.Type -{ - public class CollectionTypeFactory : ICollectionTypeFactory - { - public virtual CollectionType Array(string role, string propertyRef, bool embedded, System.Type elementClass) - { - return new ArrayType(role, propertyRef, elementClass, embedded); - } - - public virtual CollectionType Bag(string role, string propertyRef, bool embedded) - { - return new BagType(role, propertyRef, embedded); - } - - public virtual CollectionType Bag<T>(string role, string propertyRef, bool embedded) - { - return new GenericBagType<T>(role, propertyRef); - } - - public virtual CollectionType List(string role, string propertyRef, bool embedded) - { - return new ListType(role, propertyRef, embedded); - } - - public virtual CollectionType List<T>(string role, string propertyRef, bool embedded) - { - return new GenericListType<T>(role, propertyRef); - } - - public virtual CollectionType IdBag(string role, string propertyRef, bool embedded) - { - return new IdentifierBagType(role, propertyRef, embedded); - } - - public virtual CollectionType IdBag<T>(string role, string propertyRef, bool embedded) - { - return new GenericIdentifierBagType<T>(role, propertyRef); - } - - public virtual CollectionType Set(string role, string propertyRef, bool embedded) - { - return new SetType(role, propertyRef, embedded); - } - - public virtual CollectionType OrderedSet(string role, string propertyRef, bool embedded) - { - return new OrderedSetType(role, propertyRef, embedded); - } - - public virtual CollectionType SortedSet(string role, string propertyRef, bool embedded, IComparer comparer) - { - return new SortedSetType(role, propertyRef, comparer, embedded); - } - - public virtual CollectionType Set<T>(string role, string propertyRef, bool embedded) - { - return new GenericSetType<T>(role, propertyRef); - } - - public virtual CollectionType SortedSet<T>(string role, string propertyRef, bool embedded, IComparer<T> comparer) - { - return new GenericSortedSetType<T>(role, propertyRef, comparer); - } - - public virtual CollectionType OrderedSet<T>(string role, string propertyRef, bool embedded) - { - return new GenericOrderedSetType<T>(role, propertyRef); - } - - public virtual CollectionType Map(string role, string propertyRef, bool embedded) - { - return new MapType(role, propertyRef, embedded); - } - - public virtual CollectionType OrderedMap(string role, string propertyRef, bool embedded) - { - return new OrderedMapType(role, propertyRef, embedded); - } - - public virtual CollectionType SortedMap(string role, string propertyRef, bool embedded, IComparer comparer) - { - return new SortedMapType(role, propertyRef, comparer, embedded); - } - - public virtual CollectionType Map<TKey, TValue>(string role, string propertyRef, bool embedded) - { - return new GenericMapType<TKey, TValue>(role, propertyRef); - } - - public virtual CollectionType SortedDictionary<TKey, TValue>(string role, string propertyRef, bool embedded, IComparer<TKey> comparer) - { - return new GenericSortedDictionaryType<TKey, TValue>(role, propertyRef, comparer); - } - - public virtual CollectionType SortedList<TKey, TValue>(string role, string propertyRef, bool embedded, IComparer<TKey> comparer) - { - return new GenericSortedListType<TKey, TValue>(role, propertyRef, comparer); - } - } -} \ No newline at end of file Copied: trunk/nhibernate/src/NHibernate/Type/DefaultCollectionTypeFactory.cs (from rev 4455, trunk/nhibernate/src/NHibernate/Type/CollectionTypeFactory.cs) =================================================================== --- trunk/nhibernate/src/NHibernate/Type/DefaultCollectionTypeFactory.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/Type/DefaultCollectionTypeFactory.cs 2009-06-11 21:49:52 UTC (rev 4457) @@ -0,0 +1,104 @@ +using System.Collections; +using System.Collections.Generic; +using NHibernate.Bytecode; + +namespace NHibernate.Type +{ + public class DefaultCollectionTypeFactory : ICollectionTypeFactory + { + public virtual CollectionType Array(string role, string propertyRef, bool embedded, System.Type elementClass) + { + return new ArrayType(role, propertyRef, elementClass, embedded); + } + + public virtual CollectionType Bag(string role, string propertyRef, bool embedded) + { + return new BagType(role, propertyRef, embedded); + } + + public virtual CollectionType Bag<T>(string role, string propertyRef, bool embedded) + { + return new GenericBagType<T>(role, propertyRef); + } + + public virtual CollectionType List(string role, string propertyRef, bool embedded) + { + return new ListType(role, propertyRef, embedded); + } + + public virtual CollectionType List<T>(string role, string propertyRef, bool embedded) + { + return new GenericListType<T>(role, propertyRef); + } + + public virtual CollectionType IdBag(string role, string propertyRef, bool embedded) + { + return new IdentifierBagType(role, propertyRef, embedded); + } + + public virtual CollectionType IdBag<T>(string role, string propertyRef, bool embedded) + { + return new GenericIdentifierBagType<T>(role, propertyRef); + } + + public virtual CollectionType Set(string role, string propertyRef, bool embedded) + { + return new SetType(role, propertyRef, embedded); + } + + public virtual CollectionType OrderedSet(string role, string propertyRef, bool embedded) + { + return new OrderedSetType(role, propertyRef, embedded); + } + + public virtual CollectionType SortedSet(string role, string propertyRef, bool embedded, IComparer comparer) + { + return new SortedSetType(role, propertyRef, comparer, embedded); + } + + public virtual CollectionType Set<T>(string role, string propertyRef, bool embedded) + { + return new GenericSetType<T>(role, propertyRef); + } + + public virtual CollectionType SortedSet<T>(string role, string propertyRef, bool embedded, IComparer<T> comparer) + { + return new GenericSortedSetType<T>(role, propertyRef, comparer); + } + + public virtual CollectionType OrderedSet<T>(string role, string propertyRef, bool embedded) + { + return new GenericOrderedSetType<T>(role, propertyRef); + } + + public virtual CollectionType Map(string role, string propertyRef, bool embedded) + { + return new MapType(role, propertyRef, embedded); + } + + public virtual CollectionType OrderedMap(string role, string propertyRef, bool embedded) + { + return new OrderedMapType(role, propertyRef, embedded); + } + + public virtual CollectionType SortedMap(string role, string propertyRef, bool embedded, IComparer comparer) + { + return new SortedMapType(role, propertyRef, comparer, embedded); + } + + public virtual CollectionType Map<TKey, TValue>(string role, string propertyRef, bool embedded) + { + return new GenericMapType<TKey, TValue>(role, propertyRef); + } + + public virtual CollectionType SortedDictionary<TKey, TValue>(string role, string propertyRef, bool embedded, IComparer<TKey> comparer) + { + return new GenericSortedDictionaryType<TKey, TValue>(role, propertyRef, comparer); + } + + public virtual CollectionType SortedList<TKey, TValue>(string role, string propertyRef, bool embedded, IComparer<TKey> comparer) + { + return new GenericSortedListType<TKey, TValue>(role, propertyRef, comparer); + } + } +} \ No newline at end of file Deleted: trunk/nhibernate/src/NHibernate/Type/ICollectionTypeFactory.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Type/ICollectionTypeFactory.cs 2009-06-11 19:17:20 UTC (rev 4456) +++ trunk/nhibernate/src/NHibernate/Type/ICollectionTypeFactory.cs 2009-06-11 21:49:52 UTC (rev 4457) @@ -1,248 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -namespace NHibernate.Type -{ - /// <summary> - /// Type factory for collections types. - /// </summary> - public interface ICollectionTypeFactory - { - /// <summary> - /// Creates a new <see cref="CollectionType"/> for an <see cref="System.Array"/>. - /// </summary> - /// <param name="role">The role the collection is in.</param> - /// <param name="propertyRef">The name of the property in the - /// owner object containing the collection ID, or <see langword="null" /> if it is - /// the primary key.</param> - /// <param name="elementClass">The <see cref="System.Type"/> to use to create the array.</param> - /// <param name="embedded">Is embedded in XML (not supported yet)</param> - /// <returns> - /// An <see cref="ArrayType"/> for the specified role. - /// </returns> - CollectionType Array(string role, string propertyRef, bool embedded, System.Type elementClass); - - /// <summary> - /// Creates a new <see cref="CollectionType"/> for an <see cref="IList"/> - /// with bag semantics. - /// </summary> - /// <param name="role">The role the collection is in.</param> - /// <param name="propertyRef">The name of the property in the - /// owner object containing the collection ID, or <see langword="null" /> if it is - /// the primary key.</param> - /// <param name="embedded">Is embedded in XML (not supported yet)</param> - /// <returns> - /// A <see cref="BagType"/> for the specified role. - /// </returns> - CollectionType Bag(string role, string propertyRef, bool embedded); - - /// <summary> - /// Creates a new <see cref="CollectionType"/> for an - /// <see cref="System.Collections.Generic.IList{T}"/> with bag semantics. - /// </summary> - /// <typeparam name="T">The type of elements in the list.</typeparam> - /// <param name="role">The role the collection is in.</param> - /// <param name="propertyRef"> - /// The name of the property in the owner object containing the collection ID, - /// or <see langword="null" /> if it is the primary key. - /// </param> - /// <param name="embedded">Is embedded in XML (not supported yet)</param> - /// <returns> - /// A <see cref="GenericBagType{T}"/> for the specified role. - /// </returns> - CollectionType Bag<T>(string role, string propertyRef, bool embedded); - - /// <summary> - /// Creates a new <see cref="CollectionType"/> for an <see cref="IList"/>. - /// </summary> - /// <param name="role">The role the collection is in.</param> - /// <param name="propertyRef">The name of the property in the - /// owner object containing the collection ID, or <see langword="null" /> if it is - /// the primary key.</param> - /// <param name="embedded">Is embedded in XML (not supported yet)</param> - /// <returns> - /// A <see cref="ListType"/> for the specified role. - /// </returns> - CollectionType List(string role, string propertyRef, bool embedded); - - /// <summary> - /// Creates a new <see cref="CollectionType"/> for an - /// <see cref="System.Collections.Generic.IList<T>"/> with list - /// semantics. - /// </summary> - /// <typeparam name="T">The type of elements in the list.</typeparam> - /// <param name="role">The role the collection is in.</param> - /// <param name="propertyRef"> - /// The name of the property in the - /// owner object containing the collection ID, or <see langword="null" /> if it is - /// the primary key. - /// </param> - /// <param name="embedded">Is embedded in XML (not supported yet)</param> - /// <returns> - /// A <see cref="ListType"/> for the specified role. - /// </returns> - CollectionType List<T>(string role, string propertyRef, bool embedded); - - /// <summary> - /// Creates a new <see cref="CollectionType"/> for an <see cref="IList"/> - /// with id-bag semantics. - /// </summary> - /// <param name="role">The role the collection is in.</param> - /// <param name="propertyRef">The name of the property in the - /// owner object containing the collection ID, or <see langword="null" /> if it is - /// the primary key.</param> - /// <param name="embedded">Is embedded in XML (not supported yet)</param> - /// <returns> - /// A <see cref="IdentifierBagType"/> for the specified role. - /// </returns> - CollectionType IdBag(string role, string propertyRef, bool embedded); - - /// <summary> - /// Creates a new <see cref="CollectionType"/> for an - /// <see cref="System.Collections.Generic.IList{T}"/> with identifier - /// bag semantics. - /// </summary> - /// <typeparam name="T">The type of elements in the list.</typeparam> - /// <param name="role">The role the collection is in.</param> - /// <param name="propertyRef">The name of the property in the - /// owner object containing the collection ID, or <see langword="null" /> if it is - /// the primary key. - /// </param> - /// <param name="embedded">Is embedded in XML (not supported yet)</param> - /// <returns> - /// A <see cref="GenericIdentifierBagType{T}"/> for the specified role. - /// </returns> - CollectionType IdBag<T>(string role, string propertyRef, bool embedded); - - /// <summary> - /// Creates a new <see cref="CollectionType"/> for an <see cref="Iesi.Collections.ISet"/>. - /// </summary> - /// <param name="role">The role the collection is in.</param> - /// <param name="propertyRef">The name of the property in the - /// owner object containing the collection ID, or <see langword="null" /> if it is - /// the primary key.</param> - /// <param name="embedded">Is embedded in XML (not supported yet)</param> - /// <returns> - /// A <see cref="SetType"/> for the specified role. - /// </returns> - CollectionType Set(string role, string propertyRef, bool embedded); - - CollectionType OrderedSet(string role, string propertyRef, bool embedded); - - /// <summary> - /// Creates a new <see cref="CollectionType"/> for an <see cref="Iesi.Collections.ISet"/> - /// that is sorted by an <see cref="IComparer"/>. - /// </summary> - /// <param name="role">The role the collection is in.</param> - /// <param name="propertyRef">The name of the property in the - /// owner object containing the collection ID, or <see langword="null" /> if it is - /// the primary key.</param> - /// <param name="comparer">The <see cref="IComparer"/> that does the sorting.</param> - /// <param name="embedded">Is embedded in XML (not supported yet)</param> - /// <returns> - /// A <see cref="SortedSetType"/> for the specified role. - /// </returns> - CollectionType SortedSet(string role, string propertyRef, bool embedded, IComparer comparer); - - /// <summary> - /// Creates a new <see cref="CollectionType"/> for an <see cref="Iesi.Collections.Generic.ISet{T}" />. - /// </summary> - /// <typeparam name="T">The type of elements in the collection.</typeparam> - /// <param name="role">The role the collection is in.</param> - /// <param name="propertyRef">The name of the property in the - /// owner object containing the collection ID, or <see langword="null" /> if it is - /// the primary key.</param> - /// <param name="embedded">Is embedded in XML (not supported yet)</param> - /// <returns>A <see cref="GenericSetType{T}" /> for the specified role.</returns> - CollectionType Set<T>(string role, string propertyRef, bool embedded); - - /// <summary> - /// Creates a new <see cref="CollectionType"/> for a sorted <see cref="Iesi.Collections.Generic.ISet{T}" />. - /// </summary> - /// <typeparam name="T">The type of elements in the collection.</typeparam> - /// <param name="role">The role the collection is in.</param> - /// <param name="propertyRef">The name of the property in the - /// owner object containing the collection ID, or <see langword="null" /> if it is - /// the primary key.</param> - /// <param name="embedded">Is embedded in XML (not supported yet)</param> - /// <param name="comparer">The <see cref="System.Collections.Generic.IComparer{T}" /> to use for the set.</param> - /// <returns>A <see cref="GenericSetType{T}" /> for the specified role.</returns> - CollectionType SortedSet<T>(string role, string propertyRef, bool embedded, IComparer<T> comparer); - - /// <summary> - /// Creates a new <see cref="CollectionType"/> for an ordered <see cref="Iesi.Collections.Generic.ISet{T}" />. - /// </summary> - /// <typeparam name="T">The type of elements in the collection.</typeparam> - /// <param name="role">The role the collection is in.</param> - /// <param name="propertyRef"> - /// The name of the property in the owner object containing the collection ID, - /// or <see langword="null" /> if it is the primary key. - /// </param> - /// <param name="embedded">Is embedded in XML (not supported yet)</param> - /// <returns>A <see cref="GenericSetType{T}" /> for the specified role.</returns> - CollectionType OrderedSet<T>(string role, string propertyRef, bool embedded); - - /// <summary> - /// Creates a new <see cref="CollectionType"/> for an <see cref="IDictionary"/>. - /// </summary> - /// <param name="role">The role the collection is in.</param> - /// <param name="propertyRef"> - /// The name of the property in the - /// owner object containing the collection ID, or <see langword="null" /> if it is - /// the primary key.</param> - /// <param name="embedded">Is embedded in XML (not supported yet)</param> - /// <returns> - /// A <see cref="MapType"/> for the specified role. - /// </returns> - CollectionType Map(string role, string propertyRef, bool embedded); - - /// <summary> - /// Creates a new <see cref="CollectionType"/> for an <see cref="IDictionary"/> - /// that maintains insertion order of elements. - /// </summary> - /// <param name="role">The role the collection is in.</param> - /// <param name="propertyRef">The name of the property in the - /// owner object containing the collection ID, or <see langword="null" /> if it is - /// the primary key.</param> - /// <param name="embedded">Is embedded in XML (not supported yet)</param> - /// <returns> - /// A <see cref="OrderedMapType"/> for the specified role. - /// </returns> - CollectionType OrderedMap(string role, string propertyRef, bool embedded); - - /// <summary> - /// Creates a new <see cref="CollectionType"/> for an <see cref="IDictionary"/> - /// that is sorted by an <see cref="IComparer"/>. - /// </summary> - /// <param name="role">The role the collection is in.</param> - /// <param name="propertyRef">The name of the property in the - /// owner object containing the collection ID, or <see langword="null" /> if it is - /// the primary key.</param> - /// <param name="comparer">The <see cref="IComparer"/> that does the sorting.</param> - /// <param name="embedded">Is embedded in XML (not supported yet)</param> - /// <returns> - /// A <see cref="SortedMapType"/> for the specified role. - /// </returns> - CollectionType SortedMap(string role, string propertyRef, bool embedded, IComparer comparer); - - /// <summary> - /// Creates a new <see cref="CollectionType"/> for an - /// <see cref="System.Collections.Generic.IDictionary<TKey,TValue>"/>. - /// </summary> - /// <typeparam name="TKey">The type of keys in the dictionary.</typeparam> - /// <typeparam name="TValue">The type of values in the dictionary.</typeparam> - /// <param name="role">The role the collection is in.</param> - /// <param name="propertyRef">The name of the property in the - /// owner object containing the collection ID, or <see langword="null" /> if it is - /// the primary key.< - /// /param> - /// <param name="embedded">Is embedded in XML (not supported yet)</param> - /// <returns> - /// A <see cref="MapType"/> for the specified role. - /// </returns> - CollectionType Map<TKey, TValue>(string role, string propertyRef, bool embedded); - - - CollectionType SortedDictionary<TKey, TValue>(string role, string propertyRef, bool embedded, IComparer<TKey> comparer); - CollectionType SortedList<TKey, TValue>(string role, string propertyRef, bool embedded, IComparer<TKey> comparer); - } -} \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate/Type/TypeFactory.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Type/TypeFactory.cs 2009-06-11 19:17:20 UTC (rev 4456) +++ trunk/nhibernate/src/NHibernate/Type/TypeFactory.cs 2009-06-11 21:49:52 UTC (rev 4457) @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Globalization; using System.Reflection; +using NHibernate.Bytecode; using NHibernate.Classic; using NHibernate.Engine; using NHibernate.Intercept; @@ -95,10 +96,7 @@ /// <summary></summary> static TypeFactory() { - Instance = - new TypeFactory( - (ICollectionTypeFactory) - Cfg.Environment.BytecodeProvider.ObjectsFactory.CreateInstance(typeof (CollectionTypeFactory))); + Instance = new TypeFactory(); //basicTypes.Add(NHibernate.Blob.Name, NHibernate.Blob); //basicTypes.Add(NHibernate.Clob.Name, NHibernate.Clob); @@ -184,11 +182,16 @@ getTypeDelegatesWithPrecision.Add(NHibernateUtil.Decimal.Name, GetDecimalType); } - public ICollectionTypeFactory CollectionTypeFactory { get; private set; } + public ICollectionTypeFactory CollectionTypeFactory + { + get + { + return Cfg.Environment.BytecodeProvider.CollectionTypeFactory; + } + } - private TypeFactory(ICollectionTypeFactory collectionTypeFactory) + private TypeFactory() { - CollectionTypeFactory = collectionTypeFactory; } /// <summary> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ste...@us...> - 2009-06-11 19:17:27
|
Revision: 4456 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4456&view=rev Author: steverstrong Date: 2009-06-11 19:17:20 +0000 (Thu, 11 Jun 2009) Log Message: ----------- Current work on new Linq provider Added Paths: ----------- branches/Linq to Nhibernate/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2009-06-11 17:49:00
|
Revision: 4455 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4455&view=rev Author: fabiomaulo Date: 2009-06-11 17:48:51 +0000 (Thu, 11 Jun 2009) Log Message: ----------- Fix NH-1833 Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Util/LiteralProcessor.cs trunk/nhibernate/src/NHibernate.Test/HQL/Ast/HqlFixture.cs trunk/nhibernate/src/NHibernate.Test/HQL/Ast/SimpleClass.cs trunk/nhibernate/src/NHibernate.Test/HQL/Ast/SimpleClass.hbm.xml Modified: trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Util/LiteralProcessor.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Util/LiteralProcessor.cs 2009-06-11 14:30:32 UTC (rev 4454) +++ trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Util/LiteralProcessor.cs 2009-06-11 17:48:51 UTC (rev 4455) @@ -193,25 +193,33 @@ private string DetermineIntegerRepresentation(string text, int type) { + // prevent the fisrt-exception as possible + var literalValue = text; + bool hasLongSpec = literalValue.EndsWith("l") || literalValue.EndsWith("L"); + if (hasLongSpec) + { + literalValue = literalValue.Substring(0, literalValue.Length - 1); + } try { - if (type == HqlSqlWalker.NUM_INT) + if (type == HqlSqlWalker.NUM_INT && literalValue.Length <= 10 || hasLongSpec) { try { - return int.Parse(text).ToString(); + return int.Parse(literalValue).ToString(); } catch (FormatException) { - log.Info("could not format incoming text [" + text + "] as a NUM_INT; assuming numeric overflow and attempting as NUM_LONG"); + log.Info("could not format incoming text [" + text + + "] as a NUM_INT; assuming numeric overflow and attempting as NUM_LONG"); } + catch (OverflowException) + { + log.Info("could not format incoming text [" + text + + "] as a NUM_INT; assuming numeric overflow and attempting as NUM_LONG"); + } } - String literalValue = text; - if (literalValue.EndsWith("l") || literalValue.EndsWith("L")) - { - literalValue = literalValue.Substring(0, literalValue.Length - 1); - } return long.Parse(literalValue).ToString(); } catch (Exception t) Modified: trunk/nhibernate/src/NHibernate.Test/HQL/Ast/HqlFixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/HqlFixture.cs 2009-06-11 14:30:32 UTC (rev 4454) +++ trunk/nhibernate/src/NHibernate.Test/HQL/Ast/HqlFixture.cs 2009-06-11 17:48:51 UTC (rev 4455) @@ -117,5 +117,19 @@ s.Transaction.Commit(); } } + + [Test] + public void CanParseMaxLong() + { + // NH-1833 + using (ISession s = OpenSession()) + { + s.CreateQuery(string.Format("from SimpleClass sc where sc.LongValue = {0}", long.MaxValue)).List(); + s.CreateQuery(string.Format("from SimpleClass sc where sc.LongValue = {0}L", long.MaxValue)).List(); + s.CreateQuery(string.Format("from SimpleClass sc where sc.LongValue = 123L")).List(); + s.CreateQuery(string.Format("from SimpleClass sc where sc.LongValue = 123")).List(); + s.CreateQuery(string.Format("from SimpleClass sc where sc.LongValue = {0}", int.MaxValue + 1L)).List(); + } + } } } \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate.Test/HQL/Ast/SimpleClass.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/SimpleClass.cs 2009-06-11 14:30:32 UTC (rev 4454) +++ trunk/nhibernate/src/NHibernate.Test/HQL/Ast/SimpleClass.cs 2009-06-11 17:48:51 UTC (rev 4455) @@ -3,5 +3,7 @@ public class SimpleClass { public virtual string Description { get; set; } + public virtual long LongValue { get; set; } + public virtual int IntValue { get; set; } } } \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate.Test/HQL/Ast/SimpleClass.hbm.xml =================================================================== --- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/SimpleClass.hbm.xml 2009-06-11 14:30:32 UTC (rev 4454) +++ trunk/nhibernate/src/NHibernate.Test/HQL/Ast/SimpleClass.hbm.xml 2009-06-11 17:48:51 UTC (rev 4455) @@ -8,5 +8,7 @@ <generator class="native" /> </id> <property name="Description"/> + <property name="LongValue"/> + <property name="IntValue"/> </class> </hibernate-mapping> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dar...@us...> - 2009-06-11 14:31:01
|
Revision: 4454 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4454&view=rev Author: darioquintana Date: 2009-06-11 14:30:32 +0000 (Thu, 11 Jun 2009) Log Message: ----------- >From 'increment' to 'native'. For some reason there are conflicts between tests of NH-1553 and this one (NH-1601) when running together. Modified Paths: -------------- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1601/Mappings.hbm.xml Modified: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1601/Mappings.hbm.xml =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1601/Mappings.hbm.xml 2009-06-11 07:00:45 UTC (rev 4453) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1601/Mappings.hbm.xml 2009-06-11 14:30:32 UTC (rev 4454) @@ -47,7 +47,7 @@ <class name="Scenario" table="Scenario" lazy="false"> <id type="Int32" name="id"> <column name="ScenarioID"/> - <generator class="increment" /> + <generator class="native" /> </id> </class> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2009-06-11 07:00:51
|
Revision: 4453 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4453&view=rev Author: fabiomaulo Date: 2009-06-11 07:00:45 +0000 (Thu, 11 Jun 2009) Log Message: ----------- Fix NH-1810 (thanks to Lee Henson for all his work around the issue) Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Collection/PersistentSet.cs trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1810/Fixture.cs Modified: trunk/nhibernate/src/NHibernate/Collection/PersistentSet.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Collection/PersistentSet.cs 2009-06-11 04:36:17 UTC (rev 4452) +++ trunk/nhibernate/src/NHibernate/Collection/PersistentSet.cs 2009-06-11 07:00:45 UTC (rev 4453) @@ -13,6 +13,109 @@ namespace NHibernate.Collection { + internal interface ISetSnapshot<T>: ICollection<T>, ICollection + { + T this[T element]{ get;} + } + + [Serializable] + internal class SetSnapShot<T> : ISetSnapshot<T> + { + private readonly List<T> elements; + public SetSnapShot() + { + elements = new List<T>(); + } + + public SetSnapShot(int capacity) + { + elements = new List<T>(capacity); + } + + public SetSnapShot(IEnumerable<T> collection) + { + elements = new List<T>(collection); + } + + public IEnumerator<T> GetEnumerator() + { + return elements.GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + public void Add(T item) + { + elements.Add(item); + } + + public void Clear() + { + throw new InvalidOperationException(); + } + + public bool Contains(T item) + { + return elements.Contains(item); + } + + public void CopyTo(T[] array, int arrayIndex) + { + elements.CopyTo(array, arrayIndex); + } + + public bool Remove(T item) + { + throw new InvalidOperationException(); + } + + public void CopyTo(Array array, int index) + { + ((ICollection)elements).CopyTo(array, index); + } + + int ICollection.Count + { + get { return elements.Count; } + } + + public object SyncRoot + { + get { return ((ICollection)elements).SyncRoot; } + } + + public bool IsSynchronized + { + get { return ((ICollection)elements).IsSynchronized; } + } + + int ICollection<T>.Count + { + get { return elements.Count; } + } + + public bool IsReadOnly + { + get { return ((ICollection<T>)elements).IsReadOnly; } + } + + public T this[T element] + { + get + { + var idx = elements.IndexOf(element); + if(idx >=0) + { + return elements[idx]; + } + return default(T); + } + } + } + /// <summary> /// .NET has no design equivalent for Java's Set so we are going to use the /// Iesi.Collections library. This class is internal to NHibernate and shouldn't @@ -78,28 +181,30 @@ { EntityMode entityMode = Session.EntityMode; - //if (set==null) return new Set(session); - Hashtable clonedSet = new Hashtable(set.Count); + // NH Different behavior : for NH-1810 and the way is working the possible underlining collection + // the Snapshot is represented using a List<T> + // (perhaps it has less performance then IDictionary but it is working) + // TODO : should use ever underlining collection type or something to have same performace and same order + var clonedSet = new SetSnapShot<object>(set.Count); foreach (object current in set) { object copied = persister.ElementType.DeepCopy(current, entityMode, persister.Factory); - clonedSet[copied] = copied; + clonedSet.Add(copied); } return clonedSet; } public override ICollection GetOrphans(object snapshot, string entityName) { - IDictionary sn = (IDictionary) snapshot; - // NH Different implementation : sn.Keys return a new collection we don't need "re-new" - return GetOrphans(sn.Keys, set, entityName, Session); + var sn = new SetSnapShot<object>((IEnumerable<object>)snapshot); + return GetOrphans(sn, set, entityName, Session); } public override bool EqualsSnapshot(ICollectionPersister persister) { IType elementType = persister.ElementType; - IDictionary snapshot = (IDictionary) GetSnapshot(); - if (snapshot.Count != set.Count) + var snapshot = (ISetSnapshot<object>)GetSnapshot(); + if (((ICollection)snapshot).Count != set.Count) { return false; } @@ -118,7 +223,7 @@ public override bool IsSnapshotEmpty(object snapshot) { - return ((IDictionary) snapshot).Count == 0; + return ((ICollection)snapshot).Count == 0; } public override void BeforeInitialize(ICollectionPersister persister, int anticipatedSize) @@ -212,9 +317,9 @@ public override IEnumerable GetDeletes(ICollectionPersister persister, bool indexIsFormula) { IType elementType = persister.ElementType; - IDictionary sn = (IDictionary) GetSnapshot(); - List<object> deletes = new List<object>(sn.Count); - foreach (object obj in sn.Keys) + var sn = (ISetSnapshot<object>)GetSnapshot(); + var deletes = new List<object>(((ICollection)sn).Count); + foreach (object obj in sn) { if (!set.Contains(obj)) { @@ -237,7 +342,7 @@ public override bool NeedsInserting(object entry, int i, IType elemType) { - IDictionary sn = (IDictionary) GetSnapshot(); + var sn = (ISetSnapshot<object>) GetSnapshot(); object oldKey = sn[entry]; // note that it might be better to iterate the snapshot but this is safe, // assuming the user implements equals() properly, as required by the PersistentSet Modified: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1810/Fixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1810/Fixture.cs 2009-06-11 04:36:17 UTC (rev 4452) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1810/Fixture.cs 2009-06-11 07:00:45 UTC (rev 4453) @@ -4,7 +4,7 @@ namespace NHibernate.Test.NHSpecificTest.NH1810 { - [TestFixture, Ignore("To investigate.")] + [TestFixture] public class Fixture : BugTestCase { // The problem is the same using a default sort="natural" collection for Children This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2009-06-11 04:37:22
|
Revision: 4452 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4452&view=rev Author: fabiomaulo Date: 2009-06-11 04:36:17 +0000 (Thu, 11 Jun 2009) Log Message: ----------- - Fix NH-1821 - Fix unreported bug related with NH-1171 Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Engine/Query/ParamLocationRecognizer.cs trunk/nhibernate/src/NHibernate/Engine/Query/ParameterParser.cs trunk/nhibernate/src/NHibernate/Loader/Custom/Sql/SQLQueryParser.cs trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1171/Fixture.cs trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj Added Paths: ----------- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1821/ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1821/Entity.cs trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1821/Fixture.cs trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1821/Mappings.hbm.xml Modified: trunk/nhibernate/src/NHibernate/Engine/Query/ParamLocationRecognizer.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Engine/Query/ParamLocationRecognizer.cs 2009-06-11 03:04:00 UTC (rev 4451) +++ trunk/nhibernate/src/NHibernate/Engine/Query/ParamLocationRecognizer.cs 2009-06-11 04:36:17 UTC (rev 4452) @@ -74,6 +74,11 @@ // don't care... } + public void Other(string sqlPart) + { + // don't care... + } + private NamedParameterDescription GetOrBuildNamedParameterDescription(string name, bool jpa) { NamedParameterDescription desc; Modified: trunk/nhibernate/src/NHibernate/Engine/Query/ParameterParser.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Engine/Query/ParameterParser.cs 2009-06-11 03:04:00 UTC (rev 4451) +++ trunk/nhibernate/src/NHibernate/Engine/Query/ParameterParser.cs 2009-06-11 04:36:17 UTC (rev 4452) @@ -21,6 +21,7 @@ void NamedParameter(string name, int position); void JpaPositionalParameter(string name, int position); void Other(char character); + void Other(string sqlPart); } // Disallow instantiation @@ -56,12 +57,14 @@ if (indx + 1 < stringLength && sqlString.Substring(indx,2) == "/*") { var closeCommentIdx = sqlString.IndexOf("*/"); + recognizer.Other(sqlString.Substring(indx, (closeCommentIdx- indx)+2)); indx = closeCommentIdx + 1; continue; } if (afterNewLine && (indx + 1 < stringLength) && sqlString.Substring(indx, 2) == "--") { var closeCommentIdx = sqlString.IndexOf(Environment.NewLine, indx + 2); + recognizer.Other(sqlString.Substring(indx, closeCommentIdx - indx)); indx = closeCommentIdx + NewLineLength - 1; continue; } @@ -69,6 +72,7 @@ { afterNewLine = true; indx += NewLineLength - 1; + recognizer.Other(Environment.NewLine); continue; } afterNewLine = false; Modified: trunk/nhibernate/src/NHibernate/Loader/Custom/Sql/SQLQueryParser.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Loader/Custom/Sql/SQLQueryParser.cs 2009-06-11 03:04:00 UTC (rev 4451) +++ trunk/nhibernate/src/NHibernate/Loader/Custom/Sql/SQLQueryParser.cs 2009-06-11 04:36:17 UTC (rev 4452) @@ -26,7 +26,7 @@ private readonly Dictionary<string, object> namedParameters = new Dictionary<string, object>(); - private long aliasesFound = 0; + private long aliasesFound; public SQLQueryParser(string sqlQuery, IParserContext context) { @@ -283,6 +283,11 @@ result.Add(character.ToString()); } + public void Other(string sqlPart) + { + result.Add(sqlPart); + } + private void AddNamedParameter(string name) { int loc = parameterCount++; Modified: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1171/Fixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1171/Fixture.cs 2009-06-11 03:04:00 UTC (rev 4451) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1171/Fixture.cs 2009-06-11 04:36:17 UTC (rev 4452) @@ -1,3 +1,4 @@ +using NHibernate.Cfg; using NUnit.Framework; namespace NHibernate.Test.NHSpecificTest.NH1171 @@ -5,6 +6,11 @@ [TestFixture] public class Fixture: BugTestCase { + protected override void Configure(NHibernate.Cfg.Configuration configuration) + { + configuration.SetProperty(Environment.FormatSql, "false"); + } + [Test] public void SupportSQLQueryWithComments() { @@ -24,5 +30,31 @@ q.List(); } } + + [Test] + public void ExecutedContainsComments() + { + string sql = + @" +SELECT id +FROM tablea +-- Comment with ' number 1 +WHERE Name = :name +/* Comment with ' number 2 */ +ORDER BY Name +"; + using (var ls = new SqlLogSpy()) + { + using (ISession s = OpenSession()) + { + var q = s.CreateSQLQuery(sql); + q.SetString("name", "Evgeny Potashnik"); + q.List(); + } + string message = ls.GetWholeLog(); + Assert.That(message, Text.Contains("-- Comment with ' number 1")); + Assert.That(message, Text.Contains("/* Comment with ' number 2 */")); + } + } } } \ No newline at end of file Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1821/Entity.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1821/Entity.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1821/Entity.cs 2009-06-11 04:36:17 UTC (rev 4452) @@ -0,0 +1,7 @@ +namespace NHibernate.Test.NHSpecificTest.NH1821 +{ + public class Entity + { + public virtual int Id { get; set; } + } +} Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1821/Fixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1821/Fixture.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1821/Fixture.cs 2009-06-11 04:36:17 UTC (rev 4452) @@ -0,0 +1,44 @@ +using System.Text.RegularExpressions; +using NHibernate.Dialect; +using NUnit.Framework; + +namespace NHibernate.Test.NHSpecificTest.NH1821 +{ + [TestFixture] + public class Fixture : BugTestCase + { + protected override bool AppliesTo(Dialect.Dialect dialect) + { + return dialect is MsSql2005Dialect; + } + + [Test] + public void ShouldNotRemoveLineBreaksFromSqlQueries() + { + using (var spy = new SqlLogSpy()) + using (var s = OpenSession()) + using (var t = s.BeginTransaction()) + { + const string sql = @" +select Id +from Entity +where 1=1"; + var query = s.CreateSQLQuery(sql); + Assert.DoesNotThrow(() => query.List()); + + string renderedSql = spy.Appender.GetEvents()[0].RenderedMessage; + + Regex whitespaces = new Regex(@"\s+", RegexOptions.IgnoreCase | RegexOptions.Multiline | RegexOptions.Compiled); + + Assert.AreEqual( + string.Compare( + whitespaces.Replace(sql, " ").Trim(), + whitespaces.Replace(renderedSql, " ").Trim(), + true + ), + 0 + ); + } + } + } +} Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1821/Mappings.hbm.xml =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1821/Mappings.hbm.xml (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1821/Mappings.hbm.xml 2009-06-11 04:36:17 UTC (rev 4452) @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="utf-8" ?> +<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" + namespace="NHibernate.Test.NHSpecificTest.NH1821" + assembly="NHibernate.Test"> + <class name="Entity" table="Entity"> + <id name="Id"/> + </class> +</hibernate-mapping> Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-06-11 03:04:00 UTC (rev 4451) +++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-06-11 04:36:17 UTC (rev 4452) @@ -501,6 +501,8 @@ <Compile Include="NHSpecificTest\NH1812\Model.cs" /> <Compile Include="NHSpecificTest\NH1813\EntityWithUnique.cs" /> <Compile Include="NHSpecificTest\NH1813\Fixture.cs" /> + <Compile Include="NHSpecificTest\NH1821\Entity.cs" /> + <Compile Include="NHSpecificTest\NH1821\Fixture.cs" /> <Compile Include="NHSpecificTest\NH645\HQLFunctionFixture.cs" /> <Compile Include="HQL\HQLFunctions.cs" /> <Compile Include="HQL\Human.cs" /> @@ -1900,6 +1902,7 @@ <EmbeddedResource Include="CacheTest\EntityWithFilters.xml" /> <EmbeddedResource Include="Classic\EntityWithLifecycle.hbm.xml" /> <Content Include="DynamicEntity\package.html" /> + <EmbeddedResource Include="NHSpecificTest\NH1821\Mappings.hbm.xml" /> <EmbeddedResource Include="TypeParameters\EntityCustomId.hbm.xml" /> <EmbeddedResource Include="Tools\hbm2ddl\SchemaMetadataUpdaterTest\HeavyEntity.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1182\Mappings.hbm.xml" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2009-06-11 03:04:01
|
Revision: 4451 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4451&view=rev Author: fabiomaulo Date: 2009-06-11 03:04:00 +0000 (Thu, 11 Jun 2009) Log Message: ----------- Minor (removed unused variable) Modified Paths: -------------- trunk/nhibernate/src/NHibernate.Test/HQL/HQLFunctions.cs Modified: trunk/nhibernate/src/NHibernate.Test/HQL/HQLFunctions.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/HQL/HQLFunctions.cs 2009-06-11 02:55:44 UTC (rev 4450) +++ trunk/nhibernate/src/NHibernate.Test/HQL/HQLFunctions.cs 2009-06-11 03:04:00 UTC (rev 4451) @@ -587,7 +587,6 @@ string hql; IList l; Animal result; - double expectedBodyWeight = 1.3; // Rendered in SELECT using a property hql = "select cast(a.BodyWeight as Double) from Animal a"; l = s.CreateQuery(hql).List(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2009-06-11 02:55:46
|
Revision: 4450 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4450&view=rev Author: fabiomaulo Date: 2009-06-11 02:55:44 +0000 (Thu, 11 Jun 2009) Log Message: ----------- Minor (moved test in its place) Modified Paths: -------------- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj Added Paths: ----------- trunk/nhibernate/src/NHibernate.Test/ExpressionTest/RestrictionsFixture.cs Removed Paths: ------------- trunk/nhibernate/src/NHibernate.Test/Criteria/RestrictionsFixture.cs Deleted: trunk/nhibernate/src/NHibernate.Test/Criteria/RestrictionsFixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/Criteria/RestrictionsFixture.cs 2009-06-11 02:37:36 UTC (rev 4449) +++ trunk/nhibernate/src/NHibernate.Test/Criteria/RestrictionsFixture.cs 2009-06-11 02:55:44 UTC (rev 4450) @@ -1,18 +0,0 @@ -using NHibernate.Criterion; -using NUnit.Framework; - -namespace NHibernate.Test.Criteria -{ - [TestFixture] - public class RestrictionsFixture - { - [Test] - public void LikeShouldContainsMatch() - { - ICriterion c = Restrictions.Like("Name", "n", MatchMode.Anywhere, null); - Assert.That(c, Is.InstanceOf<LikeExpression>()); - var likeExpression = (LikeExpression) c; - Assert.That(likeExpression.ToString(), Is.EqualTo("Name like %n%")); - } - } -} \ No newline at end of file Copied: trunk/nhibernate/src/NHibernate.Test/ExpressionTest/RestrictionsFixture.cs (from rev 4449, trunk/nhibernate/src/NHibernate.Test/Criteria/RestrictionsFixture.cs) =================================================================== --- trunk/nhibernate/src/NHibernate.Test/ExpressionTest/RestrictionsFixture.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/ExpressionTest/RestrictionsFixture.cs 2009-06-11 02:55:44 UTC (rev 4450) @@ -0,0 +1,18 @@ +using NHibernate.Criterion; +using NUnit.Framework; + +namespace NHibernate.Test.ExpressionTest +{ + [TestFixture] + public class RestrictionsFixture + { + [Test] + public void LikeShouldContainsMatch() + { + ICriterion c = Restrictions.Like("Name", "n", MatchMode.Anywhere, null); + Assert.That(c, Is.InstanceOf<LikeExpression>()); + var likeExpression = (LikeExpression) c; + Assert.That(likeExpression.ToString(), Is.EqualTo("Name like %n%")); + } + } +} \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-06-11 02:37:36 UTC (rev 4449) +++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-06-11 02:55:44 UTC (rev 4450) @@ -147,7 +147,7 @@ <Compile Include="Criteria\MaterialResource.cs" /> <Compile Include="Criteria\ProjectionsTest.cs" /> <Compile Include="Criteria\Reptile.cs" /> - <Compile Include="Criteria\RestrictionsFixture.cs" /> + <Compile Include="ExpressionTest\RestrictionsFixture.cs" /> <Compile Include="Criteria\Student.cs" /> <Compile Include="Criteria\StudentDTO.cs" /> <Compile Include="DebugConnectionProvider.cs" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2009-06-11 02:37:38
|
Revision: 4449 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4449&view=rev Author: fabiomaulo Date: 2009-06-11 02:37:36 +0000 (Thu, 11 Jun 2009) Log Message: ----------- Fix NH-1830 Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Criterion/Restrictions.cs trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj Added Paths: ----------- trunk/nhibernate/src/NHibernate.Test/Criteria/RestrictionsFixture.cs Modified: trunk/nhibernate/src/NHibernate/Criterion/Restrictions.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Criterion/Restrictions.cs 2009-06-10 23:27:21 UTC (rev 4448) +++ trunk/nhibernate/src/NHibernate/Criterion/Restrictions.cs 2009-06-11 02:37:36 UTC (rev 4449) @@ -71,7 +71,7 @@ public static AbstractCriterion Like(string propertyName, string value, MatchMode matchMode, char? escapeChar) { - return new LikeExpression(propertyName, value, escapeChar, false); + return new LikeExpression(propertyName, value, matchMode, escapeChar, false); } /// <summary> Added: trunk/nhibernate/src/NHibernate.Test/Criteria/RestrictionsFixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/Criteria/RestrictionsFixture.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/Criteria/RestrictionsFixture.cs 2009-06-11 02:37:36 UTC (rev 4449) @@ -0,0 +1,18 @@ +using NHibernate.Criterion; +using NUnit.Framework; + +namespace NHibernate.Test.Criteria +{ + [TestFixture] + public class RestrictionsFixture + { + [Test] + public void LikeShouldContainsMatch() + { + ICriterion c = Restrictions.Like("Name", "n", MatchMode.Anywhere, null); + Assert.That(c, Is.InstanceOf<LikeExpression>()); + var likeExpression = (LikeExpression) c; + Assert.That(likeExpression.ToString(), Is.EqualTo("Name like %n%")); + } + } +} \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-06-10 23:27:21 UTC (rev 4448) +++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-06-11 02:37:36 UTC (rev 4449) @@ -147,6 +147,7 @@ <Compile Include="Criteria\MaterialResource.cs" /> <Compile Include="Criteria\ProjectionsTest.cs" /> <Compile Include="Criteria\Reptile.cs" /> + <Compile Include="Criteria\RestrictionsFixture.cs" /> <Compile Include="Criteria\Student.cs" /> <Compile Include="Criteria\StudentDTO.cs" /> <Compile Include="DebugConnectionProvider.cs" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2009-06-10 23:27:23
|
Revision: 4448 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4448&view=rev Author: fabiomaulo Date: 2009-06-10 23:27:21 +0000 (Wed, 10 Jun 2009) Log Message: ----------- Test available (NH-1812 was fixed) Modified Paths: -------------- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1812/Fixture.cs Modified: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1812/Fixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1812/Fixture.cs 2009-06-10 18:30:18 UTC (rev 4447) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1812/Fixture.cs 2009-06-10 23:27:21 UTC (rev 4448) @@ -44,7 +44,7 @@ } } - [TestFixture, Ignore("To fix for AST parser; there are problems with subquery in various places.")] + [TestFixture] public class AstBug : AstBugBase { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ste...@us...> - 2009-06-10 19:05:32
|
Revision: 4447 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4447&view=rev Author: steverstrong Date: 2009-06-10 18:30:18 +0000 (Wed, 10 Jun 2009) Log Message: ----------- Fix for NH-1812 Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Generated/HqlSqlWalker.cs trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/HqlSqlWalker.g Modified: trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Generated/HqlSqlWalker.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Generated/HqlSqlWalker.cs 2009-06-10 15:56:57 UTC (rev 4446) +++ trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Generated/HqlSqlWalker.cs 2009-06-10 18:30:18 UTC (rev 4447) @@ -1,4 +1,4 @@ -// $ANTLR 3.1.2 /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/HqlSqlWalker.g 2009-05-14 21:14:52 +// $ANTLR 3.1.2 /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/HqlSqlWalker.g 2009-06-10 16:43:56 // The variable 'variable' is assigned but its value is never used. #pragma warning disable 168, 219 @@ -673,7 +673,7 @@ // AST REWRITE - // elements: f, u, w, s + // elements: w, f, s, u // token labels: u // rule labels: w, f, retval, s // token list labels: @@ -1630,7 +1630,7 @@ // AST REWRITE - // elements: o, w, f, s, g + // elements: f, g, o, s, w // token labels: // rule labels: o, w, f, retval, g, s // token list labels: @@ -4324,7 +4324,7 @@ // AST REWRITE - // elements: w, b + // elements: b, w // token labels: w // rule labels: retval, b // token list labels: @@ -4427,7 +4427,7 @@ // AST REWRITE - // elements: w, b + // elements: b, w // token labels: w // rule labels: retval, b // token list labels: @@ -7372,7 +7372,7 @@ }; // $ANTLR start "functionCall" - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/HqlSqlWalker.g:387:1: functionCall : ( ^(m= METHOD_CALL pathAsIdent ( ^( EXPR_LIST ( expr | comparisonExpr )* ) )? ) | ^( AGGREGATE aggregateExpr ) ); + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/HqlSqlWalker.g:387:1: functionCall : ( ^(m= METHOD_CALL pathAsIdent ( ^( EXPR_LIST ( expr | query | comparisonExpr )* ) )? ) | ^( AGGREGATE aggregateExpr ) ); public HqlSqlWalker.functionCall_return functionCall() // throws RecognitionException [1] { HqlSqlWalker.functionCall_return retval = new HqlSqlWalker.functionCall_return(); @@ -7385,23 +7385,25 @@ IASTNode m = null; IASTNode EXPR_LIST180 = null; - IASTNode AGGREGATE183 = null; + IASTNode AGGREGATE184 = null; HqlSqlWalker.pathAsIdent_return pathAsIdent179 = default(HqlSqlWalker.pathAsIdent_return); HqlSqlWalker.expr_return expr181 = default(HqlSqlWalker.expr_return); - HqlSqlWalker.comparisonExpr_return comparisonExpr182 = default(HqlSqlWalker.comparisonExpr_return); + HqlSqlWalker.query_return query182 = default(HqlSqlWalker.query_return); - HqlSqlWalker.aggregateExpr_return aggregateExpr184 = default(HqlSqlWalker.aggregateExpr_return); + HqlSqlWalker.comparisonExpr_return comparisonExpr183 = default(HqlSqlWalker.comparisonExpr_return); + HqlSqlWalker.aggregateExpr_return aggregateExpr185 = default(HqlSqlWalker.aggregateExpr_return); + IASTNode m_tree=null; IASTNode EXPR_LIST180_tree=null; - IASTNode AGGREGATE183_tree=null; + IASTNode AGGREGATE184_tree=null; try { - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/HqlSqlWalker.g:388:2: ( ^(m= METHOD_CALL pathAsIdent ( ^( EXPR_LIST ( expr | comparisonExpr )* ) )? ) | ^( AGGREGATE aggregateExpr ) ) + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/HqlSqlWalker.g:388:2: ( ^(m= METHOD_CALL pathAsIdent ( ^( EXPR_LIST ( expr | query | comparisonExpr )* ) )? ) | ^( AGGREGATE aggregateExpr ) ) int alt57 = 2; int LA57_0 = input.LA(1); @@ -7423,7 +7425,7 @@ switch (alt57) { case 1 : - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/HqlSqlWalker.g:388:4: ^(m= METHOD_CALL pathAsIdent ( ^( EXPR_LIST ( expr | comparisonExpr )* ) )? ) + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/HqlSqlWalker.g:388:4: ^(m= METHOD_CALL pathAsIdent ( ^( EXPR_LIST ( expr | query | comparisonExpr )* ) )? ) { root_0 = (IASTNode)adaptor.GetNilNode(); @@ -7447,7 +7449,7 @@ state.followingStackPointer--; adaptor.AddChild(root_1, pathAsIdent179.Tree); - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/HqlSqlWalker.g:388:57: ( ^( EXPR_LIST ( expr | comparisonExpr )* ) )? + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/HqlSqlWalker.g:388:57: ( ^( EXPR_LIST ( expr | query | comparisonExpr )* ) )? int alt56 = 2; int LA56_0 = input.LA(1); @@ -7458,7 +7460,7 @@ switch (alt56) { case 1 : - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/HqlSqlWalker.g:388:59: ^( EXPR_LIST ( expr | comparisonExpr )* ) + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/HqlSqlWalker.g:388:59: ^( EXPR_LIST ( expr | query | comparisonExpr )* ) { _last = (IASTNode)input.LT(1); { @@ -7475,22 +7477,73 @@ if ( input.LA(1) == Token.DOWN ) { Match(input, Token.DOWN, null); - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/HqlSqlWalker.g:388:71: ( expr | comparisonExpr )* + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/HqlSqlWalker.g:388:71: ( expr | query | comparisonExpr )* do { - int alt55 = 3; - int LA55_0 = input.LA(1); - - if ( (LA55_0 == COUNT || LA55_0 == DOT || LA55_0 == FALSE || LA55_0 == NULL || LA55_0 == TRUE || LA55_0 == CASE || LA55_0 == AGGREGATE || LA55_0 == CASE2 || LA55_0 == INDEX_OP || LA55_0 == METHOD_CALL || LA55_0 == UNARY_MINUS || (LA55_0 >= VECTOR_EXPR && LA55_0 <= WEIRD_IDENT) || (LA55_0 >= NUM_INT && LA55_0 <= JAVA_CONSTANT) || (LA55_0 >= BNOT && LA55_0 <= BAND) || (LA55_0 >= PLUS && LA55_0 <= DIV) || (LA55_0 >= COLON && LA55_0 <= IDENT)) ) + int alt55 = 4; + switch ( input.LA(1) ) { + case COUNT: + case DOT: + case FALSE: + case NULL: + case TRUE: + case CASE: + case AGGREGATE: + case CASE2: + case INDEX_OP: + case METHOD_CALL: + case UNARY_MINUS: + case VECTOR_EXPR: + case WEIRD_IDENT: + case NUM_INT: + case NUM_DOUBLE: + case NUM_FLOAT: + case NUM_LONG: + case JAVA_CONSTANT: + case BNOT: + case BOR: + case BXOR: + case BAND: + case PLUS: + case MINUS: + case STAR: + case DIV: + case COLON: + case PARAM: + case QUOTED_String: + case IDENT: + { alt55 = 1; - } - else if ( (LA55_0 == BETWEEN || LA55_0 == EXISTS || LA55_0 == IN || LA55_0 == LIKE || (LA55_0 >= IS_NOT_NULL && LA55_0 <= IS_NULL) || (LA55_0 >= NOT_BETWEEN && LA55_0 <= NOT_LIKE) || LA55_0 == EQ || LA55_0 == NE || (LA55_0 >= LT && LA55_0 <= GE)) ) - { + } + break; + case QUERY: + { alt55 = 2; + } + break; + case BETWEEN: + case EXISTS: + case IN: + case LIKE: + case IS_NOT_NULL: + case IS_NULL: + case NOT_BETWEEN: + case NOT_IN: + case NOT_LIKE: + case EQ: + case NE: + case LT: + case GT: + case LE: + case GE: + { + alt55 = 3; + } + break; + } - switch (alt55) { case 1 : @@ -7506,18 +7559,30 @@ } break; case 2 : - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/HqlSqlWalker.g:388:79: comparisonExpr + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/HqlSqlWalker.g:388:79: query { _last = (IASTNode)input.LT(1); - PushFollow(FOLLOW_comparisonExpr_in_functionCall2053); - comparisonExpr182 = comparisonExpr(); + PushFollow(FOLLOW_query_in_functionCall2053); + query182 = query(); state.followingStackPointer--; - adaptor.AddChild(root_2, comparisonExpr182.Tree); + adaptor.AddChild(root_2, query182.Tree); } break; + case 3 : + // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/HqlSqlWalker.g:388:87: comparisonExpr + { + _last = (IASTNode)input.LT(1); + PushFollow(FOLLOW_comparisonExpr_in_functionCall2057); + comparisonExpr183 = comparisonExpr(); + state.followingStackPointer--; + adaptor.AddChild(root_2, comparisonExpr183.Tree); + + } + break; + default: goto loop55; } @@ -7555,20 +7620,20 @@ IASTNode _save_last_1 = _last; IASTNode _first_1 = null; IASTNode root_1 = (IASTNode)adaptor.GetNilNode();_last = (IASTNode)input.LT(1); - AGGREGATE183=(IASTNode)Match(input,AGGREGATE,FOLLOW_AGGREGATE_in_functionCall2072); - AGGREGATE183_tree = (IASTNode)adaptor.DupNode(AGGREGATE183); + AGGREGATE184=(IASTNode)Match(input,AGGREGATE,FOLLOW_AGGREGATE_in_functionCall2076); + AGGREGATE184_tree = (IASTNode)adaptor.DupNode(AGGREGATE184); - root_1 = (IASTNode)adaptor.BecomeRoot(AGGREGATE183_tree, root_1); + root_1 = (IASTNode)adaptor.BecomeRoot(AGGREGATE184_tree, root_1); Match(input, Token.DOWN, null); _last = (IASTNode)input.LT(1); - PushFollow(FOLLOW_aggregateExpr_in_functionCall2074); - aggregateExpr184 = aggregateExpr(); + PushFollow(FOLLOW_aggregateExpr_in_functionCall2078); + aggregateExpr185 = aggregateExpr(); state.followingStackPointer--; - adaptor.AddChild(root_1, aggregateExpr184.Tree); + adaptor.AddChild(root_1, aggregateExpr185.Tree); Match(input, Token.UP, null); adaptor.AddChild(root_0, root_1);_last = _save_last_1; } @@ -7617,15 +7682,15 @@ IASTNode t = null; IASTNode f = null; - IASTNode NULL186 = null; - IASTNode JAVA_CONSTANT187 = null; - HqlSqlWalker.literal_return literal185 = default(HqlSqlWalker.literal_return); + IASTNode NULL187 = null; + IASTNode JAVA_CONSTANT188 = null; + HqlSqlWalker.literal_return literal186 = default(HqlSqlWalker.literal_return); IASTNode t_tree=null; IASTNode f_tree=null; - IASTNode NULL186_tree=null; - IASTNode JAVA_CONSTANT187_tree=null; + IASTNode NULL187_tree=null; + IASTNode JAVA_CONSTANT188_tree=null; try { @@ -7677,11 +7742,11 @@ root_0 = (IASTNode)adaptor.GetNilNode(); _last = (IASTNode)input.LT(1); - PushFollow(FOLLOW_literal_in_constant2087); - literal185 = literal(); + PushFollow(FOLLOW_literal_in_constant2091); + literal186 = literal(); state.followingStackPointer--; - adaptor.AddChild(root_0, literal185.Tree); + adaptor.AddChild(root_0, literal186.Tree); } break; @@ -7691,10 +7756,10 @@ root_0 = (IASTNode)adaptor.GetNilNode(); _last = (IASTNode)input.LT(1); - NULL186=(IASTNode)Match(input,NULL,FOLLOW_NULL_in_constant2092); - NULL186_tree = (IASTNode)adaptor.DupNode(NULL186); + NULL187=(IASTNode)Match(input,NULL,FOLLOW_NULL_in_constant2096); + NULL187_tree = (IASTNode)adaptor.DupNode(NULL187); - adaptor.AddChild(root_0, NULL186_tree); + adaptor.AddChild(root_0, NULL187_tree); } @@ -7705,7 +7770,7 @@ root_0 = (IASTNode)adaptor.GetNilNode(); _last = (IASTNode)input.LT(1); - t=(IASTNode)Match(input,TRUE,FOLLOW_TRUE_in_constant2099); + t=(IASTNode)Match(input,TRUE,FOLLOW_TRUE_in_constant2103); t_tree = (IASTNode)adaptor.DupNode(t); adaptor.AddChild(root_0, t_tree); @@ -7720,7 +7785,7 @@ root_0 = (IASTNode)adaptor.GetNilNode(); _last = (IASTNode)input.LT(1); - f=(IASTNode)Match(input,FALSE,FOLLOW_FALSE_in_constant2109); + f=(IASTNode)Match(input,FALSE,FOLLOW_FALSE_in_constant2113); f_tree = (IASTNode)adaptor.DupNode(f); adaptor.AddChild(root_0, f_tree); @@ -7735,10 +7800,10 @@ root_0 = (IASTNode)adaptor.GetNilNode(); _last = (IASTNode)input.LT(1); - JAVA_CONSTANT187=(IASTNode)Match(input,JAVA_CONSTANT,FOLLOW_JAVA_CONSTANT_in_constant2116); - JAVA_CONSTANT187_tree = (IASTNode)adaptor.DupNode(JAVA_CONSTANT187); + JAVA_CONSTANT188=(IASTNode)Match(input,JAVA_CONSTANT,FOLLOW_JAVA_CONSTANT_in_constant2120); + JAVA_CONSTANT188_tree = (IASTNode)adaptor.DupNode(JAVA_CONSTANT188); - adaptor.AddChild(root_0, JAVA_CONSTANT187_tree); + adaptor.AddChild(root_0, JAVA_CONSTANT188_tree); } @@ -7782,9 +7847,9 @@ IASTNode _first_0 = null; IASTNode _last = null; - HqlSqlWalker.numericLiteral_return numericLiteral188 = default(HqlSqlWalker.numericLiteral_return); + HqlSqlWalker.numericLiteral_return numericLiteral189 = default(HqlSqlWalker.numericLiteral_return); - HqlSqlWalker.stringLiteral_return stringLiteral189 = default(HqlSqlWalker.stringLiteral_return); + HqlSqlWalker.stringLiteral_return stringLiteral190 = default(HqlSqlWalker.stringLiteral_return); @@ -7817,11 +7882,11 @@ root_0 = (IASTNode)adaptor.GetNilNode(); _last = (IASTNode)input.LT(1); - PushFollow(FOLLOW_numericLiteral_in_literal2127); - numericLiteral188 = numericLiteral(); + PushFollow(FOLLOW_numericLiteral_in_literal2131); + numericLiteral189 = numericLiteral(); state.followingStackPointer--; - adaptor.AddChild(root_0, numericLiteral188.Tree); + adaptor.AddChild(root_0, numericLiteral189.Tree); } break; @@ -7831,11 +7896,11 @@ root_0 = (IASTNode)adaptor.GetNilNode(); _last = (IASTNode)input.LT(1); - PushFollow(FOLLOW_stringLiteral_in_literal2132); - stringLiteral189 = stringLiteral(); + PushFollow(FOLLOW_stringLiteral_in_literal2136); + stringLiteral190 = stringLiteral(); state.followingStackPointer--; - adaptor.AddChild(root_0, stringLiteral189.Tree); + adaptor.AddChild(root_0, stringLiteral190.Tree); } break; @@ -7878,9 +7943,9 @@ IASTNode _first_0 = null; IASTNode _last = null; - IASTNode set190 = null; + IASTNode set191 = null; - IASTNode set190_tree=null; + IASTNode set191_tree=null; try { @@ -7890,14 +7955,14 @@ root_0 = (IASTNode)adaptor.GetNilNode(); _last = (IASTNode)input.LT(1); - set190 = (IASTNode)input.LT(1); + set191 = (IASTNode)input.LT(1); if ( (input.LA(1) >= NUM_INT && input.LA(1) <= NUM_LONG) ) { input.Consume(); - set190_tree = (IASTNode)adaptor.DupNode(set190); + set191_tree = (IASTNode)adaptor.DupNode(set191); - adaptor.AddChild(root_0, set190_tree); + adaptor.AddChild(root_0, set191_tree); state.errorRecovery = false; } @@ -7951,9 +8016,9 @@ IASTNode _first_0 = null; IASTNode _last = null; - IASTNode QUOTED_String191 = null; + IASTNode QUOTED_String192 = null; - IASTNode QUOTED_String191_tree=null; + IASTNode QUOTED_String192_tree=null; try { @@ -7963,10 +8028,10 @@ root_0 = (IASTNode)adaptor.GetNilNode(); _last = (IASTNode)input.LT(1); - QUOTED_String191=(IASTNode)Match(input,QUOTED_String,FOLLOW_QUOTED_String_in_stringLiteral2174); - QUOTED_String191_tree = (IASTNode)adaptor.DupNode(QUOTED_String191); + QUOTED_String192=(IASTNode)Match(input,QUOTED_String,FOLLOW_QUOTED_String_in_stringLiteral2178); + QUOTED_String192_tree = (IASTNode)adaptor.DupNode(QUOTED_String192); - adaptor.AddChild(root_0, QUOTED_String191_tree); + adaptor.AddChild(root_0, QUOTED_String192_tree); } @@ -8008,9 +8073,9 @@ IASTNode _first_0 = null; IASTNode _last = null; - IASTNode set192 = null; + IASTNode set193 = null; - IASTNode set192_tree=null; + IASTNode set193_tree=null; try { @@ -8020,14 +8085,14 @@ root_0 = (IASTNode)adaptor.GetNilNode(); _last = (IASTNode)input.LT(1); - set192 = (IASTNode)input.LT(1); + set193 = (IASTNode)input.LT(1); if ( input.LA(1) == WEIRD_IDENT || input.LA(1) == IDENT ) { input.Consume(); - set192_tree = (IASTNode)adaptor.DupNode(set192); + set193_tree = (IASTNode)adaptor.DupNode(set193); - adaptor.AddChild(root_0, set192_tree); + adaptor.AddChild(root_0, set193_tree); state.errorRecovery = false; } @@ -8077,11 +8142,11 @@ IASTNode _first_0 = null; IASTNode _last = null; - HqlSqlWalker.addrExprDot_return addrExprDot193 = default(HqlSqlWalker.addrExprDot_return); + HqlSqlWalker.addrExprDot_return addrExprDot194 = default(HqlSqlWalker.addrExprDot_return); - HqlSqlWalker.addrExprIndex_return addrExprIndex194 = default(HqlSqlWalker.addrExprIndex_return); + HqlSqlWalker.addrExprIndex_return addrExprIndex195 = default(HqlSqlWalker.addrExprIndex_return); - HqlSqlWalker.addrExprIdent_return addrExprIdent195 = default(HqlSqlWalker.addrExprIdent_return); + HqlSqlWalker.addrExprIdent_return addrExprIdent196 = default(HqlSqlWalker.addrExprIdent_return); @@ -8122,11 +8187,11 @@ root_0 = (IASTNode)adaptor.GetNilNode(); _last = (IASTNode)input.LT(1); - PushFollow(FOLLOW_addrExprDot_in_addrExpr2204); - addrExprDot193 = addrExprDot(root); + PushFollow(FOLLOW_addrExprDot_in_addrExpr2208); + addrExprDot194 = addrExprDot(root); state.followingStackPointer--; - adaptor.AddChild(root_0, addrExprDot193.Tree); + adaptor.AddChild(root_0, addrExprDot194.Tree); } break; @@ -8136,11 +8201,11 @@ root_0 = (IASTNode)adaptor.GetNilNode(); _last = (IASTNode)input.LT(1); - PushFollow(FOLLOW_addrExprIndex_in_addrExpr2211); - addrExprIndex194 = addrExprIndex(root); + PushFollow(FOLLOW_addrExprIndex_in_addrExpr2215); + addrExprIndex195 = addrExprIndex(root); state.followingStackPointer--; - adaptor.AddChild(root_0, addrExprIndex194.Tree); + adaptor.AddChild(root_0, addrExprIndex195.Tree); } break; @@ -8150,11 +8215,11 @@ root_0 = (IASTNode)adaptor.GetNilNode(); _last = (IASTNode)input.LT(1); - PushFollow(FOLLOW_addrExprIdent_in_addrExpr2218); - addrExprIdent195 = addrExprIdent(root); + PushFollow(FOLLOW_addrExprIdent_in_addrExpr2222); + addrExprIdent196 = addrExprIdent(root); state.followingStackPointer--; - adaptor.AddChild(root_0, addrExprIdent195.Tree); + adaptor.AddChild(root_0, addrExprIdent196.Tree); } break; @@ -8217,20 +8282,20 @@ IASTNode _save_last_1 = _last; IASTNode _first_1 = null; IASTNode root_1 = (IASTNode)adaptor.GetNilNode();_last = (IASTNode)input.LT(1); - d=(IASTNode)Match(input,DOT,FOLLOW_DOT_in_addrExprDot2242); + d=(IASTNode)Match(input,DOT,FOLLOW_DOT_in_addrExprDot2246); stream_DOT.Add(d); Match(input, Token.DOWN, null); _last = (IASTNode)input.LT(1); - PushFollow(FOLLOW_addrExprLhs_in_addrExprDot2246); + PushFollow(FOLLOW_addrExprLhs_in_addrExprDot2250); lhs = addrExprLhs(); state.followingStackPointer--; stream_addrExprLhs.Add(lhs.Tree); _last = (IASTNode)input.LT(1); - PushFollow(FOLLOW_propertyName_in_addrExprDot2250); + PushFollow(FOLLOW_propertyName_in_addrExprDot2254); rhs = propertyName(); state.followingStackPointer--; @@ -8242,7 +8307,7 @@ // AST REWRITE - // elements: rhs, lhs, d + // elements: d, lhs, rhs // token labels: d // rule labels: lhs, retval, rhs // token list labels: @@ -8333,20 +8398,20 @@ IASTNode _save_last_1 = _last; IASTNode _first_1 = null; IASTNode root_1 = (IASTNode)adaptor.GetNilNode();_last = (IASTNode)input.LT(1); - i=(IASTNode)Match(input,INDEX_OP,FOLLOW_INDEX_OP_in_addrExprIndex2289); + i=(IASTNode)Match(input,INDEX_OP,FOLLOW_INDEX_OP_in_addrExprIndex2293); stream_INDEX_OP.Add(i); Match(input, Token.DOWN, null); _last = (IASTNode)input.LT(1); - PushFollow(FOLLOW_addrExprLhs_in_addrExprIndex2293); + PushFollow(FOLLOW_addrExprLhs_in_addrExprIndex2297); lhs2 = addrExprLhs(); state.followingStackPointer--; stream_addrExprLhs.Add(lhs2.Tree); _last = (IASTNode)input.LT(1); - PushFollow(FOLLOW_expr_in_addrExprIndex2297); + PushFollow(FOLLOW_expr_in_addrExprIndex2301); rhs2 = expr(); state.followingStackPointer--; @@ -8358,7 +8423,7 @@ // AST REWRITE - // elements: rhs2, lhs2, i + // elements: i, rhs2, lhs2 // token labels: i // rule labels: rhs2, retval, lhs2 // token list labels: @@ -8439,7 +8504,7 @@ // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/HqlSqlWalker.g:451:4: p= identifier { _last = (IASTNode)input.LT(1); - PushFollow(FOLLOW_identifier_in_addrExprIdent2329); + PushFollow(FOLLOW_identifier_in_addrExprIdent2333); p = identifier(); state.followingStackPointer--; @@ -8521,7 +8586,7 @@ IASTNode _first_0 = null; IASTNode _last = null; - HqlSqlWalker.addrExpr_return addrExpr196 = default(HqlSqlWalker.addrExpr_return); + HqlSqlWalker.addrExpr_return addrExpr197 = default(HqlSqlWalker.addrExpr_return); @@ -8533,11 +8598,11 @@ root_0 = (IASTNode)adaptor.GetNilNode(); _last = (IASTNode)input.LT(1); - PushFollow(FOLLOW_addrExpr_in_addrExprLhs2357); - addrExpr196 = addrExpr(false); + PushFollow(FOLLOW_addrExpr_in_addrExprLhs2361); + addrExpr197 = addrExpr(false); state.followingStackPointer--; - adaptor.AddChild(root_0, addrExpr196.Tree); + adaptor.AddChild(root_0, addrExpr197.Tree); } @@ -8578,15 +8643,15 @@ IASTNode _first_0 = null; IASTNode _last = null; - IASTNode CLASS198 = null; - IASTNode ELEMENTS199 = null; - IASTNode INDICES200 = null; - HqlSqlWalker.identifier_return identifier197 = default(HqlSqlWalker.identifier_return); + IASTNode CLASS199 = null; + IASTNode ELEMENTS200 = null; + IASTNode INDICES201 = null; + HqlSqlWalker.identifier_return identifier198 = default(HqlSqlWalker.identifier_return); - IASTNode CLASS198_tree=null; - IASTNode ELEMENTS199_tree=null; - IASTNode INDICES200_tree=null; + IASTNode CLASS199_tree=null; + IASTNode ELEMENTS200_tree=null; + IASTNode INDICES201_tree=null; try { @@ -8630,11 +8695,11 @@ root_0 = (IASTNode)adaptor.GetNilNode(); _last = (IASTNode)input.LT(1); - PushFollow(FOLLOW_identifier_in_propertyName2370); - identifier197 = identifier(); + PushFollow(FOLLOW_identifier_in_propertyName2374); + identifier198 = identifier(); state.followingStackPointer--; - adaptor.AddChild(root_0, identifier197.Tree); + adaptor.AddChild(root_0, identifier198.Tree); } break; @@ -8644,10 +8709,10 @@ root_0 = (IASTNode)adaptor.GetNilNode(); _last = (IASTNode)input.LT(1); - CLASS198=(IASTNode)Match(input,CLASS,FOLLOW_CLASS_in_propertyName2375); - CLASS198_tree = (IASTNode)adaptor.DupNode(CLASS198); + CLASS199=(IASTNode)Match(input,CLASS,FOLLOW_CLASS_in_propertyName2379); + CLASS199_tree = (IASTNode)adaptor.DupNode(CLASS199); - adaptor.AddChild(root_0, CLASS198_tree); + adaptor.AddChild(root_0, CLASS199_tree); } @@ -8658,10 +8723,10 @@ root_0 = (IASTNode)adaptor.GetNilNode(); _last = (IASTNode)input.LT(1); - ELEMENTS199=(IASTNode)Match(input,ELEMENTS,FOLLOW_ELEMENTS_in_propertyName2380); - ELEMENTS199_tree = (IASTNode)adaptor.DupNode(ELEMENTS199); + ELEMENTS200=(IASTNode)Match(input,ELEMENTS,FOLLOW_ELEMENTS_in_propertyName2384); + ELEMENTS200_tree = (IASTNode)adaptor.DupNode(ELEMENTS200); - adaptor.AddChild(root_0, ELEMENTS199_tree); + adaptor.AddChild(root_0, ELEMENTS200_tree); } @@ -8672,10 +8737,10 @@ root_0 = (IASTNode)adaptor.GetNilNode(); _last = (IASTNode)input.LT(1); - INDICES200=(IASTNode)Match(input,INDICES,FOLLOW_INDICES_in_propertyName2385); - INDICES200_tree = (IASTNode)adaptor.DupNode(INDICES200); + INDICES201=(IASTNode)Match(input,INDICES,FOLLOW_INDICES_in_propertyName2389); + INDICES201_tree = (IASTNode)adaptor.DupNode(INDICES201); - adaptor.AddChild(root_0, INDICES200_tree); + adaptor.AddChild(root_0, INDICES201_tree); } @@ -8719,9 +8784,9 @@ IASTNode _first_0 = null; IASTNode _last = null; - HqlSqlWalker.propertyRefPath_return propertyRefPath201 = default(HqlSqlWalker.propertyRefPath_return); + HqlSqlWalker.propertyRefPath_return propertyRefPath202 = default(HqlSqlWalker.propertyRefPath_return); - HqlSqlWalker.propertyRefIdent_return propertyRefIdent202 = default(HqlSqlWalker.propertyRefIdent_return); + HqlSqlWalker.propertyRefIdent_return propertyRefIdent203 = default(HqlSqlWalker.propertyRefIdent_return); @@ -8754,11 +8819,11 @@ root_0 = (IASTNode)adaptor.GetNilNode(); _last = (IASTNode)input.LT(1); - PushFollow(FOLLOW_propertyRefPath_in_propertyRef2397); - propertyRefPath201 = propertyRefPath(); + PushFollow(FOLLOW_propertyRefPath_in_propertyRef2401); + propertyRefPath202 = propertyRefPath(); state.followingStackPointer--; - adaptor.AddChild(root_0, propertyRefPath201.Tree); + adaptor.AddChild(root_0, propertyRefPath202.Tree); } break; @@ -8768,11 +8833,11 @@ root_0 = (IASTNode)adaptor.GetNilNode(); _last = (IASTNode)input.LT(1); - PushFollow(FOLLOW_propertyRefIdent_in_propertyRef2402); - propertyRefIdent202 = propertyRefIdent(); + PushFollow(FOLLOW_propertyRefIdent_in_propertyRef2406); + propertyRefIdent203 = propertyRefIdent(); state.followingStackPointer--; - adaptor.AddChild(root_0, propertyRefIdent202.Tree); + adaptor.AddChild(root_0, propertyRefIdent203.Tree); } break; @@ -8835,20 +8900,20 @@ IASTNode _save_last_1 = _last; IASTNode _first_1 = null; IASTNode root_1 = (IASTNode)adaptor.GetNilNode();_last = (IASTNode)input.LT(1); - d=(IASTNode)Match(input,DOT,FOLLOW_DOT_in_propertyRefPath2422); + d=(IASTNode)Match(input,DOT,FOLLOW_DOT_in_propertyRefPath2426); stream_DOT.Add(d); Match(input, Token.DOWN, null); _last = (IASTNode)input.LT(1); - PushFollow(FOLLOW_propertyRefLhs_in_propertyRefPath2426); + PushFollow(FOLLOW_propertyRefLhs_in_propertyRefPath2430); lhs = propertyRefLhs(); state.followingStackPointer--; stream_propertyRefLhs.Add(lhs.Tree); _last = (IASTNode)input.LT(1); - PushFollow(FOLLOW_propertyName_in_propertyRefPath2430); + PushFollow(FOLLOW_propertyName_in_propertyRefPath2434); rhs = propertyName(); state.followingStackPointer--; @@ -8860,7 +8925,7 @@ // AST REWRITE - // elements: d, lhs, rhs + // elements: rhs, lhs, d // token labels: d // rule labels: lhs, retval, rhs // token list labels: @@ -8944,7 +9009,7 @@ root_0 = (IASTNode)adaptor.GetNilNode(); _last = (IASTNode)input.LT(1); - PushFollow(FOLLOW_identifier_in_propertyRefIdent2467); + PushFollow(FOLLOW_identifier_in_propertyRefIdent2471); p = identifier(); state.followingStackPointer--; @@ -9002,7 +9067,7 @@ IASTNode _first_0 = null; IASTNode _last = null; - HqlSqlWalker.propertyRef_return propertyRef203 = default(HqlSqlWalker.propertyRef_return); + HqlSqlWalker.propertyRef_return propertyRef204 = default(HqlSqlWalker.propertyRef_return); @@ -9014,11 +9079,11 @@ root_0 = (IASTNode)adaptor.GetNilNode(); _last = (IASTNode)input.LT(1); - PushFollow(FOLLOW_propertyRef_in_propertyRefLhs2479); - propertyRef203 = propertyRef(); + PushFollow(FOLLOW_propertyRef_in_propertyRefLhs2483); + propertyRef204 = propertyRef(); state.followingStackPointer--; - adaptor.AddChild(root_0, propertyRef203.Tree); + adaptor.AddChild(root_0, propertyRef204.Tree); } @@ -9071,7 +9136,7 @@ root_0 = (IASTNode)adaptor.GetNilNode(); _last = (IASTNode)input.LT(1); - PushFollow(FOLLOW_identifier_in_aliasRef2500); + PushFollow(FOLLOW_identifier_in_aliasRef2504); i = identifier(); state.followingStackPointer--; @@ -9163,14 +9228,14 @@ IASTNode _save_last_1 = _last; IASTNode _first_1 = null; IASTNode root_1 = (IASTNode)adaptor.GetNilNode();_last = (IASTNode)input.LT(1); - c=(IASTNode)Match(input,COLON,FOLLOW_COLON_in_parameter2518); + c=(IASTNode)Match(input,COLON,FOLLOW_COLON_in_parameter2522); stream_COLON.Add(c); Match(input, Token.DOWN, null); _last = (IASTNode)input.LT(1); - PushFollow(FOLLOW_identifier_in_parameter2522); + PushFollow(FOLLOW_identifier_in_parameter2526); a = identifier(); state.followingStackPointer--; @@ -9215,7 +9280,7 @@ IASTNode _save_last_1 = _last; IASTNode _first_1 = null; IASTNode root_1 = (IASTNode)adaptor.GetNilNode();_last = (IASTNode)input.LT(1); - p=(IASTNode)Match(input,PARAM,FOLLOW_PARAM_in_parameter2543); + p=(IASTNode)Match(input,PARAM,FOLLOW_PARAM_in_parameter2547); stream_PARAM.Add(p); @@ -9237,7 +9302,7 @@ // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/HqlSqlWalker.g:515:15: n= NUM_INT { _last = (IASTNode)input.LT(1); - n=(IASTNode)Match(input,NUM_INT,FOLLOW_NUM_INT_in_parameter2548); + n=(IASTNode)Match(input,NUM_INT,FOLLOW_NUM_INT_in_parameter2552); stream_NUM_INT.Add(n); @@ -9330,9 +9395,9 @@ IASTNode _first_0 = null; IASTNode _last = null; - IASTNode NUM_INT204 = null; + IASTNode NUM_INT205 = null; - IASTNode NUM_INT204_tree=null; + IASTNode NUM_INT205_tree=null; try { @@ -9342,10 +9407,10 @@ root_0 = (IASTNode)adaptor.GetNilNode(); _last = (IASTNode)input.LT(1); - NUM_INT204=(IASTNode)Match(input,NUM_INT,FOLLOW_NUM_INT_in_numericInteger2581); - NUM_INT204_tree = (IASTNode)adaptor.DupNode(NUM_INT204); + NUM_INT205=(IASTNode)Match(input,NUM_INT,FOLLOW_NUM_INT_in_numericInteger2585); + NUM_INT205_tree = (IASTNode)adaptor.DupNode(NUM_INT205); - adaptor.AddChild(root_0, NUM_INT204_tree); + adaptor.AddChild(root_0, NUM_INT205_tree); } @@ -9604,48 +9669,49 @@ public static readonly BitSet FOLLOW_METHOD_CALL_in_functionCall2036 = new BitSet(new ulong[]{0x0000000000000004UL}); public static readonly BitSet FOLLOW_pathAsIdent_in_functionCall2041 = new BitSet(new ulong[]{0x0000000000000008UL,0x0000000000000200UL}); public static readonly BitSet FOLLOW_EXPR_LIST_in_functionCall2046 = new BitSet(new ulong[]{0x0000000000000004UL}); - public static readonly BitSet FOLLOW_expr_in_functionCall2049 = new BitSet(new ulong[]{0x008201C404189448UL,0x079EF7CBED07F120UL}); - public static readonly BitSet FOLLOW_comparisonExpr_in_functionCall2053 = new BitSet(new ulong[]{0x008201C404189448UL,0x079EF7CBED07F120UL}); - public static readonly BitSet FOLLOW_AGGREGATE_in_functionCall2072 = new BitSet(new ulong[]{0x0000000000000004UL}); - public static readonly BitSet FOLLOW_aggregateExpr_in_functionCall2074 = new BitSet(new ulong[]{0x0000000000000008UL}); - public static readonly BitSet FOLLOW_literal_in_constant2087 = new BitSet(new ulong[]{0x0000000000000002UL}); - public static readonly BitSet FOLLOW_NULL_in_constant2092 = new BitSet(new ulong[]{0x0000000000000002UL}); - public static readonly BitSet FOLLOW_TRUE_in_constant2099 = new BitSet(new ulong[]{0x0000000000000002UL}); - public static readonly BitSet FOLLOW_FALSE_in_constant2109 = new BitSet(new ulong[]{0x0000000000000002UL}); - public static readonly BitSet FOLLOW_JAVA_CONSTANT_in_constant2116 = new BitSet(new ulong[]{0x0000000000000002UL}); - public static readonly BitSet FOLLOW_numericLiteral_in_literal2127 = new BitSet(new ulong[]{0x0000000000000002UL}); - public static readonly BitSet FOLLOW_stringLiteral_in_literal2132 = new BitSet(new ulong[]{0x0000000000000002UL}); + public static readonly BitSet FOLLOW_expr_in_functionCall2049 = new BitSet(new ulong[]{0x008201C404189448UL,0x079EF7CBED17F120UL}); + public static readonly BitSet FOLLOW_query_in_functionCall2053 = new BitSet(new ulong[]{0x008201C404189448UL,0x079EF7CBED17F120UL}); + public static readonly BitSet FOLLOW_comparisonExpr_in_functionCall2057 = new BitSet(new ulong[]{0x008201C404189448UL,0x079EF7CBED17F120UL}); + public static readonly BitSet FOLLOW_AGGREGATE_in_functionCall2076 = new BitSet(new ulong[]{0x0000000000000004UL}); + public static readonly BitSet FOLLOW_aggregateExpr_in_functionCall2078 = new BitSet(new ulong[]{0x0000000000000008UL}); + public static readonly BitSet FOLLOW_literal_in_constant2091 = new BitSet(new ulong[]{0x0000000000000002UL}); + public static readonly BitSet FOLLOW_NULL_in_constant2096 = new BitSet(new ulong[]{0x0000000000000002UL}); + public static readonly BitSet FOLLOW_TRUE_in_constant2103 = new BitSet(new ulong[]{0x0000000000000002UL}); + public static readonly BitSet FOLLOW_FALSE_in_constant2113 = new BitSet(new ulong[]{0x0000000000000002UL}); + public static readonly BitSet FOLLOW_JAVA_CONSTANT_in_constant2120 = new BitSet(new ulong[]{0x0000000000000002UL}); + public static readonly BitSet FOLLOW_numericLiteral_in_literal2131 = new BitSet(new ulong[]{0x0000000000000002UL}); + public static readonly BitSet FOLLOW_stringLiteral_in_literal2136 = new BitSet(new ulong[]{0x0000000000000002UL}); public static readonly BitSet FOLLOW_set_in_numericLiteral0 = new BitSet(new ulong[]{0x0000000000000002UL}); - public static readonly BitSet FOLLOW_QUOTED_String_in_stringLiteral2174 = new BitSet(new ulong[]{0x0000000000000002UL}); - public static readonly BitSet FOLLOW_set_in_identifier2185 = new BitSet(new ulong[]{0x0000000000000002UL}); - public static readonly BitSet FOLLOW_addrExprDot_in_addrExpr2204 = new BitSet(new ulong[]{0x0000000000000002UL}); - public static readonly BitSet FOLLOW_addrExprIndex_in_addrExpr2211 = new BitSet(new ulong[]{0x0000000000000002UL}); - public static readonly BitSet FOLLOW_addrExprIdent_in_addrExpr2218 = new BitSet(new ulong[]{0x0000000000000002UL}); - public static readonly BitSet FOLLOW_DOT_in_addrExprDot2242 = new BitSet(new ulong[]{0x0000000000000004UL}); - public static readonly BitSet FOLLOW_addrExprLhs_in_addrExprDot2246 = new BitSet(new ulong[]{0x0000000008028800UL,0x0400000008001000UL}); - public static readonly BitSet FOLLOW_propertyName_in_addrExprDot2250 = new BitSet(new ulong[]{0x0000000000000008UL}); - public static readonly BitSet FOLLOW_INDEX_OP_in_addrExprIndex2289 = new BitSet(new ulong[]{0x0000000000000004UL}); - public static readonly BitSet FOLLOW_addrExprLhs_in_addrExprIndex2293 = new BitSet(new ulong[]{0x0082008000109000UL,0x079E03C3ED009120UL}); - public static readonly BitSet FOLLOW_expr_in_addrExprIndex2297 = new BitSet(new ulong[]{0x0000000000000008UL}); - public static readonly BitSet FOLLOW_identifier_in_addrExprIdent2329 = new BitSet(new ulong[]{0x0000000000000002UL}); - public static readonly BitSet FOLLOW_addrExpr_in_addrExprLhs2357 = new BitSet(new ulong[]{0x0000000000000002UL}); - public static readonly BitSet FOLLOW_identifier_in_propertyName2370 = new BitSet(new ulong[]{0x0000000000000002UL}); - public static readonly BitSet FOLLOW_CLASS_in_propertyName2375 = new BitSet(new ulong[]{0x0000000000000002UL}); - public static readonly BitSet FOLLOW_ELEMENTS_in_propertyName2380 = new BitSet(new ulong[]{0x0000000000000002UL}); - public static readonly BitSet FOLLOW_INDICES_in_propertyName2385 = new BitSet(new ulong[]{0x0000000000000002UL}); - public static readonly BitSet FOLLOW_propertyRefPath_in_propertyRef2397 = new BitSet(new ulong[]{0x0000000000000002UL}); - public static readonly BitSet FOLLOW_propertyRefIdent_in_propertyRef2402 = new BitSet(new ulong[]{0x0000000000000002UL}); - public static readonly BitSet FOLLOW_DOT_in_propertyRefPath2422 = new BitSet(new ulong[]{0x0000000000000004UL}); - public static readonly BitSet FOLLOW_propertyRefLhs_in_propertyRefPath2426 = new BitSet(new ulong[]{0x0000000008028800UL,0x0400000008001000UL}); - public static readonly BitSet FOLLOW_propertyName_in_propertyRefPath2430 = new BitSet(new ulong[]{0x0000000000000008UL}); - public static readonly BitSet FOLLOW_identifier_in_propertyRefIdent2467 = new BitSet(new ulong[]{0x0000000000000002UL}); - public static readonly BitSet FOLLOW_propertyRef_in_propertyRefLhs2479 = new BitSet(new ulong[]{0x0000000000000002UL}); - public static readonly BitSet FOLLOW_identifier_in_aliasRef2500 = new BitSet(new ulong[]{0x0000000000000002UL}); - public static readonly BitSet FOLLOW_COLON_in_parameter2518 = new BitSet(new ulong[]{0x0000000000000004UL}); - public static readonly BitSet FOLLOW_identifier_in_parameter2522 = new BitSet(new ulong[]{0x0000000000000008UL}); - public static readonly BitSet FOLLOW_PARAM_in_parameter2543 = new BitSet(new ulong[]{0x0000000000000004UL}); - public static readonly BitSet FOLLOW_NUM_INT_in_parameter2548 = new BitSet(new ulong[]{0x0000000000000008UL}); - public static readonly BitSet FOLLOW_NUM_INT_in_numericInteger2581 = new BitSet(new ulong[]{0x0000000000000002UL}); + public static readonly BitSet FOLLOW_QUOTED_String_in_stringLiteral2178 = new BitSet(new ulong[]{0x0000000000000002UL}); + public static readonly BitSet FOLLOW_set_in_identifier2189 = new BitSet(new ulong[]{0x0000000000000002UL}); + public static readonly BitSet FOLLOW_addrExprDot_in_addrExpr2208 = new BitSet(new ulong[]{0x0000000000000002UL}); + public static readonly BitSet FOLLOW_addrExprIndex_in_addrExpr2215 = new BitSet(new ulong[]{0x0000000000000002UL}); + public static readonly BitSet FOLLOW_addrExprIdent_in_addrExpr2222 = new BitSet(new ulong[]{0x0000000000000002UL}); + public static readonly BitSet FOLLOW_DOT_in_addrExprDot2246 = new BitSet(new ulong[]{0x0000000000000004UL}); + public static readonly BitSet FOLLOW_addrExprLhs_in_addrExprDot2250 = new BitSet(new ulong[]{0x0000000008028800UL,0x0400000008001000UL}); + public static readonly BitSet FOLLOW_propertyName_in_addrExprDot2254 = new BitSet(new ulong[]{0x0000000000000008UL}); + public static readonly BitSet FOLLOW_INDEX_OP_in_addrExprIndex2293 = new BitSet(new ulong[]{0x0000000000000004UL}); + public static readonly BitSet FOLLOW_addrExprLhs_in_addrExprIndex2297 = new BitSet(new ulong[]{0x0082008000109000UL,0x079E03C3ED009120UL}); + public static readonly BitSet FOLLOW_expr_in_addrExprIndex2301 = new BitSet(new ulong[]{0x0000000000000008UL}); + public static readonly BitSet FOLLOW_identifier_in_addrExprIdent2333 = new BitSet(new ulong[]{0x0000000000000002UL}); + public static readonly BitSet FOLLOW_addrExpr_in_addrExprLhs2361 = new BitSet(new ulong[]{0x0000000000000002UL}); + public static readonly BitSet FOLLOW_identifier_in_propertyName2374 = new BitSet(new ulong[]{0x0000000000000002UL}); + public static readonly BitSet FOLLOW_CLASS_in_propertyName2379 = new BitSet(new ulong[]{0x0000000000000002UL}); + public static readonly BitSet FOLLOW_ELEMENTS_in_propertyName2384 = new BitSet(new ulong[]{0x0000000000000002UL}); + public static readonly BitSet FOLLOW_INDICES_in_propertyName2389 = new BitSet(new ulong[]{0x0000000000000002UL}); + public static readonly BitSet FOLLOW_propertyRefPath_in_propertyRef2401 = new BitSet(new ulong[]{0x0000000000000002UL}); + public static readonly BitSet FOLLOW_propertyRefIdent_in_propertyRef2406 = new BitSet(new ulong[]{0x0000000000000002UL}); + public static readonly BitSet FOLLOW_DOT_in_propertyRefPath2426 = new BitSet(new ulong[]{0x0000000000000004UL}); + public static readonly BitSet FOLLOW_propertyRefLhs_in_propertyRefPath2430 = new BitSet(new ulong[]{0x0000000008028800UL,0x0400000008001000UL}); + public static readonly BitSet FOLLOW_propertyName_in_propertyRefPath2434 = new BitSet(new ulong[]{0x0000000000000008UL}); + public static readonly BitSet FOLLOW_identifier_in_propertyRefIdent2471 = new BitSet(new ulong[]{0x0000000000000002UL}); + public static readonly BitSet FOLLOW_propertyRef_in_propertyRefLhs2483 = new BitSet(new ulong[]{0x0000000000000002UL}); + public static readonly BitSet FOLLOW_identifier_in_aliasRef2504 = new BitSet(new ulong[]{0x0000000000000002UL}); + public static readonly BitSet FOLLOW_COLON_in_parameter2522 = new BitSet(new ulong[]{0x0000000000000004UL}); + public static readonly BitSet FOLLOW_identifier_in_parameter2526 = new BitSet(new ulong[]{0x0000000000000008UL}); + public static readonly BitSet FOLLOW_PARAM_in_parameter2547 = new BitSet(new ulong[]{0x0000000000000004UL}); + public static readonly BitSet FOLLOW_NUM_INT_in_parameter2552 = new BitSet(new ulong[]{0x0000000000000008UL}); + public static readonly BitSet FOLLOW_NUM_INT_in_numericInteger2585 = new BitSet(new ulong[]{0x0000000000000002UL}); } } \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/HqlSqlWalker.g =================================================================== --- trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/HqlSqlWalker.g 2009-06-10 15:56:57 UTC (rev 4446) +++ trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/HqlSqlWalker.g 2009-06-10 18:30:18 UTC (rev 4447) @@ -385,7 +385,7 @@ ; functionCall - : ^(m=METHOD_CALL {_inFunctionCall=true;} pathAsIdent ( ^(EXPR_LIST (expr | comparisonExpr)* ) )? ) + : ^(m=METHOD_CALL {_inFunctionCall=true;} pathAsIdent ( ^(EXPR_LIST (expr | query | comparisonExpr)* ) )? ) { ProcessFunction($m.tree,_inSelect); _inFunctionCall=false; } | ^(AGGREGATE aggregateExpr ) ; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dar...@us...> - 2009-06-10 15:57:04
|
Revision: 4446 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4446&view=rev Author: darioquintana Date: 2009-06-10 15:56:57 +0000 (Wed, 10 Jun 2009) Log Message: ----------- Removing ugly solution for floating point assert. Thanks to David Bachmann for the tip. Modified Paths: -------------- trunk/nhibernate/src/NHibernate.Test/HQL/HQLFunctions.cs Modified: trunk/nhibernate/src/NHibernate.Test/HQL/HQLFunctions.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/HQL/HQLFunctions.cs 2009-06-10 14:46:46 UTC (rev 4445) +++ trunk/nhibernate/src/NHibernate.Test/HQL/HQLFunctions.cs 2009-06-10 15:56:57 UTC (rev 4446) @@ -567,6 +567,8 @@ [Test] public void Cast() { + const double magicResult = 7 + 123 - 5*1.3d; + IgnoreIfNotSupported("cast"); // The cast is used to test various cases of a function render // Cast was selected because represent a special case for: @@ -596,13 +598,7 @@ hql = "select cast(7+123-5*a.BodyWeight as Double) from Animal a"; l = s.CreateQuery(hql).List(); Assert.AreEqual(1, l.Count); - - if(Dialect is PostgreSQLDialect) - Assert.AreEqual(123.500000238419d, l[0]); - else - { - Assert.AreEqual(7 + 123 - 5 * 1.3d, l[0]); - } + Assert.AreEqual(magicResult, (double)l[0], 0.00001); // Rendered in SELECT using a property and nested functions if (!(Dialect is Oracle8iDialect)) @@ -653,13 +649,7 @@ hql = "select cast(7+123-5*a.BodyWeight as Double) from Animal a group by cast(7+123-5*a.BodyWeight as Double)"; l = s.CreateQuery(hql).List(); Assert.AreEqual(1, l.Count); - - if (Dialect is PostgreSQLDialect) - Assert.AreEqual(123.500000238419d, l[0]); - else - { - Assert.AreEqual(7 + 123 - 5 * 1.3d, l[0]); - } + Assert.AreEqual(magicResult, (double)l[0], 0.00001); // Rendered in GROUP BY using a property and nested functions if (!(Dialect is Oracle8iDialect)) @@ -743,11 +733,7 @@ string hql = "select cast(a.BodyWeight As Double) from Animal a"; IList l = s.CreateQuery(hql).List(); Assert.AreEqual(1, l.Count); - - if(Dialect is PostgreSQLDialect) - Assert.AreEqual(1.29999995231628d, l[0]); - else - Assert.AreEqual(1.3f, l[0]); + Assert.AreEqual(1.3f, (double)l[0], 0.00001); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2009-06-10 14:46:47
|
Revision: 4445 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4445&view=rev Author: fabiomaulo Date: 2009-06-10 14:46:46 +0000 (Wed, 10 Jun 2009) Log Message: ----------- Fix NH-1829 Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Persister/Entity/AbstractEntityPersister.cs Modified: trunk/nhibernate/src/NHibernate/Persister/Entity/AbstractEntityPersister.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Persister/Entity/AbstractEntityPersister.cs 2009-06-10 14:32:01 UTC (rev 4444) +++ trunk/nhibernate/src/NHibernate/Persister/Entity/AbstractEntityPersister.cs 2009-06-10 14:46:46 UTC (rev 4445) @@ -2336,16 +2336,16 @@ return insert.ToSqlCommandInfo(); } - protected SqlCommandInfo GenerateDeleteString(int j) + protected virtual SqlCommandInfo GenerateDeleteString(int j) { - SqlDeleteBuilder deleteBuilder = new SqlDeleteBuilder(Factory.Dialect, Factory); + var deleteBuilder = new SqlDeleteBuilder(Factory.Dialect, Factory); deleteBuilder .SetTableName(GetTableName(j)) .SetIdentityColumn(GetKeyColumns(j), IdentifierType); if (j == 0 && IsVersioned) { - deleteBuilder.SetVersionColumn(new string[] { VersionColumnName }, VersionType); + deleteBuilder.SetVersionColumn(new[] { VersionColumnName }, VersionType); } if (Factory.Settings.IsCommentsEnabled) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2009-06-10 14:32:34
|
Revision: 4444 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4444&view=rev Author: fabiomaulo Date: 2009-06-10 14:32:01 +0000 (Wed, 10 Jun 2009) Log Message: ----------- Fix NH-1827 Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Dialect/Schema/MySQLMetaData.cs Modified: trunk/nhibernate/src/NHibernate/Dialect/Schema/MySQLMetaData.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Dialect/Schema/MySQLMetaData.cs 2009-06-10 14:25:57 UTC (rev 4443) +++ trunk/nhibernate/src/NHibernate/Dialect/Schema/MySQLMetaData.cs 2009-06-10 14:32:01 UTC (rev 4444) @@ -1,6 +1,7 @@ using System; using System.Data; using System.Data.Common; +using Iesi.Collections.Generic; namespace NHibernate.Dialect.Schema { @@ -19,6 +20,17 @@ { get { return "Foreign Keys"; } } + + public override ISet<string> GetReservedWords() + { + var result = new HashedSet<string>(); + DataTable dtReservedWords = Connection.GetSchema(DbMetaDataCollectionNames.ReservedWords); + foreach (DataRow row in dtReservedWords.Rows) + { + result.Add(row["Reserved Word"].ToString()); + } + return result; + } } public class MySQLTableMetadata : AbstractTableMetadata This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2009-06-10 14:26:10
|
Revision: 4443 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4443&view=rev Author: fabiomaulo Date: 2009-06-10 14:25:57 +0000 (Wed, 10 Jun 2009) Log Message: ----------- Fix NH-1822 Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Util/TypeNameParser.cs trunk/nhibernate/src/NHibernate.Test/UtilityTest/TypeNameParserFixture.cs Modified: trunk/nhibernate/src/NHibernate/Util/TypeNameParser.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Util/TypeNameParser.cs 2009-06-10 05:30:11 UTC (rev 4442) +++ trunk/nhibernate/src/NHibernate/Util/TypeNameParser.cs 2009-06-10 14:25:57 UTC (rev 4443) @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Text; +using System.Text.RegularExpressions; namespace NHibernate.Util { @@ -14,6 +15,8 @@ { private readonly string defaultNamespace; private readonly string defaultAssembly; + private static readonly Regex WhiteSpaces = new Regex(@"[\t\r\n]", RegexOptions.Compiled); + private static readonly Regex MultipleSpaces = new Regex(@"[ ]+", RegexOptions.Compiled); public TypeNameParser(string defaultNamespace, string defaultAssembly) { @@ -31,17 +34,18 @@ return new TypeNameParser(defaultNamespace, defaultAssembly).ParseTypeName(type); } - public AssemblyQualifiedTypeName ParseTypeName(string type) + public AssemblyQualifiedTypeName ParseTypeName(string typeName) { - if (type == null) + if (typeName == null) { - throw new ArgumentNullException("type"); + throw new ArgumentNullException("typeName"); } - if (type.Trim('[',']','\\', ',') == string.Empty) + var type = WhiteSpaces.Replace(typeName, " "); + type = MultipleSpaces.Replace(type, " ").Replace(", [", ",[").Replace("[ [", "[[").Replace("] ]", "]]"); + if (type.Trim(' ','[', ']', '\\', ',') == string.Empty) { - throw new ArgumentException(string.Format("The type to parse is not a type name:{0}", type), "type"); + throw new ArgumentException(string.Format("The type to parse is not a type name:{0}", typeName), "typeName"); } - int genericTypeArgsStartIdx = type.IndexOf('['); int genericTypeArgsEndIdx = type.LastIndexOf(']'); int genericTypeCardinalityIdx = -1; Modified: trunk/nhibernate/src/NHibernate.Test/UtilityTest/TypeNameParserFixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/UtilityTest/TypeNameParserFixture.cs 2009-06-10 05:30:11 UTC (rev 4442) +++ trunk/nhibernate/src/NHibernate.Test/UtilityTest/TypeNameParserFixture.cs 2009-06-10 14:25:57 UTC (rev 4443) @@ -251,5 +251,19 @@ var a = TypeNameParser.Parse(typeName); Assert.AreEqual(typeName, a.ToString()); } + + [Test] + [Description("Parse with new lines")] + public void NH1822() + { + var typeName = + @"OldMutual.SalesGear.Data.ReferenceType`2[ + [OldMutual.SalesGear.Reference.Core.Channel, OldMutual.SalesGear.Reference.Core], + [OldMutual.SalesGear.Reference.Core.Channels, OldMutual.SalesGear.Reference.Core] + ], OldMutual.SalesGear.Data"; + var expected = "OldMutual.SalesGear.Data.ReferenceType`2[[OldMutual.SalesGear.Reference.Core.Channel, OldMutual.SalesGear.Reference.Core],[OldMutual.SalesGear.Reference.Core.Channels, OldMutual.SalesGear.Reference.Core]], OldMutual.SalesGear.Data"; + var a = TypeNameParser.Parse(typeName); + Assert.That(a.ToString(), Is.EqualTo(expected)); + } } } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dar...@us...> - 2009-06-10 05:31:13
|
Revision: 4442 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4442&view=rev Author: darioquintana Date: 2009-06-10 05:30:11 +0000 (Wed, 10 Jun 2009) Log Message: ----------- Test applies to MsSQLServer 2005/2008 Modified Paths: -------------- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1556/Fixture.cs Modified: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1556/Fixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1556/Fixture.cs 2009-06-10 05:07:21 UTC (rev 4441) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1556/Fixture.cs 2009-06-10 05:30:11 UTC (rev 4442) @@ -1,5 +1,6 @@ using System; using System.Collections; +using NHibernate.Dialect; using NUnit.Framework; namespace NHibernate.Test.NHSpecificTest.NH1556 @@ -7,6 +8,11 @@ [TestFixture] public class Fixture : BugTestCase { + protected override bool AppliesTo(Dialect.Dialect dialect) + { + return Dialect is MsSql2005Dialect; + } + // This test not fail but something very strange happen in various others tests // probably the problem is the implementation of QuotedAndParenthesisStringTokenizer in MsSql2005Dialect // but i'm not sure This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dar...@us...> - 2009-06-10 05:07:43
|
Revision: 4441 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4441&view=rev Author: darioquintana Date: 2009-06-10 05:07:21 +0000 (Wed, 10 Jun 2009) Log Message: ----------- Test applies to MsSQLServer 2005/2008 Modified Paths: -------------- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH645/HQLFunctionFixture.cs Modified: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH645/HQLFunctionFixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH645/HQLFunctionFixture.cs 2009-06-10 04:45:36 UTC (rev 4440) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH645/HQLFunctionFixture.cs 2009-06-10 05:07:21 UTC (rev 4441) @@ -11,11 +11,18 @@ [TestFixture] public class HQLFunctionFixture : TestCase { + private bool appliesToThisDialect = true; + protected override string MappingsAssembly { get { return "NHibernate.Test"; } } + protected override bool AppliesTo(Dialect.Dialect dialect) + { + return appliesToThisDialect; + } + protected override IList Mappings { get { return new[] {"HQL.Animal.hbm.xml", "HQL.MaterialResource.hbm.xml"}; } @@ -23,7 +30,10 @@ protected override void Configure(Configuration configuration) { - configuration.SetProperty(Environment.Dialect, typeof (CustomDialect).AssemblyQualifiedName); + if (Dialect is MsSql2005Dialect) + configuration.SetProperty(Environment.Dialect, typeof (CustomDialect).AssemblyQualifiedName); + else + appliesToThisDialect = false; } /// <summary> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dar...@us...> - 2009-06-10 04:45:38
|
Revision: 4440 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4440&view=rev Author: darioquintana Date: 2009-06-10 04:45:36 +0000 (Wed, 10 Jun 2009) Log Message: ----------- - fix for NH-1826 - bug fixed. Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Dialect/PostgreSQLDialect.cs trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Util/LiteralProcessor.cs Modified: trunk/nhibernate/src/NHibernate/Dialect/PostgreSQLDialect.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Dialect/PostgreSQLDialect.cs 2009-06-10 03:08:30 UTC (rev 4439) +++ trunk/nhibernate/src/NHibernate/Dialect/PostgreSQLDialect.cs 2009-06-10 04:45:36 UTC (rev 4440) @@ -62,7 +62,7 @@ RegisterFunction("current_timestamp", new NoArgSQLFunction("now", NHibernateUtil.DateTime, true)); RegisterFunction("str", new SQLFunctionTemplate(NHibernateUtil.String, "cast(?1 as varchar)")); RegisterFunction("locate", new PositionSubstringFunction()); - + RegisterFunction("iif", new SQLFunctionTemplate(null, "case when ?1 then ?2 else ?3 end")); DefaultProperties[Environment.ConnectionDriver] = "NHibernate.Driver.NpgsqlDriver"; } Modified: trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Util/LiteralProcessor.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Util/LiteralProcessor.cs 2009-06-10 03:08:30 UTC (rev 4439) +++ trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Util/LiteralProcessor.cs 2009-06-10 04:45:36 UTC (rev 4440) @@ -117,7 +117,8 @@ { // TODO: something much better - look at the type of the other expression! // TODO: Have comparisonExpression and/or arithmeticExpression rules complete the resolution of boolean nodes. - String replacement = _walker.TokenReplacements[constant.Text]; + string replacement; + _walker.TokenReplacements.TryGetValue(constant.Text, out replacement); if ( replacement != null ) { constant.Text = replacement; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dar...@us...> - 2009-06-10 03:08:47
|
Revision: 4439 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4439&view=rev Author: darioquintana Date: 2009-06-10 03:08:30 +0000 (Wed, 10 Jun 2009) Log Message: ----------- Now passing in PostgreSQL, this RDBMS has a different precision. Modified Paths: -------------- trunk/nhibernate/src/NHibernate.Test/HQL/HQLFunctions.cs Modified: trunk/nhibernate/src/NHibernate.Test/HQL/HQLFunctions.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/HQL/HQLFunctions.cs 2009-06-10 03:03:46 UTC (rev 4438) +++ trunk/nhibernate/src/NHibernate.Test/HQL/HQLFunctions.cs 2009-06-10 03:08:30 UTC (rev 4439) @@ -743,7 +743,11 @@ string hql = "select cast(a.BodyWeight As Double) from Animal a"; IList l = s.CreateQuery(hql).List(); Assert.AreEqual(1, l.Count); - Assert.AreEqual(1.3f, l[0]); + + if(Dialect is PostgreSQLDialect) + Assert.AreEqual(1.29999995231628d, l[0]); + else + Assert.AreEqual(1.3f, l[0]); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dar...@us...> - 2009-06-10 03:03:48
|
Revision: 4438 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4438&view=rev Author: darioquintana Date: 2009-06-10 03:03:46 +0000 (Wed, 10 Jun 2009) Log Message: ----------- Now passing in PostgreSQL, this RDBMS has a different precision. Modified Paths: -------------- trunk/nhibernate/src/NHibernate.Test/HQL/HQLFunctions.cs Modified: trunk/nhibernate/src/NHibernate.Test/HQL/HQLFunctions.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/HQL/HQLFunctions.cs 2009-06-09 23:08:08 UTC (rev 4437) +++ trunk/nhibernate/src/NHibernate.Test/HQL/HQLFunctions.cs 2009-06-10 03:03:46 UTC (rev 4438) @@ -596,7 +596,13 @@ hql = "select cast(7+123-5*a.BodyWeight as Double) from Animal a"; l = s.CreateQuery(hql).List(); Assert.AreEqual(1, l.Count); - Assert.AreEqual(7 + 123 - 5 * 1.3d, l[0]); + + if(Dialect is PostgreSQLDialect) + Assert.AreEqual(123.500000238419d, l[0]); + else + { + Assert.AreEqual(7 + 123 - 5 * 1.3d, l[0]); + } // Rendered in SELECT using a property and nested functions if (!(Dialect is Oracle8iDialect)) @@ -647,7 +653,13 @@ hql = "select cast(7+123-5*a.BodyWeight as Double) from Animal a group by cast(7+123-5*a.BodyWeight as Double)"; l = s.CreateQuery(hql).List(); Assert.AreEqual(1, l.Count); - Assert.AreEqual(7 + 123 - 5 * 1.3d, l[0]); + + if (Dialect is PostgreSQLDialect) + Assert.AreEqual(123.500000238419d, l[0]); + else + { + Assert.AreEqual(7 + 123 - 5 * 1.3d, l[0]); + } // Rendered in GROUP BY using a property and nested functions if (!(Dialect is Oracle8iDialect)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |