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: Michael D. <mik...@us...> - 2004-04-14 18:08:39
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/TypesTest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28570/TypesTest Added Files: GuidTypeFixture.cs TypeFactoryFixture.cs Log Message: Added test for the classes GuidType and TypeFactory --- NEW FILE: TypeFactoryFixture.cs --- using System; using NHibernate.Type; using NUnit.Framework; namespace NHibernate.Test.TypesTest { /// <summary> /// Test Fixture for TypeFactory. /// </summary> [TestFixture] public class TypeFactoryFixture { /// <summary> /// Test that calling GetGuidType multiple times returns the /// exact same GuidType object by reference. /// </summary> [Test] public void GetGuidSingleton() { NullableType guidType = TypeFactory.GetGuidType(); NullableType guidType2 = TypeFactory.GetGuidType(); Assert.AreSame(guidType, guidType2); } /// <summary> /// Test that Strings with different lengths return different StringTypes. /// </summary> [Test] public void GetStringWithDiffLength() { NullableType string25 = TypeFactory.GetStringType(25); NullableType string30 = TypeFactory.GetStringType(30); Assert.IsFalse(string25==string30, "string25 & string30 should be different strings"); } /// <summary> /// Test that the String returned from NHibernate.String and TypeFactory.GetStringType /// returns the exact same Type. /// </summary> [Test] public void GetDefaultString() { NullableType stringFromNH = NHibernate.String; NullableType stringFromTF = TypeFactory.GetStringType(); Assert.AreSame(stringFromNH, stringFromTF); } } } --- NEW FILE: GuidTypeFixture.cs --- using System; using System.Data; using NHibernate.Type; using NUnit.Framework; namespace NHibernate.Test.TypesTest { /// <summary> /// The Unit Tests for the GuidType. /// </summary> [TestFixture] public class GuidTypeFixture : BaseTypeFixture { public GuidTypeFixture() { } /// <summary> /// Test that Get(IDataReader, index) returns a boxed Guid value that is what /// we expect. /// </summary> [Test] [Ignore("MockReader has not implemented GetGuid yet")] public void Get() { NullableType type = NHibernate.Guid; Guid expected = new Guid("{01234567-abcd-abcd-abcd-0123456789ab}"); // move to the first record reader.Read(); Guid actual = (Guid)type.Get(reader, GuidTypeColumnIndex); Assert.AreEqual(expected, actual); } [Test] public void EqualsTrue() { Guid lhs = new Guid("{01234567-abcd-abcd-abcd-0123456789ab}"); Guid rhs = new Guid("{01234567-abcd-abcd-abcd-0123456789ab}"); NullableType type = NHibernate.Guid; Assert.IsTrue(type.Equals(lhs, rhs)); } [Test] public void EqualsFalse() { Guid lhs = new Guid("{01234567-abcd-abcd-abcd-0123456789ab}"); Guid rhs = new Guid("{11234567-abcd-abcd-abcd-0123456789ab}"); NullableType type = NHibernate.Guid; Assert.IsFalse(type.Equals(lhs, rhs)); } /// <summary> /// Test to make sure that a boxed Guid and a struct Guid compare the /// same as two struct Guids. /// </summary> [Test] public void EqualsWithSnapshot() { Guid busObjValue = new Guid("{01234567-abcd-abcd-abcd-0123456789ab}"); object snapshotValue = busObjValue; NullableType type = NHibernate.Guid; Assert.IsTrue(type.Equals(busObjValue, snapshotValue)); // simulate the UI changing the busObjValue busObjValue = new Guid("{11234567-abcd-abcd-abcd-0123456789ab}"); Assert.IsFalse(type.Equals(busObjValue, snapshotValue)); } } } |
From: Michael D. <mik...@us...> - 2004-04-14 18:08:38
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28570 Modified Files: NHibernate.Test-1.1.csproj Log Message: Added test for the classes GuidType and TypeFactory Index: NHibernate.Test-1.1.csproj =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/NHibernate.Test-1.1.csproj,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** NHibernate.Test-1.1.csproj 12 Apr 2004 05:45:21 -0000 1.13 --- NHibernate.Test-1.1.csproj 14 Apr 2004 18:08:28 -0000 1.14 *************** *** 323,326 **** --- 323,336 ---- /> <File + RelPath = "TypesTest\GuidTypeFixture.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "TypesTest\TypeFactoryFixture.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "UtilityTest\IdentityMapFixture.cs" SubType = "Code" |
From: Michael D. <mik...@us...> - 2004-04-14 18:07:52
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.DomainModel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28361 Modified Files: BasicClass.cs BasicClass.hbm.xml Log Message: Added property to the class for a bag mapping. Index: BasicClass.hbm.xml =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.DomainModel/BasicClass.hbm.xml,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** BasicClass.hbm.xml 10 Apr 2004 03:15:44 -0000 1.5 --- BasicClass.hbm.xml 14 Apr 2004 18:07:42 -0000 1.6 *************** *** 30,34 **** <property name="YesNoProperty" type="YesNo" column="yn_p"/> - <array name="StringArray" table="bc_starr" > <key column="bc_id" /> --- 30,33 ---- *************** *** 43,46 **** --- 42,50 ---- </primitive-array> + <bag name="StringBag" table="bc_stbag"> + <key column="bc_id" /> + <element column="str_value" type="String(25)" /> + </bag> + <list name="StringList" table="bc_stlst"> <key column="bc_id" /> *************** *** 49,53 **** </list> ! <map name="StringMap" table="bc_stmap"> <key column="bc_id"/> <index column="strm_idx" type="String(10)" /> --- 53,57 ---- </list> ! <map name="StringMap" table="bc_stmap" > <key column="bc_id"/> <index column="strm_idx" type="String(10)" /> Index: BasicClass.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.DomainModel/BasicClass.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** BasicClass.cs 22 Mar 2004 04:46:21 -0000 1.3 --- BasicClass.cs 14 Apr 2004 18:07:40 -0000 1.4 *************** *** 59,65 **** private bool trueFalseProperty; private bool yesNoProperty; ! private string[] stringArray; private int[] int32Array; private IList stringList; private IDictionary stringMap; --- 59,66 ---- private bool trueFalseProperty; private bool yesNoProperty; ! private string[] stringArray; private int[] int32Array; + private IList stringBag; private IList stringList; private IDictionary stringMap; *************** *** 200,203 **** --- 201,210 ---- } + public IList StringBag + { + get { return stringBag; } + set { stringBag = value; } + } + public IList StringList { |
From: Peter S. <sz...@us...> - 2004-04-14 14:48:57
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Hql In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17813/NHibernate/Hql Modified Files: FromPathExpressionParser.cs QueryTranslator.cs Log Message: Fixed dialect. Fixed some Hql thing. Added obsoletes for quoting. Index: FromPathExpressionParser.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Hql/FromPathExpressionParser.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** FromPathExpressionParser.cs 13 Mar 2003 21:58:48 -0000 1.3 --- FromPathExpressionParser.cs 14 Apr 2004 14:48:47 -0000 1.4 *************** *** 4,21 **** using NHibernate.Sql; ! namespace NHibernate.Hql { /// <summary> /// FromPathExpressionParser /// </summary> ! public class FromPathExpressionParser : PathExpressionParser { ! public override void End(QueryTranslator q) { ! if ( !IsCollectionValued ) { IType type = GetPropertyType(q); ! if ( type.IsEntityType ) { // "finish off" the join Token(".", q); Token(null, q); ! }else if ( type.IsPersistentCollectionType ) { // default to element set if no elements() specified Token(".", q); --- 4,28 ---- using NHibernate.Sql; ! namespace NHibernate.Hql ! { /// <summary> /// FromPathExpressionParser /// </summary> ! public class FromPathExpressionParser : PathExpressionParser ! { ! public override void End(QueryTranslator q) ! { ! if ( !IsCollectionValued ) ! { IType type = GetPropertyType(q); ! if ( type.IsEntityType ) ! { // "finish off" the join Token(".", q); Token(null, q); ! } ! else if ( type.IsPersistentCollectionType ) ! { // default to element set if no elements() specified Token(".", q); *************** *** 26,30 **** } ! protected override void SetExpectingCollectionIndex() { throw new QueryException("expecting .elements or .indices after collection path expression in from"); } --- 33,38 ---- } ! protected override void SetExpectingCollectionIndex() ! { throw new QueryException("expecting .elements or .indices after collection path expression in from"); } Index: QueryTranslator.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Hql/QueryTranslator.cs,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** QueryTranslator.cs 14 Apr 2004 12:34:00 -0000 1.22 --- QueryTranslator.cs 14 Apr 2004 14:48:47 -0000 1.23 *************** *** 63,67 **** private IDictionary replacements; private int count = 0; - private int nameCount=0; private int parameterCount = 0; private string queryString; --- 63,66 ---- *************** *** 550,553 **** --- 549,553 ---- names[i] = name; includeInSelect[i] = !entitiesToFetch.Contains(name); + if ( includeInSelect[i] ) selectLength++; if ( name.Equals(collectionOwnerName) ) collectionOwnerColumn = i; } *************** *** 1155,1161 **** return sql; } ! //TODO: H2.0.3: change the dialect class!!! ! //else if (dialect.SupportsForUpdateOf) ! else if (dialect.SupportsForUpdate) { LockMode upgradeType = null; --- 1155,1159 ---- return sql; } ! else if (dialect.SupportsForUpdateOf) { LockMode upgradeType = null; |
From: Peter S. <sz...@us...> - 2004-04-14 14:48:57
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17813/NHibernate/Mapping Modified Files: Column.cs Table.cs Log Message: Fixed dialect. Fixed some Hql thing. Added obsoletes for quoting. Index: Table.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/Table.cs,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Table.cs 13 Apr 2004 17:58:11 -0000 1.10 --- Table.cs 14 Apr 2004 14:48:47 -0000 1.11 *************** *** 70,73 **** --- 70,74 ---- } + [Obsolete("Should use Quote functions")] public string GetQuotedName(Dialect.Dialect dialect) { Index: Column.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/Column.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Column.cs 13 Apr 2004 02:06:54 -0000 1.6 --- Column.cs 14 Apr 2004 14:48:47 -0000 1.7 *************** *** 54,57 **** --- 54,58 ---- } + [Obsolete("Should use Quote functions")] public string GetQuotedName(Dialect.Dialect d) { |
From: Peter S. <sz...@us...> - 2004-04-14 14:48:57
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/SqlCommand In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17813/NHibernate/SqlCommand Modified Files: Template.cs Log Message: Fixed dialect. Fixed some Hql thing. Added obsoletes for quoting. Index: Template.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/SqlCommand/Template.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Template.cs 10 Apr 2004 05:07:27 -0000 1.1 --- Template.cs 14 Apr 2004 14:48:47 -0000 1.2 *************** *** 189,192 **** --- 189,193 ---- } + [Obsolete("Should use Quote functions")] private static string Quote(string column, Dialect.Dialect dialect) { |
From: Peter S. <sz...@us...> - 2004-04-14 14:48:55
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Dialect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17813/NHibernate/Dialect Modified Files: Dialect.cs Log Message: Fixed dialect. Fixed some Hql thing. Added obsoletes for quoting. Index: Dialect.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Dialect/Dialect.cs,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** Dialect.cs 10 Apr 2004 05:06:02 -0000 1.22 --- Dialect.cs 14 Apr 2004 14:48:46 -0000 1.23 *************** *** 135,138 **** --- 135,146 ---- /// <summary> + /// Does this dialect support the <c>FOR UDPATE</c> syntax? + /// </summary> + public virtual bool SupportsForUpdateOf + { + get { return true; } + } + + /// <summary> /// Does this dialect support the Oracle-style <c>FOR UPDATE NOWAIT</c> syntax? /// </summary> *************** *** 417,420 **** --- 425,429 ---- /// The opening quote for a quoted identifier. /// </summary> + [Obsolete("Should use Quote functions")] public virtual char OpenQuote { *************** *** 425,428 **** --- 434,438 ---- /// The closing quote for a quoted identifier. /// </summary> + [Obsolete("Should use Quote functions")] public virtual char CloseQuote { *************** *** 713,716 **** --- 723,758 ---- } + /// <summary> + /// Quotes a name for being used as a tablename + /// </summary> + /// <param name="tableName">Name of the table</param> + /// <returns>Quoted name</returns> + protected virtual string QuoteForTableName(string tableName) + { + return tableName; + } + + /// <summary> + /// Quotes a name for being used as a columnname + /// </summary> + /// <remarks>Original implementation calls <see cref="QuoteForTableName"/></remarks> + /// <param name="columnName">Name of the column</param> + /// <returns>Quoted name</returns> + protected virtual string QuoteForColumnName(string columnName) + { + return QuoteForTableName(columnName); + } + + /// <summary> + /// Quotes a name for being used as a aliasname + /// </summary> + /// <remarks>Original implementation calls <see cref="QuoteForTableName"/></remarks> + /// <param name="columnName">Name of the alias</param> + /// <returns>Quoted name</returns> + protected virtual string QuoteForAliasName(string aliasName) + { + return QuoteForTableName(aliasName); + } + public class CountQueryFunctionInfo : IQueryFunctionInfo { |
From: Michael D. <mik...@us...> - 2004-04-14 14:45:46
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17400/NHibernate Modified Files: NHibernate-1.1.csproj Log Message: Added a Guid Type. Index: NHibernate-1.1.csproj =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/NHibernate-1.1.csproj,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** NHibernate-1.1.csproj 14 Apr 2004 03:06:20 -0000 1.19 --- NHibernate-1.1.csproj 14 Apr 2004 14:45:36 -0000 1.20 *************** *** 1649,1652 **** --- 1649,1657 ---- /> <File + RelPath = "Type\GuidType.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "Type\IAbstractComponentType.cs" SubType = "Code" |
From: Michael D. <mik...@us...> - 2004-04-14 14:41:05
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16544/NHibernate Modified Files: NHibernate.cs Log Message: Added a Guid Type. Testing is on local copy - some Driver's don't support guids and I added it to BasicClass for local testing. This will make the test in BasicTypes look like they are failing. The MockReader doesn't support GetGuid yet either - so that test is going to be ignored. Index: NHibernate.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/NHibernate.cs,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** NHibernate.cs 8 Apr 2004 15:55:45 -0000 1.14 --- NHibernate.cs 14 Apr 2004 14:40:51 -0000 1.15 *************** *** 65,68 **** --- 65,72 ---- public static readonly NullableType Double = TypeFactory.GetDoubleType(); + /// <summary> + /// NHibernate Guid type. + /// </summary> + public static readonly NullableType Guid = TypeFactory.GetGuidType(); /// <summary> |
From: Michael D. <mik...@us...> - 2004-04-14 14:41:05
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Type In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16544/NHibernate/Type Modified Files: Int32Type.cs TypeFactory.cs Added Files: GuidType.cs Log Message: Added a Guid Type. Testing is on local copy - some Driver's don't support guids and I added it to BasicClass for local testing. This will make the test in BasicTypes look like they are failing. The MockReader doesn't support GetGuid yet either - so that test is going to be ignored. Index: Int32Type.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/Int32Type.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Int32Type.cs 10 Feb 2004 18:41:42 -0000 1.1 --- Int32Type.cs 14 Apr 2004 14:40:51 -0000 1.2 *************** *** 2,6 **** using System.Data; - //using NHibernate.Engine; using NHibernate.SqlTypes; --- 2,5 ---- Index: TypeFactory.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/TypeFactory.cs,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** TypeFactory.cs 9 Apr 2004 12:37:56 -0000 1.24 --- TypeFactory.cs 14 Apr 2004 14:40:51 -0000 1.25 *************** *** 94,97 **** --- 94,98 ---- TypeFactory.GetDecimalType(); TypeFactory.GetDoubleType(); + TypeFactory.GetGuidType(); TypeFactory.GetInt16Type(); TypeFactory.GetInt32Type(); *************** *** 620,623 **** --- 621,643 ---- /// </summary> /// <returns></returns> + public static NullableType GetGuidType() + { + + string key = typeof(GuidType).FullName; + NullableType returnType = (NullableType)typeByTypeOfName[key]; + if(returnType==null) + { + returnType = new GuidType(SqlTypeFactory.GetGuid()); + AddToTypeOfName(key, returnType); + } + + return returnType; + + } + + /// <summary> + /// + /// </summary> + /// <returns></returns> public static NullableType GetInt16Type() { --- NEW FILE: GuidType.cs --- using System; using System.Data; using NHibernate.SqlTypes; namespace NHibernate.Type { public class GuidType : PrimitiveType, IDiscriminatorType { internal GuidType(GuidSqlType sqlType) : base(sqlType) { } public override object Get(IDataReader rs, int index) { return rs.GetGuid(index); } public override object Get(IDataReader rs, string name) { return Get(rs, rs.GetOrdinal(name)); } public override System.Type PrimitiveClass { get { return typeof(System.Guid); } } public override System.Type ReturnedClass { get { return typeof(System.Guid); } } public override void Set(IDbCommand cmd, object value, int index) { IDataParameter parm = cmd.Parameters[index] as IDataParameter; parm.Value = value; } public override string Name { get { return "Guid"; } } public override string ObjectToSQLString(object value) { return value.ToString(); } public object StringToObject(string xml) { return new Guid(xml); } } } |
From: Michael D. <mik...@us...> - 2004-04-14 12:35:26
|
Update of /cvsroot/nhibernate/nhibernate/external-bin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23666 Added Files: ByteFX.Data.dll Log Message: Put old version of ByteFX.Data driver back into the external-bin because I am having problems with the new one. Turns out it was not a simple replace so I need to do some debugging. --- NEW FILE: ByteFX.Data.dll --- (This appears to be a binary file; contents omitted.) |
From: Peter S. <sz...@us...> - 2004-04-14 12:34:37
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Hql In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23325/NHibernate/Hql Modified Files: FromParser.cs PathExpressionParser.cs QueryTranslator.cs SelectParser.cs WhereParser.cs Log Message: Hql finished with manymany TODOs. Index: QueryTranslator.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Hql/QueryTranslator.cs,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** QueryTranslator.cs 12 Apr 2004 05:41:45 -0000 1.21 --- QueryTranslator.cs 14 Apr 2004 12:34:00 -0000 1.22 *************** *** 19,27 **** using System.Runtime.CompilerServices; ! namespace NHibernate.Hql { /// <summary> /// An instance of <c>QueryTranslator</c> translates a Hibernate query string to SQL. /// </summary> ! public class QueryTranslator : BaseLoader { private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof(QueryTranslator)); private static StringCollection dontSpace = new StringCollection(); --- 19,29 ---- [...1669 lines suppressed...] } + protected bool Compiled + { + get + { + return compiled; + } + } + public IDictionary AggregateFunctions + { + get + { + return factory.Dialect.AggregateFunctions; + } + } } } \ No newline at end of file Index: WhereParser.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Hql/WhereParser.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** WhereParser.cs 14 Apr 2004 11:35:53 -0000 1.9 --- WhereParser.cs 14 Apr 2004 12:34:00 -0000 1.10 *************** *** 423,427 **** private void AddJoin( JoinFragment ojf, QueryTranslator q ) { ! JoinFragment fromClause = q.CreateJoinFragment(); fromClause.AddJoins( ojf.ToFromFragmentString, String.Empty ); q.AddJoin( pathExpressionParser.Name, fromClause ); --- 423,427 ---- private void AddJoin( JoinFragment ojf, QueryTranslator q ) { ! JoinFragment fromClause = q.CreateJoinFragment(true); fromClause.AddJoins( ojf.ToFromFragmentString, String.Empty ); q.AddJoin( pathExpressionParser.Name, fromClause ); Index: SelectParser.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Hql/SelectParser.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** SelectParser.cs 14 Apr 2004 11:35:53 -0000 1.6 --- SelectParser.cs 14 Apr 2004 12:34:00 -0000 1.7 *************** *** 17,31 **** { private ArrayList aggregateFuncTokenList = new ArrayList(); ! private static StringCollection aggregateFunctions = new StringCollection(); private static StringCollection countArguments = new StringCollection(); static SelectParser() { - aggregateFunctions.Add("count"); - aggregateFunctions.Add("avg"); - aggregateFunctions.Add("max"); - aggregateFunctions.Add("min"); - aggregateFunctions.Add("sum"); - countArguments.Add("distinct"); countArguments.Add("all"); --- 17,25 ---- { private ArrayList aggregateFuncTokenList = new ArrayList(); ! private static IDictionary aggregateFunctions = new Hashtable(); private static StringCollection countArguments = new StringCollection(); static SelectParser() { countArguments.Add("distinct"); countArguments.Add("all"); *************** *** 116,120 **** { q.AppendScalarSelectToken(token); ! aggregateFunctions.RemoveAt(0); if (aggregateFuncTokenList.Count < 1) { --- 110,114 ---- { q.AppendScalarSelectToken(token); ! aggregateFuncTokenList.RemoveAt(0); if (aggregateFuncTokenList.Count < 1) { *************** *** 200,204 **** public bool AggregateHasArgs(String funcToken, QueryTranslator q) { ! Hashtable funcMap = q.AggregateFunctions; IQueryFunctionInfo funcInfo = (IQueryFunctionInfo)funcMap[funcToken]; return funcInfo.IsFunctionArgs; --- 194,198 ---- public bool AggregateHasArgs(String funcToken, QueryTranslator q) { ! IDictionary funcMap = q.AggregateFunctions; IQueryFunctionInfo funcInfo = (IQueryFunctionInfo)funcMap[funcToken]; return funcInfo.IsFunctionArgs; *************** *** 207,211 **** public bool AggregateFuncNoArgsHasParenthesis(String funcToken, QueryTranslator q) { ! Hashtable funcMap = q.AggregateFunctions; IQueryFunctionInfo funcInfo = (IQueryFunctionInfo)funcMap[funcToken]; return funcInfo.IsFunctionNoArgsUseParanthesis; --- 201,205 ---- public bool AggregateFuncNoArgsHasParenthesis(String funcToken, QueryTranslator q) { ! IDictionary funcMap = q.AggregateFunctions; IQueryFunctionInfo funcInfo = (IQueryFunctionInfo)funcMap[funcToken]; return funcInfo.IsFunctionNoArgsUseParanthesis; *************** *** 214,218 **** public IType AggregateType( ArrayList funcTokenList, IType type, QueryTranslator q) { ! Hashtable funcMap = q.AggregateFunctions; IType argType = type; IType retType = type; --- 208,212 ---- public IType AggregateType( ArrayList funcTokenList, IType type, QueryTranslator q) { ! IDictionary funcMap = q.AggregateFunctions; IType argType = type; IType retType = type; Index: PathExpressionParser.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Hql/PathExpressionParser.cs,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** PathExpressionParser.cs 14 Apr 2004 11:35:53 -0000 1.10 --- PathExpressionParser.cs 14 Apr 2004 12:34:00 -0000 1.11 *************** *** 256,260 **** { IClassPersister p = q.GetPersisterForName(currentName); - //TODO: entity == assoc?? type = NHibernate.Association(p.MappedClass); } --- 256,259 ---- Index: FromParser.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Hql/FromParser.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** FromParser.cs 14 Apr 2004 11:35:53 -0000 1.4 --- FromParser.cs 14 Apr 2004 12:34:00 -0000 1.5 *************** *** 227,231 **** q.SetCollectionToFetch( peParser.CollectionRole, peParser.CollectionName, peParser.CollectionOwnerName ); } ! q.addEntityToFetch(entityName); afterFetch = false; --- 227,231 ---- q.SetCollectionToFetch( peParser.CollectionRole, peParser.CollectionName, peParser.CollectionOwnerName ); } ! q.AddEntityToFetch(entityName); afterFetch = false; |
From: Peter S. <sz...@us...> - 2004-04-14 11:36:05
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Hql In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12026/NHibernate/Hql Modified Files: ClauseParser.cs FilterTranslator.cs FromParser.cs GroupByParser.cs HavingParser.cs IParser.cs OrderByParser.cs ParserHelper.cs PathExpressionParser.cs PreprocessingParser.cs SelectParser.cs SelectPathExpressionParser.cs WhereParser.cs Log Message: Syncing HQL, not ready yet. Index: ParserHelper.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Hql/ParserHelper.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ParserHelper.cs 18 Apr 2003 15:32:39 -0000 1.5 --- ParserHelper.cs 14 Apr 2004 11:35:53 -0000 1.6 *************** *** 3,8 **** using NHibernate.Util; ! namespace NHibernate.Hql { ! public class ParserHelper { public const string HqlVariablePrefix = ":"; --- 3,10 ---- using NHibernate.Util; ! namespace NHibernate.Hql ! { ! public class ParserHelper ! { public const string HqlVariablePrefix = ":"; *************** *** 12,26 **** public const string Whitespace = " \n\r\f\t"; ! public static bool IsWhitespace(string str) { return Whitespace.IndexOf(str) > - 1; } ! private ParserHelper() { } ! public static void Parse(IParser p, string text, string seperators, QueryTranslator q) { StringTokenizer tokens = new StringTokenizer(text, seperators, true); p.Start(q); ! foreach(string token in tokens) { p.Token(token, q); } --- 14,32 ---- public const string Whitespace = " \n\r\f\t"; ! public static bool IsWhitespace(string str) ! { return Whitespace.IndexOf(str) > - 1; } ! private ParserHelper() ! { } ! public static void Parse(IParser p, string text, string seperators, QueryTranslator q) ! { StringTokenizer tokens = new StringTokenizer(text, seperators, true); p.Start(q); ! foreach(string token in tokens) ! { p.Token(token, q); } Index: HavingParser.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Hql/HavingParser.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** HavingParser.cs 13 Mar 2003 21:58:48 -0000 1.3 --- HavingParser.cs 14 Apr 2004 11:35:53 -0000 1.4 *************** *** 1,3 **** - //$Id$ using System; --- 1,2 ---- Index: ClauseParser.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Hql/ClauseParser.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ClauseParser.cs 13 Mar 2003 21:58:48 -0000 1.3 --- ClauseParser.cs 14 Apr 2004 11:35:53 -0000 1.4 *************** *** 1,6 **** - //$Id$ using System; using System.Collections; using NHibernate; namespace NHibernate.Hql { --- 1,6 ---- using System; using System.Collections; using NHibernate; + using NHibernate.Util; namespace NHibernate.Hql { *************** *** 15,65 **** private bool cacheSelectTokens = false; private bool byExpected = false; ! private bool enableSubselect = false; public virtual void Token(string token, QueryTranslator q) { string lcToken = token.ToLower(); if (byExpected && !lcToken.Equals("by")) { throw new QueryException("BY expected after GROUP or ORDER: " + token); } ! ! if (!enableSubselect && lcToken.Equals("select")) { ! selectTokens = new ArrayList(); ! cacheSelectTokens = true; ! } else if (!enableSubselect && lcToken.Equals("from")) { ! child = new FromParser(); ! child.Start(q); ! cacheSelectTokens = false; ! } else if (!enableSubselect && lcToken.Equals("where")) { ! enableSubselect = true; ! EndChild(q); ! child = new WhereParser(); ! child.Start(q); ! } else if (lcToken.Equals("order")) { ! EndChild(q); ! child = new OrderByParser(); ! byExpected = true; ! } else if (lcToken.Equals("having")) { ! EndChild(q); ! enableSubselect = true; ! child = new HavingParser(); ! child.Start(q); ! } else if (lcToken.Equals("group")) { ! EndChild(q); ! child = new GroupByParser(); ! byExpected = true; ! } else if (lcToken.Equals("by")) { ! if (!byExpected) throw new QueryException("GROUP or ORDER expected before BY"); ! child.Start(q); ! byExpected = false; ! } else { ! if (cacheSelectTokens) { selectTokens.Add(token); ! } else { ! if (child == null) { throw new QueryException("query must begin with SELECT or FROM: " + token); } ! else { child.Token(token, q); } --- 15,101 ---- private bool cacheSelectTokens = false; private bool byExpected = false; ! private int parenCount = 0; public virtual void Token(string token, QueryTranslator q) { string lcToken = token.ToLower(); + if ( token.Equals(StringHelper.OpenParen ) ) + { + parenCount++; + } + else if ( token.Equals(StringHelper.ClosedParen ) ) + { + parenCount--; + } + if (byExpected && !lcToken.Equals("by")) { throw new QueryException("BY expected after GROUP or ORDER: " + token); } ! bool isClauseStart = parenCount==0; //ignore subselect keywords ! ! if (isClauseStart) ! { ! if (lcToken.Equals("select")) ! { ! selectTokens = new ArrayList(); ! cacheSelectTokens = true; ! } ! else if (lcToken.Equals("from")) ! { ! child = new FromParser(); ! child.Start(q); ! cacheSelectTokens = false; ! } ! else if (lcToken.Equals("where")) ! { ! EndChild(q); ! child = new WhereParser(); ! child.Start(q); ! } ! else if (lcToken.Equals("order")) ! { ! EndChild(q); ! child = new OrderByParser(); ! byExpected = true; ! } ! else if (lcToken.Equals("having")) ! { ! EndChild(q); ! child = new HavingParser(); ! child.Start(q); ! } ! else if (lcToken.Equals("group")) ! { ! EndChild(q); ! child = new GroupByParser(); ! byExpected = true; ! } ! else if (lcToken.Equals("by")) ! { ! if (!byExpected) throw new QueryException("GROUP or ORDER expected before BY"); ! child.Start(q); ! byExpected = false; ! } ! else ! { ! isClauseStart = false; ! } ! } ! ! if (!isClauseStart) ! { ! if (cacheSelectTokens) ! { selectTokens.Add(token); ! } ! else ! { ! if (child == null) ! { throw new QueryException("query must begin with SELECT or FROM: " + token); } ! else ! { child.Token(token, q); } *************** *** 68,95 **** } ! private void EndChild(QueryTranslator q) { ! if (child == null) { //null child could occur for no from clause in a filter cacheSelectTokens = false; ! } else { child.End(q); } } ! public virtual void Start(QueryTranslator q) { } ! public virtual void End(QueryTranslator q) { EndChild(q); ! if (selectTokens != null) { child = new SelectParser(); child.Start(q); ! foreach (string item in selectTokens) { Token(item, q); } child.End(q); } ! byExpected = false; ! enableSubselect = false; cacheSelectTokens = false; } --- 104,139 ---- } ! private void EndChild(QueryTranslator q) ! { ! if (child == null) ! { //null child could occur for no from clause in a filter cacheSelectTokens = false; ! } ! else ! { child.End(q); } } ! public virtual void Start(QueryTranslator q) ! { } ! public virtual void End(QueryTranslator q) ! { EndChild(q); ! if (selectTokens != null) ! { child = new SelectParser(); child.Start(q); ! foreach (string item in selectTokens) ! { Token(item, q); } child.End(q); } ! byExpected = false; ! parenCount = 0; cacheSelectTokens = false; } Index: OrderByParser.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Hql/OrderByParser.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** OrderByParser.cs 13 Mar 2003 21:58:48 -0000 1.3 --- OrderByParser.cs 14 Apr 2004 11:35:53 -0000 1.4 *************** *** 1,12 **** - //$Id$ using System; using System.Collections; using NHibernate.Util; ! namespace NHibernate.Hql { /// <summary> /// Parses the ORDER BY clause of a query /// </summary> ! public class OrderByParser : IParser { // This uses a PathExpressionParser but notice that compound paths are not valid, // only bare names and simple paths: --- 1,13 ---- using System; using System.Collections; using NHibernate.Util; ! namespace NHibernate.Hql ! { /// <summary> /// Parses the ORDER BY clause of a query /// </summary> ! public class OrderByParser : IParser ! { // This uses a PathExpressionParser but notice that compound paths are not valid, // only bare names and simple paths: *************** *** 19,37 **** private PathExpressionParser pathExpressionParser = new PathExpressionParser(); ! public void Token(string token, QueryTranslator q) { ! if (q.IsName(StringHelper.Root(token))) { ParserHelper.Parse(pathExpressionParser, q.Unalias(token), ParserHelper.PathSeparators, q); q.AppendOrderByToken(pathExpressionParser.WhereColumn); pathExpressionParser.AddAssociation(q); ! } else { q.AppendOrderByToken(token); } } ! public void Start(QueryTranslator q) { } ! public void End(QueryTranslator q) { } } --- 20,49 ---- private PathExpressionParser pathExpressionParser = new PathExpressionParser(); ! public void Token(string token, QueryTranslator q) ! { ! if (q.IsName(StringHelper.Root(token))) ! { ParserHelper.Parse(pathExpressionParser, q.Unalias(token), ParserHelper.PathSeparators, q); q.AppendOrderByToken(pathExpressionParser.WhereColumn); pathExpressionParser.AddAssociation(q); ! } ! else ! { q.AppendOrderByToken(token); } } ! public void Start(QueryTranslator q) ! { } ! public void End(QueryTranslator q) ! { ! } ! ! public OrderByParser() ! { ! pathExpressionParser.UseThetaStyleJoin = true; } } Index: FilterTranslator.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Hql/FilterTranslator.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** FilterTranslator.cs 23 Apr 2003 14:41:17 -0000 1.4 --- FilterTranslator.cs 14 Apr 2004 11:35:53 -0000 1.5 *************** *** 1,3 **** - //$Id$ using System; using System.Collections; --- 1,2 ---- Index: IParser.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Hql/IParser.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** IParser.cs 13 Mar 2003 21:58:48 -0000 1.3 --- IParser.cs 14 Apr 2004 11:35:53 -0000 1.4 *************** *** 1,3 **** - //$Id$ using System; --- 1,2 ---- Index: GroupByParser.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Hql/GroupByParser.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** GroupByParser.cs 13 Mar 2003 21:58:48 -0000 1.3 --- GroupByParser.cs 14 Apr 2004 11:35:53 -0000 1.4 *************** *** 1,3 **** - //$Id$ using System; using System.Collections; --- 1,2 ---- *************** *** 5,14 **** using NHibernate.Util; ! namespace NHibernate.Hql { /// <summary> /// Parses the GROUP BY clause of an aggregate query /// </summary> ! public class GroupByParser : IParser { //this is basically a copy/paste of OrderByParser ... might be worth refactoring --- 4,15 ---- using NHibernate.Util; ! namespace NHibernate.Hql ! { /// <summary> /// Parses the GROUP BY clause of an aggregate query /// </summary> ! public class GroupByParser : IParser ! { //this is basically a copy/paste of OrderByParser ... might be worth refactoring *************** *** 23,41 **** private PathExpressionParser pathExpressionParser = new PathExpressionParser(); ! public void Token(string token, QueryTranslator q) { ! if (q.IsName(StringHelper.Root(token))) { ParserHelper.Parse(pathExpressionParser, q.Unalias(token), ParserHelper.PathSeparators, q); q.AppendGroupByToken(pathExpressionParser.WhereColumn); pathExpressionParser.AddAssociation(q); ! } else { q.AppendGroupByToken(token); } } ! public void Start(QueryTranslator q) { } ! public void End(QueryTranslator q) { } } --- 24,53 ---- private PathExpressionParser pathExpressionParser = new PathExpressionParser(); ! public void Token(string token, QueryTranslator q) ! { ! if (q.IsName(StringHelper.Root(token))) ! { ParserHelper.Parse(pathExpressionParser, q.Unalias(token), ParserHelper.PathSeparators, q); q.AppendGroupByToken(pathExpressionParser.WhereColumn); pathExpressionParser.AddAssociation(q); ! } ! else ! { q.AppendGroupByToken(token); } } ! public void Start(QueryTranslator q) ! { } ! public void End(QueryTranslator q) ! { ! } ! ! public GroupByParser() ! { ! pathExpressionParser.UseThetaStyleJoin = true; } } Index: PathExpressionParser.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Hql/PathExpressionParser.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** PathExpressionParser.cs 10 Feb 2004 18:31:07 -0000 1.9 --- PathExpressionParser.cs 14 Apr 2004 11:35:53 -0000 1.10 *************** *** 9,18 **** using NHibernate.Sql; ! namespace NHibernate.Hql { /// <summary> /// Parses an expression of the form foo.bar.baz and builds up an expression /// involving two less table joins than there are path components. /// </summary> ! public class PathExpressionParser : IParser { //TODO: this class does too many things! we need a different --- 9,20 ---- using NHibernate.Sql; ! namespace NHibernate.Hql ! { /// <summary> /// Parses an expression of the form foo.bar.baz and builds up an expression /// involving two less table joins than there are path components. /// </summary> ! public class PathExpressionParser : IParser ! { //TODO: this class does too many things! we need a different *************** *** 33,37 **** protected string currentName; protected string currentProperty; ! protected JoinFragment join; protected string[] columns; protected string[] collectionElementColumns; --- 35,39 ---- protected string currentName; protected string currentProperty; ! protected QueryJoinFragment join; protected string[] columns; protected string[] collectionElementColumns; *************** *** 39,62 **** private string collectionRole; private string collectionTable; protected IType collectionElementType; private string componentPath; protected IType type; private string path; - private bool skippedId; private bool ignoreInitialJoin; private bool continuation; private JoinType joinType = JoinType.InnerJoin; //default mode ! public JoinType JoinType { ! get { return joinType; } ! set { joinType = value; } } ! private void AddJoin(string table, string name, string[] rhsCols, QueryTranslator q) { string[] lhsCols = CurrentColumns(q); join.AddJoin(table, name, lhsCols, rhsCols, joinType); } ! public string ContinueFromManyToMany(System.Type clazz, string[] joinColumns, QueryTranslator q) { Start(q); continuation = true; --- 41,86 ---- private string collectionRole; private string collectionTable; + private string collectionOwnerName; protected IType collectionElementType; private string componentPath; protected IType type; private string path; private bool ignoreInitialJoin; private bool continuation; private JoinType joinType = JoinType.InnerJoin; //default mode + private bool useThetaStyleJoin = true; ! public JoinType JoinType ! { ! get ! { ! return joinType; ! } ! set ! { ! joinType = value; ! } } ! public bool UseThetaStyleJoin ! { ! get ! { ! return useThetaStyleJoin; ! } ! set ! { ! useThetaStyleJoin = value; ! } ! } ! ! private void AddJoin(string table, string name, string[] rhsCols, QueryTranslator q) ! { string[] lhsCols = CurrentColumns(q); join.AddJoin(table, name, lhsCols, rhsCols, joinType); } ! public string ContinueFromManyToMany(System.Type clazz, string[] joinColumns, QueryTranslator q) ! { Start(q); continuation = true; *************** *** 68,123 **** } ! public void IgnoreInitialJoin() { ignoreInitialJoin = true; } ! public void Token(string token, QueryTranslator q) { ! if (token!=null) path += token; string alias = q.GetPathAlias(path); ! if (alias != null) { Reset(q); //reset the dotcount (but not the path) currentName = alias; //after reset! ! if(!ignoreInitialJoin) { JoinFragment ojf = q.GetPathJoin(path); join.AddCondition( ojf.ToWhereFragmentString ); //after reset! } ! } else if (".".Equals(token)) { dotcount++; ! } else { ! if (dotcount == 0) { ! if (!continuation) { if (!q.IsName(token)) throw new QueryException("undefined alias: " + token); currentName = token; } ! } else if (dotcount == 1) { ! if (currentName != null) { currentProperty = token; ! } else if (collectionName != null) { CollectionPersister p = q.GetCollectionPersister(collectionRole); DoCollectionProperty(token, p, collectionName); continuation = false; ! } else { throw new QueryException("unexpected"); } ! } else { // dotcount>=2 // Do the corresponding RHS IType propertyType = GetPropertyType(q); ! if (propertyType == null) { throw new QueryException("unresolved property: " + currentProperty); } ! if (propertyType.IsComponentType || propertyType.IsObjectType) { ! if (componentPath == null) { componentPath = token; ! } else { ! componentPath += StringHelper.Dot + token; } ! } else { ! ! if (propertyType.IsEntityType) { System.Type memberClass = ((EntityType) propertyType).PersistentClass; IQueryable memberPersister = q.GetPersister(memberClass); --- 92,176 ---- } ! public void IgnoreInitialJoin() ! { ignoreInitialJoin = true; } ! public void Token(string token, QueryTranslator q) ! { if (token!=null) path += token; string alias = q.GetPathAlias(path); ! if (alias != null) ! { Reset(q); //reset the dotcount (but not the path) currentName = alias; //after reset! ! if(!ignoreInitialJoin) ! { JoinFragment ojf = q.GetPathJoin(path); join.AddCondition( ojf.ToWhereFragmentString ); //after reset! + // we don't need to worry about any condition in the ON clause + // here (toFromFragmentString), since anything in the ON condition + // is already applied to the whole query } ! } ! else if (".".Equals(token)) ! { dotcount++; ! } ! else ! { ! if (dotcount == 0) ! { ! if (!continuation) ! { if (!q.IsName(token)) throw new QueryException("undefined alias: " + token); currentName = token; } ! } ! else if (dotcount == 1) ! { ! if (currentName != null) ! { currentProperty = token; ! } ! else if (collectionName != null) ! { CollectionPersister p = q.GetCollectionPersister(collectionRole); DoCollectionProperty(token, p, collectionName); continuation = false; ! } ! else ! { throw new QueryException("unexpected"); } ! } ! else ! { // dotcount>=2 // Do the corresponding RHS IType propertyType = GetPropertyType(q); ! if (propertyType == null) ! { throw new QueryException("unresolved property: " + currentProperty); } ! if (propertyType.IsComponentType || propertyType.IsObjectType) ! { ! if (componentPath == null) ! { componentPath = token; ! } ! else ! { ! if (token != null) ! componentPath += StringHelper.Dot + token; } ! } ! else ! { ! if (propertyType.IsEntityType) ! { System.Type memberClass = ((EntityType) propertyType).PersistentClass; IQueryable memberPersister = q.GetPersister(memberClass); *************** *** 125,135 **** // if its "id" EntityID.Equals(token) || ( ! //or its the id property name ! memberPersister.HasIdentifierProperty && ! memberPersister.IdentifierPropertyName.Equals(token))) { // special shortcut for id properties, skip the join! // this must only occur at the _end_ of a path expression ! skippedId = true; ! } else { string name = q.CreateNameFor(memberClass); --- 178,198 ---- // if its "id" EntityID.Equals(token) || ( ! //or its the id property name ! memberPersister.HasIdentifierProperty && ! memberPersister.IdentifierPropertyName.Equals(token))) ! { // special shortcut for id properties, skip the join! // this must only occur at the _end_ of a path expression ! if (componentPath == null) ! { ! componentPath = "id"; ! } ! else ! { ! componentPath += ".id"; ! } ! } ! else ! { string name = q.CreateNameFor(memberClass); *************** *** 140,147 **** currentProperty = token; q.AddPathAliasAndJoin(path.Substring(0, (path.LastIndexOf((System.Char) StringHelper.Dot)) - (0)), name, join); ! } ! componentPath = null; ! } else if (propertyType.IsPersistentCollectionType) { collectionRole = ((PersistentCollectionType) propertyType).Role; --- 203,211 ---- currentProperty = token; q.AddPathAliasAndJoin(path.Substring(0, (path.LastIndexOf((System.Char) StringHelper.Dot)) - (0)), name, join); ! componentPath = null; } ! } ! else if (propertyType.IsPersistentCollectionType) ! { collectionRole = ((PersistentCollectionType) propertyType).Role; *************** *** 150,163 **** string name = q.CreateNameForCollection(collectionRole); - AddJoin( p.QualifiedTableName, name, colNames, q); if ( p.HasWhere ) join.AddCondition( p.GetSQLWhereString(name) ); DoCollectionProperty(token, p, name); collectionName = name; collectionTable = p.QualifiedTableName; currentName = null; currentProperty = null; componentPath = null; ! } else { if (token != null) throw new QueryException("dereferenced: " + currentProperty); } --- 214,229 ---- string name = q.CreateNameForCollection(collectionRole); AddJoin( p.QualifiedTableName, name, colNames, q); if ( p.HasWhere ) join.AddCondition( p.GetSQLWhereString(name) ); DoCollectionProperty(token, p, name); collectionName = name; + collectionOwnerName = currentName; collectionTable = p.QualifiedTableName; currentName = null; currentProperty = null; componentPath = null; ! } ! else ! { if (token != null) throw new QueryException("dereferenced: " + currentProperty); } *************** *** 169,179 **** } ! private string PropertyPath { ! get { ! if (currentProperty == null) { return EntityID; ! } else { return currentProperty + - (skippedId ? StringHelper.Dot + EntityID : String.Empty) + ((componentPath == null) ? String.Empty : StringHelper.Dot + componentPath); } --- 235,249 ---- } ! private string PropertyPath ! { ! get ! { ! if (currentProperty == null) ! { return EntityID; ! } ! else ! { return currentProperty + ((componentPath == null) ? String.Empty : StringHelper.Dot + componentPath); } *************** *** 181,194 **** } ! private void SetType(QueryTranslator q) { ! if (currentProperty == null) { IClassPersister p = q.GetPersisterForName(currentName); type = NHibernate.Association(p.MappedClass); ! } else { type = GetPropertyType(q); } } ! protected IType GetPropertyType(QueryTranslator q) { string path = PropertyPath; IType type = q.GetPersisterForName(currentName).GetPropertyType(path); --- 251,270 ---- } ! private void SetType(QueryTranslator q) ! { ! if (currentProperty == null) ! { IClassPersister p = q.GetPersisterForName(currentName); + //TODO: entity == assoc?? type = NHibernate.Association(p.MappedClass); ! } ! else ! { type = GetPropertyType(q); } } ! protected IType GetPropertyType(QueryTranslator q) ! { string path = PropertyPath; IType type = q.GetPersisterForName(currentName).GetPropertyType(path); *************** *** 200,204 **** } ! protected string[] CurrentColumns(QueryTranslator q) { string path = PropertyPath; string[] columns = q.GetPersisterForName(currentName).ToColumns(currentName, path); --- 276,281 ---- } ! protected string[] CurrentColumns(QueryTranslator q) ! { string path = PropertyPath; string[] columns = q.GetPersisterForName(currentName).ToColumns(currentName, path); *************** *** 207,212 **** } ! private void Reset(QueryTranslator q) { ! join = q.CreateJoinFragment(); dotcount = 0; currentName = null; --- 284,290 ---- } ! private void Reset(QueryTranslator q) ! { ! join = q.CreateJoinFragment(useThetaStyleJoin); dotcount = 0; currentName = null; *************** *** 222,231 **** columns = null; expectingCollectionIndex = false; - skippedId = false; continuation = false; } ! public void Start(QueryTranslator q) { ! if (!continuation) { Reset(q); path = String.Empty; --- 300,310 ---- columns = null; expectingCollectionIndex = false; continuation = false; } ! public void Start(QueryTranslator q) ! { ! if (!continuation) ! { Reset(q); path = String.Empty; *************** *** 233,251 **** } ! public virtual void End(QueryTranslator q) { ignoreInitialJoin = false; ! if ( IsCollectionValued ) { columns = collectionElementColumns; type = collectionElementType; ! } else { ! if (!continuation) { IType propertyType = GetPropertyType(q); ! if ( propertyType != null && propertyType.IsPersistentCollectionType ) { collectionRole = ((PersistentCollectionType) propertyType).Role; collectionName = q.CreateNameForCollection(collectionRole); } } ! if (collectionRole != null) { //special case; expecting: [index] --- 312,337 ---- } ! public virtual void End(QueryTranslator q) ! { ignoreInitialJoin = false; ! if ( IsCollectionValued ) ! { columns = collectionElementColumns; type = collectionElementType; ! } ! else ! { ! if (!continuation) ! { IType propertyType = GetPropertyType(q); ! if ( propertyType != null && propertyType.IsPersistentCollectionType ) ! { collectionRole = ((PersistentCollectionType) propertyType).Role; collectionName = q.CreateNameForCollection(collectionRole); } } ! if (collectionRole != null) ! { //special case; expecting: [index] *************** *** 256,261 **** if ( indexCols.Length!=1 ) throw new QueryException("composite-index appears in []: " + path); string[] keyCols = memberPersister.KeyColumnNames; ! if (!continuation) { AddJoin( memberPersister.QualifiedTableName, collectionName, keyCols, q); } --- 342,359 ---- if ( indexCols.Length!=1 ) throw new QueryException("composite-index appears in []: " + path); string[] keyCols = memberPersister.KeyColumnNames; + + JoinFragment ojf = q.CreateJoinFragment(useThetaStyleJoin); + ojf.AddCrossJoin( memberPersister.QualifiedTableName, collectionName ); + if ( memberPersister.IsOneToMany ) + { + ILoadable persister = q.GetPersister( ( (EntityType) memberPersister.ElementType ).PersistentClass ); + ojf.AddJoins( + persister.FromJoinFragment(collectionName, true, false), + persister.WhereJoinFragment(collectionName, true, false) + ); + } ! if (!continuation) ! { AddJoin( memberPersister.QualifiedTableName, collectionName, keyCols, q); } *************** *** 275,282 **** q.AddCollection(collectionName, collectionRole); - JoinFragment ojf = q.CreateJoinFragment(); - ojf.AddCrossJoin( memberPersister.QualifiedTableName, collectionName ); q.AddJoin(collectionName, ojf); ! } else { columns = CurrentColumns(q); SetType(q); --- 373,380 ---- q.AddCollection(collectionName, collectionRole); q.AddJoin(collectionName, ojf); ! } ! else ! { columns = CurrentColumns(q); SetType(q); *************** *** 290,294 **** } ! public sealed class CollectionElement { public IType Type; public bool IsOneToMany; --- 388,393 ---- } ! public sealed class CollectionElement ! { public IType Type; public bool IsOneToMany; *************** *** 302,344 **** private ArrayList collectionElements = new ArrayList(); ! public CollectionElement LastCollectionElement() { CollectionElement ce = (CollectionElement) collectionElements[collectionElements.Count-1]; collectionElements.RemoveAt(collectionElements.Count-1); return ce; //remove last } - public string LastCollectionElementIndexValue { - set { ((CollectionElement) collectionElements[collectionElements.Count-1]).IndexValue.Append(value); //getlast } } ! public bool IsExpectingCollectionIndex { ! get { return expectingCollectionIndex; } ! set { expectingCollectionIndex = value; } } ! protected virtual void SetExpectingCollectionIndex() { expectingCollectionIndex = true; } ! public JoinFragment WhereJoin { ! get { return join; } } ! public string WhereColumn { ! get { if (columns.Length != 1) throw new QueryException("path expression ends in a composite value"); return columns[0]; } } ! public string[] WhereColumns { ! get { return columns; } } ! public IType WhereColumnType { ! get { return type; } } ! public string Name { get { return currentName==null ? collectionName : currentName; } } ! public string GetCollectionSubquery() { return new StringBuilder("SELECT ") --- 401,476 ---- private ArrayList collectionElements = new ArrayList(); ! public CollectionElement LastCollectionElement() ! { CollectionElement ce = (CollectionElement) collectionElements[collectionElements.Count-1]; collectionElements.RemoveAt(collectionElements.Count-1); return ce; //remove last } + public string LastCollectionElementIndexValue + { + set + { ((CollectionElement) collectionElements[collectionElements.Count-1]).IndexValue.Append(value); //getlast } } ! ! public bool IsExpectingCollectionIndex ! { ! get ! { ! return expectingCollectionIndex; ! } ! set ! { ! expectingCollectionIndex = value; ! } } ! ! protected virtual void SetExpectingCollectionIndex() ! { expectingCollectionIndex = true; } ! public JoinFragment WhereJoin ! { ! get ! { ! return join; ! } } ! ! public string WhereColumn ! { ! get ! { if (columns.Length != 1) throw new QueryException("path expression ends in a composite value"); return columns[0]; } } ! ! public string[] WhereColumns ! { ! get ! { ! return columns; ! } } ! ! public IType WhereColumnType ! { ! get ! { ! return type; ! } } ! ! public string Name ! { get { return currentName==null ? collectionName : currentName; } } ! public string GetCollectionSubquery() ! { return new StringBuilder("SELECT ") *************** *** 354,371 **** } ! public bool IsCollectionValued { get { return collectionElementColumns!=null; } } ! public void AddAssociation(QueryTranslator q) { q.AddJoin( Name, join ); } ! public string AddFromAssociation(QueryTranslator q) { q.AddFrom(currentName, join); return currentName; } ! public string AddFromCollection(QueryTranslator q) { if ( collectionElementType==null ) throw new QueryException( "must specify 'elements' for collection valued property in from clause: " + path --- 486,507 ---- } ! public bool IsCollectionValued ! { get { return collectionElementColumns!=null; } } ! public void AddAssociation(QueryTranslator q) ! { q.AddJoin( Name, join ); } ! public string AddFromAssociation(QueryTranslator q) ! { q.AddFrom(currentName, join); return currentName; } ! public string AddFromCollection(QueryTranslator q) ! { if ( collectionElementType==null ) throw new QueryException( "must specify 'elements' for collection valued property in from clause: " + path *************** *** 379,385 **** string elementName; ! if ( persister.IsOneToMany ) { elementName = collectionName; ! } else { q.AddCollection(collectionName, collectionRole); ILoadable p = q.GetPersister(clazz); --- 515,524 ---- string elementName; ! if ( persister.IsOneToMany ) ! { elementName = collectionName; ! } ! else ! { q.AddCollection(collectionName, collectionRole); ILoadable p = q.GetPersister(clazz); *************** *** 393,420 **** } ! public string CollectionName { ! get { return collectionName; } } ! public string CollectionRole { ! get { return collectionRole; } } ! public string CollectionTable { ! get { return collectionTable; } } ! private void DoCollectionProperty(string token, CollectionPersister memberPersister, string name) { ! if (token.Equals(CollectionElements)) { string[] cols = memberPersister.ElementColumnNames; collectionElementColumns = StringHelper.Prefix(cols, name + StringHelper.Dot); collectionElementType = memberPersister.ElementType; ! } else if (token.Equals(CollectionIndices)) { if (!memberPersister.HasIndex) throw new QueryException("unindexed collection before .indices"); string[] cols = memberPersister.IndexColumnNames; collectionElementColumns = StringHelper.Prefix(cols, name + StringHelper.Dot); collectionElementType = memberPersister.IndexType; ! } else if (token.Equals(CollectionSize)) { collectionElementColumns = new string[] { "count(*)" }; collectionElementType = NHibernate.Int32; ! } else if (token.Equals(CollectionMaxIndex)) { if (!memberPersister.HasIndex) throw new QueryException("unindexed collection before .maxIndex"); string[] cols = memberPersister.IndexColumnNames; --- 532,579 ---- } ! public string CollectionName ! { ! get ! { ! return collectionName; ! } } ! public string CollectionRole ! { ! get ! { ! return collectionRole; ! } } ! public string CollectionTable ! { ! get ! { ! return collectionTable; ! } } ! private void DoCollectionProperty(string token, CollectionPersister memberPersister, string name) ! { ! if (token.Equals(CollectionElements)) ! { string[] cols = memberPersister.ElementColumnNames; collectionElementColumns = StringHelper.Prefix(cols, name + StringHelper.Dot); collectionElementType = memberPersister.ElementType; ! } ! else if (token.Equals(CollectionIndices)) ! { if (!memberPersister.HasIndex) throw new QueryException("unindexed collection before .indices"); string[] cols = memberPersister.IndexColumnNames; collectionElementColumns = StringHelper.Prefix(cols, name + StringHelper.Dot); collectionElementType = memberPersister.IndexType; ! } ! else if (token.Equals(CollectionSize)) ! { collectionElementColumns = new string[] { "count(*)" }; collectionElementType = NHibernate.Int32; ! } ! else if (token.Equals(CollectionMaxIndex)) ! { if (!memberPersister.HasIndex) throw new QueryException("unindexed collection before .maxIndex"); string[] cols = memberPersister.IndexColumnNames; *************** *** 422,426 **** collectionElementColumns = new string[] { "max(" + cols[0] + StringHelper.ClosedParen }; collectionElementType = memberPersister.IndexType; ! } else if (token.Equals(CollectionMinIndex)) { if (!memberPersister.HasIndex) throw new QueryException("unindexed collection before .minIndex"); string[] cols = memberPersister.IndexColumnNames; --- 581,587 ---- collectionElementColumns = new string[] { "max(" + cols[0] + StringHelper.ClosedParen }; collectionElementType = memberPersister.IndexType; ! } ! else if (token.Equals(CollectionMinIndex)) ! { if (!memberPersister.HasIndex) throw new QueryException("unindexed collection before .minIndex"); string[] cols = memberPersister.IndexColumnNames; *************** *** 428,446 **** collectionElementColumns = new string[] { "min(" + cols[0] + StringHelper.ClosedParen }; collectionElementType = memberPersister.IndexType; ! } else if (token.Equals(CollectionMaxElement)) { string[] cols = memberPersister.ElementColumnNames; if (cols.Length != 1) throw new QueryException("composite collection element in maxElement"); collectionElementColumns = new string[] {"max(" + cols[0] + StringHelper.ClosedParen }; collectionElementType = memberPersister.ElementType; ! } else if (token.Equals(CollectionMinElement)) { string[] cols = memberPersister.ElementColumnNames; if (cols.Length != 1) throw new QueryException("composite collection element in minElement"); collectionElementColumns = new string[] {"min(" + cols[0] + StringHelper.ClosedParen}; collectionElementType = memberPersister.ElementType; ! } else { throw new QueryException("expecting 'elements' or 'indices' after " + path); } } ! } } \ No newline at end of file --- 589,620 ---- collectionElementColumns = new string[] { "min(" + cols[0] + StringHelper.ClosedParen }; collectionElementType = memberPersister.IndexType; ! } ! else if (token.Equals(CollectionMaxElement)) ! { string[] cols = memberPersister.ElementColumnNames; if (cols.Length != 1) throw new QueryException("composite collection element in maxElement"); collectionElementColumns = new string[] {"max(" + cols[0] + StringHelper.ClosedParen }; collectionElementType = memberPersister.ElementType; ! } ! else if (token.Equals(CollectionMinElement)) ! { string[] cols = memberPersister.ElementColumnNames; if (cols.Length != 1) throw new QueryException("composite collection element in minElement"); collectionElementColumns = new string[] {"min(" + cols[0] + StringHelper.ClosedParen}; collectionElementType = memberPersister.ElementType; ! } ! else ! { throw new QueryException("expecting 'elements' or 'indices' after " + path); } } ! ! public String CollectionOwnerName ! { ! get ! { ! return collectionOwnerName; ! } ! } } } \ No newline at end of file Index: FromParser.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Hql/FromParser.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** FromParser.cs 13 Mar 2003 21:58:48 -0000 1.3 --- FromParser.cs 14 Apr 2004 11:35:53 -0000 1.4 *************** *** 1,3 **** - //$Id$ using System; using System.Collections; --- 1,2 ---- *************** *** 24,27 **** --- 23,27 ---- private bool expectingAs; private bool afterJoinType; + private bool afterFetch; private ILoadable classPersister; private JoinType joinType = JoinType.None; *************** *** 40,78 **** // start by looking for HQL keywords.... string lcToken = token.ToLower(); ! if ( lcToken.Equals(StringHelper.Comma) ) { ! if (!expectingJoin) throw new QueryException("unexpected token: "); expectingJoin = false; ! } else if ( lcToken.Equals("join") ) { ! if (!afterJoinType) { ! if (!expectingJoin) throw new QueryException("unexpected token: join"); // inner joings can be abbreviated to 'join' joinType = JoinType.InnerJoin; expectingJoin = false; ! } else { afterJoinType = false; } ! } else if ( lcToken.Equals("outer") ) { // 'outer' is optional and is ignored) ! if ( !afterJoinType || (joinType!=JoinType.LeftOuterJoin && joinType!=JoinType.RightOuterJoin) ) { throw new QueryException("unexpected token: outer"); } ! } else if ( joinTypes.Contains(lcToken) ) { if (!expectingJoin) throw new QueryException("unexpected token: " + token); joinType = (JoinType) joinTypes[lcToken]; afterJoinType = true; expectingJoin = false; ! } else if (lcToken.Equals("class")) { if (!afterIn) throw new QueryException("unexpected token: class"); if (joinType!=JoinType.None) throw new QueryException("outer or full join must be followed by path expression"); afterClass = true; ! } else if ( lcToken.Equals("in") ) { if (!expectingIn) throw new QueryException("unexpected token: in"); afterIn = true; expectingIn = false; ! } else if ( lcToken.Equals("as") ) { if (!expectingAs) throw new QueryException("unexpected token: as"); afterAs = true; expectingAs = false; ! } else { if (afterJoinType) throw new QueryException("join expected: " + token); if (expectingJoin) throw new QueryException("unexpected token: " + token); --- 40,108 ---- // start by looking for HQL keywords.... string lcToken = token.ToLower(); ! if ( lcToken.Equals(StringHelper.Comma) ) ! { ! if (!expectingJoin) throw new QueryException("unexpected token: ,"); expectingJoin = false; ! expectingAs = false; ! } ! else if ( lcToken.Equals("join") ) ! { ! if (!afterJoinType) ! { ! if (!expectingJoin|expectingAs) throw new QueryException("unexpected token: join"); // inner joings can be abbreviated to 'join' joinType = JoinType.InnerJoin; expectingJoin = false; ! expectingAs = false; ! } ! else ! { afterJoinType = false; } ! } ! else if ( lcToken.Equals("fetch") ) ! { ! if ( q.IsShallowQuery ) throw new QueryException("fetch may not be used with scroll() or iterate()"); ! if (joinType==JoinType.None) throw new QueryException("unexpected token: fetch"); ! if (joinType==JoinType.FullJoin || joinType==JoinType.RightOuterJoin) ! throw new QueryException("fetch may only be used with inner join or left outer join"); ! afterFetch = true; ! } ! else if ( lcToken.Equals("outer") ) ! { // 'outer' is optional and is ignored) ! if ( !afterJoinType || (joinType!=JoinType.LeftOuterJoin && joinType!=JoinType.RightOuterJoin) ) ! { throw new QueryException("unexpected token: outer"); } ! } ! else if ( joinTypes.Contains(lcToken) ) ! { if (!expectingJoin) throw new QueryException("unexpected token: " + token); joinType = (JoinType) joinTypes[lcToken]; afterJoinType = true; expectingJoin = false; ! expectingAs = false; ! } ! else if (lcToken.Equals("class")) ! { if (!afterIn) throw new QueryException("unexpected token: class"); if (joinType!=JoinType.None) throw new QueryException("outer or full join must be followed by path expression"); afterClass = true; ! } ! else if ( lcToken.Equals("in") ) ! { if (!expectingIn) throw new QueryException("unexpected token: in"); afterIn = true; expectingIn = false; ! } ! else if ( lcToken.Equals("as") ) ! { if (!expectingAs) throw new QueryException("unexpected token: as"); afterAs = true; expectingAs = false; ! } ! else ! { if (afterJoinType) throw new QueryException("join expected: " + token); if (expectingJoin) throw new QueryException("unexpected token: " + token); *************** *** 81,85 **** // now anything that is not a HQL keyword ! if ( afterAs || expectingAs ) { // (AS is always optional, for consistentcy with SQL/OQL --- 111,116 ---- // now anything that is not a HQL keyword ! if ( afterAs || expectingAs ) ! { // (AS is always optional, for consistentcy with SQL/OQL *************** *** 88,96 **** // AS construction ! if (classPersister!=null) { q.AddFromClass(token, classPersister); ! } else if (entityName!=null) { q.SetAliasName(token, entityName); ! } else { throw new QueryException("unexpected: as " + token); } --- 119,132 ---- // AS construction ! if (classPersister!=null) ! { q.AddFromClass(token, classPersister); ! } ! else if (entityName!=null) ! { q.SetAliasName(token, entityName); ! } ! else ! { throw new QueryException("unexpected: as " + token); } *************** *** 101,105 **** classPersister = null; ! } else if (afterIn) { // process the "old" HQL style where aliases appear _first // ie using the IN or IN CLASS constructions --- 137,143 ---- classPersister = null; ! } ! else if (afterIn) ! { // process the "old" HQL style where aliases appear _first // ie using the IN or IN CLASS constructions *************** *** 108,118 **** if (joinType!=JoinType.None) throw new QueryException("outer or full join must be followed by path expressions"); ! if (afterClass) { // treat it as a classname ILoadable p = q.GetPersisterUsingImports(token); if (p==null) throw new QueryException("persister not found: " + token); q.AddFromClass(alias, p); ! } else { // treat it as a path expression ParserHelper.Parse(peParser, q.Unalias(token), ParserHelper.PathSeparators, q); if ( !peParser.IsCollectionValued ) throw new QueryException("pathe expression did not resolve to collection: " + token); --- 146,161 ---- if (joinType!=JoinType.None) throw new QueryException("outer or full join must be followed by path expressions"); ! if (afterClass) ! { // treat it as a classname ILoadable p = q.GetPersisterUsingImports(token); if (p==null) throw new QueryException("persister not found: " + token); q.AddFromClass(alias, p); ! } ! else ! { // treat it as a path expression + peParser.JoinType = JoinType.InnerJoin; + peParser.UseThetaStyleJoin = true; ParserHelper.Parse(peParser, q.Unalias(token), ParserHelper.PathSeparators, q); if ( !peParser.IsCollectionValued ) throw new QueryException("pathe expression did not resolve to collection: " + token); *************** *** 125,144 **** afterClass = false; expectingJoin = true; ! } else { // handle a path expression or class name that appears // at the start, in the "new" HQL style or an alias that // appears at the start in the "old HQL stype ILoadable p = q.GetPersisterUsingImports(token); ! if (p!=null) { // starts with the name of a mapped class (new style) if (joinType!=JoinType.None) throw new QueryException("outer or full join must be followed by path expression"); classPersister = p; expectingAs = true; ! } else if ( token.IndexOf('.') < 0 ) { // starts with an alias (old style) // semi-bad thing about this: can't re-alias another alias... alias = token; expectingIn = true; ! } else { // starts with a path expression (new style) --- 168,196 ---- afterClass = false; expectingJoin = true; ! } ! else ! { // handle a path expression or class name that appears // at the start, in the "new" HQL style or an alias that // appears at the start in the "old HQL stype ILoadable p = q.GetPersisterUsingImports(token); ! if (p!=null) ! { // starts with the name of a mapped class (new style) if (joinType!=JoinType.None) throw new QueryException("outer or full join must be followed by path expression"); classPersister = p; + entityName = q.CreateNameFor( p.MappedClass ); + q.AddFromClass( entityName, p ); expectingAs = true; ! } ! else if ( token.IndexOf('.') < 0 ) ! { // starts with an alias (old style) // semi-bad thing about this: can't re-alias another alias... alias = token; expectingIn = true; ! } ! else ! { // starts with a path expression (new style) *************** *** 146,160 **** //allow ODMG OQL style: from Person p, p.cars c ! if (joinType!=JoinType.None) peParser.JoinType = joinType; ParserHelper.Parse(peParser, q.Unalias(token), ParserHelper.PathSeparators, q); ! if ( peParser.IsCollectionValued ) { entityName = peParser.AddFromCollection(q); ! } else { entityName = peParser.AddFromAssociation(q); } - expectingAs = true; joinType = JoinType.None; peParser.JoinType = JoinType.InnerJoin; } } --- 198,236 ---- //allow ODMG OQL style: from Person p, p.cars c ! if (joinType!=JoinType.None) ! { ! peParser.JoinType = joinType; ! } ! else ! { ! peParser.JoinType = JoinType.InnerJoin; ! } ! peParser.UseThetaStyleJoin = q.IsSubquery; ParserHelper.Parse(peParser, q.Unalias(token), ParserHelper.PathSeparators, q); ! if ( peParser.IsCollectionValued ) ! { entityName = peParser.AddFromCollection(q); ! } ! else ! { entityName = peParser.AddFromAssociation(q); } joinType = JoinType.None; peParser.JoinType = JoinType.InnerJoin; + + if (afterFetch) + { + + if ( peParser.IsCollectionValued ) + { + q.SetCollectionToFetch( peParser.CollectionRole, peParser.CollectionName, peParser.CollectionOwnerName ); + } + q.addEntityToFetch(entityName); + + afterFetch = false; + } + + expectingAs = true; } } Index: SelectPathExpressionParser.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Hql/SelectPathExpressionParser.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** SelectPathExpressionParser.cs 13 Mar 2003 21:58:49 -0000 1.3 --- SelectPathExpressionParser.cs 14 Apr 2004 11:35:53 -0000 1.4 *************** *** 1,12 **** - //$Id$ using System; using System.Collections; ! namespace NHibernate.Hql { ! public class SelectPathExpressionParser : PathExpressionParser { ! public override void End(QueryTranslator q) { ! if (currentProperty != null && !q.IsShallowQuery) { // "finish off" the join Token(".", q); --- 1,15 ---- using System; using System.Collections; ! namespace NHibernate.Hql ! { ! public class SelectPathExpressionParser : PathExpressionParser ! { ! public override void End(QueryTranslator q) ! { ! if (currentProperty != null && !q.IsShallowQuery) ! { // "finish off" the join Token(".", q); *************** *** 16,25 **** } ! protected override void SetExpectingCollectionIndex() { throw new QueryException("expecting .elements or .indices after collection path expression in select"); } ! public string SelectName { ! get { return currentName; } } } --- 19,33 ---- } ! protected override void SetExpectingCollectionIndex() ! { throw new QueryException("expecting .elements or .indices after collection path expression in select"); } ! public string SelectName ! { ! get ! { ! return currentName; ! } } } Index: WhereParser.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Hql/WhereParser.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** WhereParser.cs 10 Feb 2004 18:31:07 -0000 1.8 --- WhereParser.cs 14 Apr 2004 11:35:53 -0000 1.9 *************** *** 8,12 **** using NHibernate.Sql; ! namespace NHibernate.Hql { /// <summary> Parses the where clause of a hibernate query and translates it to an /// SQL where clause. --- 8,13 ---- using NHibernate.Sql; ! namespace NHibernate.Hql ! { /// <summary> Parses the where clause of a hibernate query and translates it to an /// SQL where clause. *************** *** 23,27 **** // the same thing it does now) ! public class WhereParser : IParser { private PathExpressionParser pathExpressionParser = new PathExpressionParser(); --- 24,29 ---- // the same thing it does now) ! public class WhereParser : IParser ! { private PathExpressionParser pathExpressionParser = new PathExpressionParser(); *************** *** 32,36 **** private static IDictionary negations = new Hashtable(); ! static WhereParser() { expressionTerminators.Add("and"); expressionTerminators.Add("or"); --- 34,44 ---- private static IDictionary negations = new Hashtable(); ! public WhereParser() ! { ! pathExpressionParser.UseThetaStyleJoin = true; ! } ! ! static WhereParser() ! { expressionTerminators.Add("and"); expressionTerminators.Add("or"); *************** *** 124,130 **** // ( foo.Bar.Baz + 1.0 ) < 2.0 (maps to: ( bar.Baz + 1.0 ) < 2.0 and foo.Bar = bar.id) - //private bool quoted = false; //Inside a quoted string private bool betweenSpecialCase = false; //Inside a BETWEEN ... AND ... expression - //private int bracketsSinceFunction = 0; //How deep inside in IN are we? private bool negated = false; --- 132,136 ---- *************** *** 145,162 **** ! private string GetElementName(PathExpressionParser.CollectionElement element, QueryTranslator q) { string name; ! if (element.IsOneToMany) { name = element.Alias; } ! else { IType type = element.Type; System.Type clazz; ! if (type.IsEntityType) { //ie. a many-to-many clazz = ((EntityType) type).PersistentClass; name = pathExpressionParser.ContinueFromManyToMany(clazz, element.ElementColumns, q); ! } else { throw new QueryException("illegally dereferenced collection element"); } --- 151,174 ---- ! private string GetElementName(PathExpressionParser.CollectionElement element, QueryTranslator q) ! { string name; ! if (element.IsOneToMany) ! { name = element.Alias; } ! else ! { IType type = element.Type; System.Type clazz; ! if (type.IsEntityType) ! { //ie. a many-to-many clazz = ((EntityType) type).PersistentClass; name = pathExpressionParser.ContinueFromManyToMany(clazz, element.ElementColumns, q); ! } ! else ! { throw new QueryException("illegally dereferenced collection element"); } *************** *** 165,169 **** } ! public void Token(string token, QueryTranslator q) { string lcToken = token.ToLower(); --- 177,182 ---- } ! public void Token(string token, QueryTranslator q) ! { string lcToken = token.ToLower(); *************** *** 171,179 **** //Cope with [,] ! if (token.Equals("[") && !expectingPathContinuation) { expectingPathContinuation = false; if (expectingIndex == 0) throw new QueryException("unexpected ["); return ; ! } else if (token.Equals("]")) { expectingIndex--; expectingPathContinuation = true; --- 184,195 ---- //Cope with [,] ! if (token.Equals("[") && !expectingPathContinuation) ! { expectingPathContinuation = false; if (expectingIndex == 0) throw new QueryException("unexpected ["); return ; ! } ! else if (token.Equals("]")) ! { expectingIndex--; expectingPathContinuation = true; *************** *** 182,186 **** //Cope with a continued path expression (ie. ].baz) ! if (expectingPathContinuation) { expectingPathContinuation = false; --- 198,203 ---- //Cope with a continued path expression (ie. ].baz) ! if (expectingPathContinuation) ! { expectingPathContinuation = false; *************** *** 188,192 **** PathExpressionParser.CollectionElement element = pathExpressionParser.LastCollectionElement(); ! if (token.StartsWith(".")) { // the path expression continues after a ] DoPathExpression(GetElementName(element, q) + token, q); // careful with this! --- 205,210 ---- PathExpressionParser.CollectionElement element = pathExpressionParser.LastCollectionElement(); ! if (token.StartsWith(".")) ! { // the path expression continues after a ] DoPathExpression(GetElementName(element, q) + token, q); // careful with this! *************** *** 195,203 **** return ; //NOTE: EARLY EXIT! ! } else if (token.Equals("[")) { DoPathExpression(GetElementName(element, q), q); AddToCurrentJoin(element); return ; //NOTE: EARLY EXIT! ! } else { // the path expression ends at the ] if (element.ElementColumns.Length != 1) throw new QueryException("path expression ended in composite collection element"); --- 213,225 ---- return ; //NOTE: EARLY EXIT! ! } ! else if (token.Equals("[")) ! { DoPathExpression(GetElementName(element, q), q); AddToCurrentJoin(element); return ; //NOTE: EARLY EXIT! ! } ! else ! { // the path expression ends at the ] if (element.ElementColumns.Length != 1) throw new QueryException("path expression ended in composite collection element"); *************** *** 211,226 **** //Cope with a subselect ! if (!inSubselect && (lcToken.Equals("select") || lcToken.Equals("from"))) { inSubselect = true; subselect = new StringBuilder(20); } ! if (i... [truncated message content] |
From: Peter S. <sz...@us...> - 2004-04-14 08:39:00
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12069/NHibernate.Test Modified Files: FooBarTest.cs Log Message: Ignored test because of missing HQL keyword. Index: FooBarTest.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/FooBarTest.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** FooBarTest.cs 13 Apr 2004 15:32:59 -0000 1.7 --- FooBarTest.cs 14 Apr 2004 08:38:51 -0000 1.8 *************** *** 35,39 **** [Test] ! //[Ignore("Bugs in quoteing kills other tests too")] public void FetchInitializedCollection() { --- 35,39 ---- [Test] ! [Ignore("Fetch keyword is missing from HQL")] public void FetchInitializedCollection() { *************** *** 52,65 **** s.Close(); ! // s = sessions.OpenSession(); ! // baz = (Baz) s.load( typeof(Baz), baz.getCode() ); ! // Object bag = baz.getFooBag(); ! // Assert.IsFalse( NHibernate.IsInitialized(bag) ); ! // s.Find("from Baz baz left join fetch baz.fooBag"); ! // Assert.IsFalse( NHibernate.IsInitialized(bag) ); ! // Assert.IsTrue( bag==baz.getFooBag() ); ! // Assert.IsTrue( baz.getFooBag().size()==2 ); ! // s.Delete(baz); ! // s.Flush(); s.Close(); --- 52,65 ---- s.Close(); ! s = sessions.OpenSession(); ! baz = (Baz) s.Load( typeof(Baz), baz.code ); ! Object bag = baz.fooBag; ! Assert.IsFalse( NHibernate.IsInitialized(bag) ); ! s.Find("from Baz baz left join fetch baz.fooBag"); ! Assert.IsFalse( NHibernate.IsInitialized(bag) ); ! Assert.IsTrue( bag==baz.fooBag ); ! Assert.IsTrue( baz.fooBag.Count==2 ); ! s.Delete(baz); ! s.Flush(); s.Close(); |
From: Michael D. <mik...@us...> - 2004-04-14 03:06:29
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1907 Modified Files: NHibernate-1.1.csproj Log Message: Added IdentifierCollection & IdentifierBag to mapping synch with h2.0.3 Index: NHibernate-1.1.csproj =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/NHibernate-1.1.csproj,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** NHibernate-1.1.csproj 13 Apr 2004 10:25:45 -0000 1.18 --- NHibernate-1.1.csproj 14 Apr 2004 03:06:20 -0000 1.19 *************** *** 1094,1097 **** --- 1094,1107 ---- /> <File + RelPath = "Mapping\IdentifierBag.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Mapping\IdentifierCollection.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "Mapping\Index.cs" SubType = "Code" |
From: Michael D. <mik...@us...> - 2004-04-14 03:06:29
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1907/Mapping Added Files: IdentifierBag.cs IdentifierCollection.cs Log Message: Added IdentifierCollection & IdentifierBag to mapping synch with h2.0.3 --- NEW FILE: IdentifierCollection.cs --- using System; using System.Collections; namespace NHibernate.Mapping { /// <summary> /// A collection with a synthetic "identifier" column. /// </summary> public abstract class IdentifierCollection : Collection { public static readonly string DefaultIdentifierColumnName = "id"; private Value identifier; public IdentifierCollection(PersistentClass owner) : base(owner) { } public Value Identifier { get { return identifier; } set { identifier = value; } } public override bool IsIdentified { get { return true; } } public void CreatePrimaryKey() { PrimaryKey pk = new PrimaryKey(); foreach(Column col in Identifier.ColumnCollection) { pk.AddColumn(col); } Table.PrimaryKey = pk; } } } --- NEW FILE: IdentifierBag.cs --- using System; using NHCollection = NHibernate.Collection; using NHibernate.Type; namespace NHibernate.Mapping { /// <summary> /// An <c>IdentifierBag</c> has a primary key consistenting of just /// the identifier column. /// </summary> public class IdentifierBag : IdentifierCollection { public IdentifierBag(PersistentClass owner) : base(owner) { } //TODO: need to implement an IdentifierBag in PersistentColleciton. public override PersistentCollectionType Type { get { throw new NotImplementedException("need to code IdentifierBag"); //return TypeFactory.Bag(Role)); } } public override System.Type WrapperClass { get { throw new NotImplementedException("need to code IdentifierBag"); //return typeof(NHCollection.IdentifierBag) ; } } } } |
From: Michael D. <mik...@us...> - 2004-04-13 21:24:01
|
Update of /cvsroot/nhibernate/nhibernate/external-bin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2985 Removed Files: ByteFX.Data.dll Log Message: Added 0.76 of ByteFX's MySql data provider. They renamed it to ByteFX.MySql from ByteFX.Data. --- ByteFX.Data.dll DELETED --- |
From: Michael D. <mik...@us...> - 2004-04-13 21:22:18
|
Update of /cvsroot/nhibernate/nhibernate/external-bin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2518 Added Files: ByteFX.MySqlClient.dll Log Message: Added 0.76 of ByteFX's MySql data provider. They renamed it to ByteFX.MySql from ByteFX.Data. --- NEW FILE: ByteFX.MySqlClient.dll --- (This appears to be a binary file; contents omitted.) |
From: Michael D. <mik...@us...> - 2004-04-13 18:12:15
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24476 Modified Files: PersistentClass.cs RootClass.cs Subclass.cs Table.cs Log Message: synch with H2.0.3 Index: RootClass.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/RootClass.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** RootClass.cs 10 Feb 2004 18:35:30 -0000 1.6 --- RootClass.cs 13 Apr 2004 17:58:11 -0000 1.7 *************** *** 3,10 **** using NHibernate.Cache; ! namespace NHibernate.Mapping { ! ! public class RootClass : PersistentClass { private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof(RootClass)); public const string DefaultIdentifierColumnName = "id"; public const string DefaultDiscriminatorColumnName = "class"; --- 3,12 ---- using NHibernate.Cache; ! namespace NHibernate.Mapping ! { ! public class RootClass : PersistentClass ! { private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof(RootClass)); + public const string DefaultIdentifierColumnName = "id"; public const string DefaultDiscriminatorColumnName = "class"; *************** *** 21,43 **** private System.Type persister; private bool forceDiscriminator; ! public override Property IdentifierProperty { get { return identifierProperty; } set { identifierProperty = value; } } ! public override Value Identifier { get { return identifier; } set { identifier = value; } } ! public override bool HasIdentifierProperty { get { return identifierProperty != null; } } ! public override Value Discriminator { get { return discriminator; } set { discriminator = value; } } ! public override bool IsInherited { get { return false; } } --- 23,53 ---- private System.Type persister; private bool forceDiscriminator; + private string where; ! public override Property IdentifierProperty ! { get { return identifierProperty; } set { identifierProperty = value; } } ! ! public override Value Identifier ! { get { return identifier; } set { identifier = value; } } ! ! public override bool HasIdentifierProperty ! { get { return identifierProperty != null; } } ! public override Value Discriminator ! { get { return discriminator; } set { discriminator = value; } } ! public override bool IsInherited ! { get { return false; } } *************** *** 50,62 **** /// through any other method - so no setter is declared for this property. /// </remarks> ! public override bool IsPolymorphic { get { return polymorphic; } - //set { polymorphic = value; } } ! public override RootClass RootClazz { get { return this; } } ! public override ICollection PropertyClosureCollection { get { return PropertyCollection; } } --- 60,75 ---- /// through any other method - so no setter is declared for this property. /// </remarks> ! public override bool IsPolymorphic ! { get { return polymorphic; } } ! public override RootClass RootClazz ! { get { return this; } } ! ! public override ICollection PropertyClosureCollection ! { get { return PropertyCollection; } } *************** *** 67,74 **** /// <remarks> /// The RootClass should only have one item in the Collection - the Table that it comes from. - /// TODO: why an ICollection - I don't know why the signature calls for an ICollection. /// </remarks> ! public override ICollection TableClosureCollection { ! get { ArrayList retVal = new ArrayList(); retVal.Add( Table ); --- 80,88 ---- /// <remarks> /// The RootClass should only have one item in the Collection - the Table that it comes from. /// </remarks> ! public override ICollection TableClosureCollection ! { ! get ! { ArrayList retVal = new ArrayList(); retVal.Add( Table ); *************** *** 76,134 **** } } ! public override void AddSubclass(Subclass subclass) { base.AddSubclass(subclass); polymorphic = true; } ! public override bool IsExplicitPolymorphism { get { return explicitPolymorphism; } set { explicitPolymorphism = value; } } ! public override Property Version { get { return version; } set { version = value; } } ! public override bool IsVersioned { get { return version != null; } } ! public override ICacheConcurrencyStrategy Cache { get { return cache; } set { cache = value; } } ! public override bool IsMutable { get { return mutable; } set { mutable = value; } } ! public override bool HasEmbeddedIdentifier { get { return embeddedIdentifier; } set { embeddedIdentifier = value; } } ! public override System.Type Persister { get { return persister; } set { persister = value; } } ! public override Table RootTable { get { return Table; } } ! public override PersistentClass Superclass { get { return null; } ! set { throw new InvalidOperationException(); } } ! public override Value Key { get { return Identifier; } set { throw new InvalidOperationException(); } } ! public override bool IsForceDiscriminator { get { return forceDiscriminator; } set { this.forceDiscriminator = value; } } } } --- 90,170 ---- } } ! ! public override void AddSubclass(Subclass subclass) ! { base.AddSubclass(subclass); polymorphic = true; } ! public override bool IsExplicitPolymorphism ! { get { return explicitPolymorphism; } set { explicitPolymorphism = value; } } ! public override Property Version ! { get { return version; } set { version = value; } } ! ! public override bool IsVersioned ! { get { return version != null; } } ! public override ICacheConcurrencyStrategy Cache ! { get { return cache; } set { cache = value; } } ! public override bool IsMutable ! { get { return mutable; } set { mutable = value; } } ! ! public override bool HasEmbeddedIdentifier ! { get { return embeddedIdentifier; } set { embeddedIdentifier = value; } } ! public override System.Type Persister ! { get { return persister; } set { persister = value; } } ! public override Table RootTable ! { get { return Table; } } ! public override PersistentClass Superclass ! { get { return null; } ! set { throw new InvalidOperationException("Can not set the Superclass on a RootClass."); } } ! public override Value Key ! { get { return Identifier; } set { throw new InvalidOperationException(); } } ! public override bool IsForceDiscriminator ! { get { return forceDiscriminator; } set { this.forceDiscriminator = value; } } + + public override string Where + { + get { return where; } + set { where = value; } + } + } } Index: Table.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/Table.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Table.cs 13 Apr 2004 02:35:21 -0000 1.9 --- Table.cs 13 Apr 2004 17:58:11 -0000 1.10 *************** *** 212,216 **** { //if ( dialect is HSQLDialect && identityColumn ) { ! // //ugly hack... //} else { buf.Append(',').Append( primaryKey.SqlConstraintString(dialect) ); --- 212,217 ---- { //if ( dialect is HSQLDialect && identityColumn ) { ! // // skip the primary key definition ! // //ugly hack... //} else { buf.Append(',').Append( primaryKey.SqlConstraintString(dialect) ); *************** *** 272,276 **** ForeignKey fk = (ForeignKey) foreignKeys[name]; ! if (fk == null) { fk = new ForeignKey(); fk.Name = name; --- 273,278 ---- ForeignKey fk = (ForeignKey) foreignKeys[name]; ! if (fk == null) ! { fk = new ForeignKey(); fk.Name = name; *************** *** 296,300 **** // this is marked as unchecked because the GetHashCode could potentially // cause an integer overflow. This way if there is an overflow it will ! // just roll back over. unchecked{ result += obj.GetHashCode(); } } --- 298,303 ---- // this is marked as unchecked because the GetHashCode could potentially // cause an integer overflow. This way if there is an overflow it will ! // just roll back over - since we are not doing any computations based ! // on this number then a rollover is no big deal. unchecked{ result += obj.GetHashCode(); } } Index: Subclass.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/Subclass.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Subclass.cs 10 Feb 2004 18:35:30 -0000 1.4 --- Subclass.cs 13 Apr 2004 17:58:11 -0000 1.5 *************** *** 1,78 **** using System; using System.Collections; using NHibernate.Cache; using NHibernate.Util; ! namespace NHibernate.Mapping { ! ! public class Subclass : PersistentClass { ! private PersistentClass superclass; private Value key; ! public Subclass(PersistentClass superclass) { this.superclass = superclass; } ! public override ICacheConcurrencyStrategy Cache { get { return Superclass.Cache; } set { Superclass.Cache = value; } } ! public override RootClass RootClazz { get { return Superclass.RootClazz; } } ! public override PersistentClass Superclass { get { return superclass; } set { this.superclass = superclass; } } ! public override Property IdentifierProperty { get { return Superclass.IdentifierProperty; } set { Superclass.IdentifierProperty = value; } } ! public override Value Identifier { get { return Superclass.Identifier; } set { Superclass.Identifier = value; } } ! public override bool HasIdentifierProperty { get { return Superclass.HasIdentifierProperty; } } ! public override Value Discriminator { get { return Superclass.Discriminator; } set { Superclass.Discriminator = value; } } ! public override bool IsMutable { get { return Superclass.IsMutable; } set { Superclass.IsMutable = value; } } ! public override bool IsInherited { get { return true; } } ! /// <summary> ! /// The subclass is always a polymorphic version of its superclass ! /// TODO: make sure my OO jargon is correct here. ! /// </summary> ! public override bool IsPolymorphic { get { return true; } - //set { throw new InvalidOperationException(); } } ! public override void AddProperty(Property p) { base.AddProperty(p); Superclass.AddSubclassProperty(p); } ! public override Table Table { ! get { ! return base.Table; ! } ! set { base.Table = value; Superclass.AddSubclassTable(value); } } ! public override ICollection PropertyClosureCollection { ! get { ArrayList retVal = new ArrayList(); retVal.AddRange( PropertyCollection ); --- 1,96 ---- using System; using System.Collections; + using NHibernate.Cache; using NHibernate.Util; ! namespace NHibernate.Mapping ! { ! public class Subclass : PersistentClass ! { private PersistentClass superclass; private Value key; ! public Subclass(PersistentClass superclass) ! { this.superclass = superclass; } ! public override ICacheConcurrencyStrategy Cache ! { get { return Superclass.Cache; } set { Superclass.Cache = value; } } ! public override RootClass RootClazz ! { get { return Superclass.RootClazz; } } ! public override PersistentClass Superclass ! { get { return superclass; } set { this.superclass = superclass; } } ! public override Property IdentifierProperty ! { get { return Superclass.IdentifierProperty; } set { Superclass.IdentifierProperty = value; } } ! ! public override Value Identifier ! { get { return Superclass.Identifier; } set { Superclass.Identifier = value; } } ! ! public override bool HasIdentifierProperty ! { get { return Superclass.HasIdentifierProperty; } } ! ! public override Value Discriminator ! { get { return Superclass.Discriminator; } set { Superclass.Discriminator = value; } } ! ! public override bool IsMutable ! { get { return Superclass.IsMutable; } set { Superclass.IsMutable = value; } } ! ! public override bool IsInherited ! { get { return true; } } ! public override bool IsPolymorphic ! { get { return true; } } ! ! public override void AddProperty(Property p) ! { base.AddProperty(p); Superclass.AddSubclassProperty(p); } ! ! public override Table Table ! { ! get { return base.Table; } ! set ! { base.Table = value; Superclass.AddSubclassTable(value); } } ! ! public override ICollection PropertyClosureCollection ! { ! get ! { ArrayList retVal = new ArrayList(); retVal.AddRange( PropertyCollection ); *************** *** 81,86 **** } } ! public override ICollection TableClosureCollection { ! get { ArrayList retVal = new ArrayList(); retVal.AddRange( Superclass.TableClosureCollection ); --- 99,107 ---- } } ! ! public override ICollection TableClosureCollection ! { ! get ! { ArrayList retVal = new ArrayList(); retVal.AddRange( Superclass.TableClosureCollection ); *************** *** 89,123 **** } } ! public override void AddSubclassProperty(Property p) { base.AddSubclassProperty(p); Superclass.AddSubclassProperty(p); } ! public override void AddSubclassTable(Table table) { base.AddSubclassTable(table); Superclass.AddSubclassTable(table); } ! public override bool IsVersioned { get { return Superclass.IsVersioned; } } ! public override Property Version { get { return Superclass.Version; } set { Superclass.Version = value; } } ! public override bool HasEmbeddedIdentifier { get { return Superclass.HasEmbeddedIdentifier; } set { Superclass.HasEmbeddedIdentifier = value; } } ! public override System.Type Persister { get { return Superclass.Persister; } set { Superclass.Persister = value; } } ! public override Table RootTable { get { return Superclass.RootTable; } } ! public override Value Key { ! get { ! if (key==null) { return Identifier; ! } else { return key; } --- 110,164 ---- } } ! ! public override void AddSubclassProperty(Property p) ! { base.AddSubclassProperty(p); Superclass.AddSubclassProperty(p); } ! ! public override void AddSubclassTable(Table table) ! { base.AddSubclassTable(table); Superclass.AddSubclassTable(table); } ! ! public override bool IsVersioned ! { get { return Superclass.IsVersioned; } } ! ! public override Property Version ! { get { return Superclass.Version; } set { Superclass.Version = value; } } ! ! public override bool HasEmbeddedIdentifier ! { get { return Superclass.HasEmbeddedIdentifier; } set { Superclass.HasEmbeddedIdentifier = value; } } ! ! public override System.Type Persister ! { get { return Superclass.Persister; } set { Superclass.Persister = value; } } ! ! public override Table RootTable ! { get { return Superclass.RootTable; } } ! ! public override Value Key ! { ! get ! { ! if (key==null) ! { return Identifier; ! } ! else ! { return key; } *************** *** 125,133 **** set { key = value; } } ! public override bool IsExplicitPolymorphism { get { return Superclass.IsExplicitPolymorphism; } set { Superclass.IsExplicitPolymorphism = value; } } } } --- 166,183 ---- set { key = value; } } ! ! public override bool IsExplicitPolymorphism ! { get { return Superclass.IsExplicitPolymorphism; } set { Superclass.IsExplicitPolymorphism = value; } } + public override string Where + { + get { return Superclass.Where; } + set { throw new NotImplementedException("The Where string can not be set on the Subclass - use the RootClass instead."); } + } + + } } Index: PersistentClass.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/PersistentClass.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** PersistentClass.cs 13 Apr 2004 02:06:54 -0000 1.9 --- PersistentClass.cs 13 Apr 2004 17:58:01 -0000 1.10 *************** *** 73,82 **** public virtual ICollection SubclassCollection { ! get { ArrayList retVal = new ArrayList(); // check to see if there are any subclass in our subclasses // and add them into the collection ! foreach(Subclass sc in subclasses) { retVal.AddRange(sc.SubclassCollection); } --- 73,84 ---- public virtual ICollection SubclassCollection { ! get ! { ArrayList retVal = new ArrayList(); // check to see if there are any subclass in our subclasses // and add them into the collection ! foreach(Subclass sc in subclasses) ! { retVal.AddRange(sc.SubclassCollection); } *************** *** 122,138 **** } ! public abstract bool IsMutable { get; set;} // set?? public abstract bool HasIdentifierProperty { get; } ! public abstract Property IdentifierProperty { get; set; } //set?? ! public abstract Value Identifier { get; set; } //set?? ! public abstract Property Version { get; set; } //set?? ! public abstract Value Discriminator { get; set; } //set?? public abstract bool IsInherited { get; } // see the comment in RootClass about why the polymorphic setter is commented out ! public abstract bool IsPolymorphic { get; } //set; } public abstract bool IsVersioned { get;} ! public abstract ICacheConcurrencyStrategy Cache { get; set;} //set?? ! public abstract PersistentClass Superclass { get; set; } //set?? ! public abstract bool IsExplicitPolymorphism { get; set;}//set?? public abstract ICollection PropertyClosureCollection { get; } --- 124,140 ---- } ! public abstract bool IsMutable { get; set;} public abstract bool HasIdentifierProperty { get; } ! public abstract Property IdentifierProperty { get; set; } ! public abstract Value Identifier { get; set; } ! public abstract Property Version { get; set; } ! public abstract Value Discriminator { get; set; } public abstract bool IsInherited { get; } // see the comment in RootClass about why the polymorphic setter is commented out ! public abstract bool IsPolymorphic { get; } public abstract bool IsVersioned { get;} ! public abstract ICacheConcurrencyStrategy Cache { get; set;} ! public abstract PersistentClass Superclass { get; set; } ! public abstract bool IsExplicitPolymorphism { get; set;} public abstract ICollection PropertyClosureCollection { get; } *************** *** 183,195 **** public virtual bool IsForceDiscriminator { get { return false; } ! set { //??? ! } } ! public abstract bool HasEmbeddedIdentifier { get; set;} //set?? ! public abstract System.Type Persister { get; set;} //set?? public abstract Table RootTable { get; } public abstract RootClass RootClazz { get; } ! public abstract Value Key { get; set; } //set?? public virtual void CreatePrimaryKey() --- 185,196 ---- public virtual bool IsForceDiscriminator { get { return false; } ! set { throw new NotImplementedException("subclasses need to override this method"); } } ! public abstract bool HasEmbeddedIdentifier { get; set;} ! public abstract System.Type Persister { get; set;} public abstract Table RootTable { get; } public abstract RootClass RootClazz { get; } ! public abstract Value Key { get; set; } public virtual void CreatePrimaryKey() *************** *** 197,201 **** PrimaryKey pk = new PrimaryKey(); pk.Table = table; ! pk.Name = PKAlias.ToAliasString(table.Name); // StringHelper.Suffix( table.Name, "PK" ); table.PrimaryKey = pk; --- 198,202 ---- PrimaryKey pk = new PrimaryKey(); pk.Table = table; ! pk.Name = PKAlias.ToAliasString(table.Name); table.PrimaryKey = pk; *************** *** 206,216 **** } ! //TODO: H2.0.3 - make abstract... ! public virtual string Where ! { ! get { return ""; } ! } ! ! } } --- 207,212 ---- } ! public abstract string Where { get; set; } ! } } |
From: Peter S. <sz...@us...> - 2004-04-13 15:46:59
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.DomainModel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25155/NHibernate.DomainModel Modified Files: Baz.cs Foo.cs Log Message: Updated the dates in the tests. Index: Baz.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.DomainModel/Baz.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Baz.cs 9 Apr 2004 13:14:53 -0000 1.2 --- Baz.cs 13 Apr 2004 15:32:58 -0000 1.3 *************** *** 728,733 **** name="Bazza"; topComponents = new ArrayList(); ! topComponents.Add( new FooComponent("foo", 11, new DateTime[] { new DateTime(), new DateTime(123) }, null) ); ! topComponents.Add( new FooComponent("bar", 22, new DateTime[] { new DateTime(7), new DateTime(456) }, null) ); topComponents.Add( null ); bag = new ArrayList(); --- 728,733 ---- name="Bazza"; topComponents = new ArrayList(); ! topComponents.Add( new FooComponent("foo", 11, new DateTime[] { new DateTime(), new DateTime(2123,1,1) }, null) ); ! topComponents.Add( new FooComponent("bar", 22, new DateTime[] { new DateTime(2007,2,3), new DateTime(1945,6,1) }, null) ); topComponents.Add( null ); bag = new ArrayList(); Index: Foo.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.DomainModel/Foo.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Foo.cs 13 Apr 2004 10:25:46 -0000 1.5 --- Foo.cs 13 Apr 2004 15:32:59 -0000 1.6 *************** *** 662,666 **** { _string = "a string"; ! _date = new DateTime(123); _timestamp = DateTime.Now; _integer = -666; --- 662,666 ---- { _string = "a string"; ! _date = new DateTime(2123,2,3); _timestamp = DateTime.Now; _integer = -666; *************** *** 685,689 **** "foo", "bar" }; ! component = new FooComponent("foo", 12, new DateTime[] { _date, _timestamp, DateTime.MinValue, new DateTime() }, new FooComponent("bar", 666, new DateTime[] { new DateTime(123456L), DateTime.MinValue }, null ) ); component.glarch = new Glarch(); dependent = new Fee(); --- 685,689 ---- "foo", "bar" }; ! component = new FooComponent("foo", 12, new DateTime[] { _date, _timestamp, DateTime.MinValue, new DateTime() }, new FooComponent("bar", 666, new DateTime[] { new DateTime(1999,12,3), DateTime.MinValue }, null ) ); component.glarch = new Glarch(); dependent = new Fee(); |
From: Peter S. <sz...@us...> - 2004-04-13 15:46:59
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25155/NHibernate.Test Modified Files: FooBarTest.cs Log Message: Updated the dates in the tests. Index: FooBarTest.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/FooBarTest.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** FooBarTest.cs 13 Apr 2004 10:25:46 -0000 1.6 --- FooBarTest.cs 13 Apr 2004 15:32:59 -0000 1.7 *************** *** 45,49 **** baz.fooBag=fooBag; s.Save(baz); - s.Flush(); fooBag = baz.fooBag; s.Find("from Baz baz left join fetch baz.fooBag"); --- 45,48 ---- |
From: Peter S. <sz...@us...> - 2004-04-13 15:13:18
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16572/Impl Modified Files: SessionFactoryImpl.cs Log Message: Some small debugging thing. Index: SessionFactoryImpl.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl/SessionFactoryImpl.cs,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** SessionFactoryImpl.cs 29 Mar 2004 04:06:09 -0000 1.12 --- SessionFactoryImpl.cs 13 Apr 2004 14:59:17 -0000 1.13 *************** *** 5,8 **** --- 5,9 ---- using System.Collections; using System.Runtime.CompilerServices; + using System.Text; using NHibernate.Cache; *************** *** 94,98 **** log.Info("building session factory"); ! if ( log.IsDebugEnabled ) log.Debug("instantiating session factory with properties: " + properties); this.interceptor = interceptor; --- 95,105 ---- log.Info("building session factory"); ! if ( log.IsDebugEnabled ) ! { ! StringBuilder sb = new StringBuilder("instantiating session factory with properties: "); ! foreach(DictionaryEntry entry in properties) ! sb.AppendFormat("{0}={1};", entry.Key, ((string)entry.Key).IndexOf("connection_string")>0?"***":entry.Value); ! log.Debug(sb.ToString()); ! } this.interceptor = interceptor; *************** *** 219,223 **** querySubstitutions = PropertiesHelper.ToDictionary(Cfg.Environment.QuerySubstitutions, " ,=;:\n\t\r\f", properties); ! log.Info("Query language substitutions: " + querySubstitutions); namedQueries = cfg.NamedQueries; --- 226,236 ---- querySubstitutions = PropertiesHelper.ToDictionary(Cfg.Environment.QuerySubstitutions, " ,=;:\n\t\r\f", properties); ! if ( log.IsInfoEnabled ) ! { ! StringBuilder sb = new StringBuilder("Query language substitutions: "); ! foreach(DictionaryEntry entry in querySubstitutions) ! sb.AppendFormat("{0}={1};", entry.Key, entry.Value); ! log.Info(sb.ToString()); ! } namedQueries = cfg.NamedQueries; |
From: Peter S. <sz...@us...> - 2004-04-13 15:13:17
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Engine In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16572/Engine Modified Files: Cascades.cs Log Message: Some small debugging thing. Index: Cascades.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Engine/Cascades.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Cascades.cs 28 Mar 2004 06:02:55 -0000 1.9 --- Cascades.cs 13 Apr 2004 14:59:10 -0000 1.10 *************** *** 416,420 **** if ( persister.HasCascades ) { ! if ( log.IsDebugEnabled ) log.Debug( "processing cascasdes for: " + persister.ClassName); IType[] types = persister.PropertyTypes; Cascades.CascadeStyle[] cascadeStyles = persister.PropertyCascadeStyles; --- 416,420 ---- if ( persister.HasCascades ) { ! if ( log.IsDebugEnabled ) log.Debug( "processing cascades for: " + persister.ClassName); IType[] types = persister.PropertyTypes; Cascades.CascadeStyle[] cascadeStyles = persister.PropertyCascadeStyles; |
From: Peter S. <sz...@us...> - 2004-04-13 15:03:25
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Type In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14484/Type Modified Files: DateTimeType.cs DateType.cs TimeType.cs TimestampType.cs Log Message: Patching datetimes with the 1753/1/1 bug. Index: TimestampType.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/TimestampType.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TimestampType.cs 17 Feb 2004 03:32:04 -0000 1.3 --- TimestampType.cs 13 Apr 2004 14:49:25 -0000 1.4 *************** *** 53,57 **** { IDataParameter parm = st.Parameters[index] as IDataParameter; ! parm.Value = value; } --- 53,64 ---- { IDataParameter parm = st.Parameters[index] as IDataParameter; ! if((DateTime)value<new DateTime(1753,1,1)) ! { ! parm.Value = DBNull.Value; ! } ! else ! { ! parm.Value = value; ! } } Index: TimeType.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/TimeType.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TimeType.cs 9 Apr 2004 16:18:00 -0000 1.2 --- TimeType.cs 13 Apr 2004 14:49:25 -0000 1.3 *************** *** 41,45 **** { IDataParameter parm = st.Parameters[index] as IDataParameter; ! parm.Value = value; } --- 41,52 ---- { IDataParameter parm = st.Parameters[index] as IDataParameter; ! if((DateTime)value<new DateTime(1753,1,1)) ! { ! parm.Value = DBNull.Value; ! } ! else ! { ! parm.Value = value; ! } } Index: DateTimeType.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/DateTimeType.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** DateTimeType.cs 9 Apr 2004 16:18:00 -0000 1.4 --- DateTimeType.cs 13 Apr 2004 14:49:24 -0000 1.5 *************** *** 44,48 **** parm.DbType = DbType.DateTime; //TODO: figure out if this is a good solution for NULL DATES ! if(value.Equals(System.DateTime.MinValue)) { parm.Value = DBNull.Value; --- 44,48 ---- parm.DbType = DbType.DateTime; //TODO: figure out if this is a good solution for NULL DATES ! if((DateTime)value<new DateTime(1753,1,1)) { parm.Value = DBNull.Value; Index: DateType.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/DateType.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** DateType.cs 9 Apr 2004 16:18:00 -0000 1.6 --- DateType.cs 13 Apr 2004 14:49:25 -0000 1.7 *************** *** 29,34 **** public override void Set(IDbCommand st, object value, int index) { IDataParameter parm = st.Parameters[index] as IDataParameter; ! parm.DbType = DbType.Date; ! parm.Value = value; } --- 29,42 ---- public override void Set(IDbCommand st, object value, int index) { IDataParameter parm = st.Parameters[index] as IDataParameter; ! if((DateTime)value<new DateTime(1753,1,1)) ! { ! parm.Value = DBNull.Value; ! } ! else ! { ! ! parm.DbType = DbType.Date; ! parm.Value = value; ! } } |
From: Michael D. <mik...@us...> - 2004-04-13 13:17:54
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23739/Mapping Modified Files: Formula.cs Log Message: Changed name of property from "Formul" to "FormulaString" because I have some code not checked in that is using that. Index: Formula.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/Formula.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Formula.cs 13 Apr 2004 10:25:46 -0000 1.1 --- Formula.cs 13 Apr 2004 13:03:54 -0000 1.2 *************** *** 17,23 **** public String getAlias() { return "f" + uniqueInteger.ToString() + StringHelper.Underscore; } ! public string Formul { ! get ! { return formula; } set { ! this.formula = value; } } } } \ No newline at end of file --- 17,21 ---- public String getAlias() { return "f" + uniqueInteger.ToString() + StringHelper.Underscore; } ! public string FormulaString { ! get { return formula; } set { this.formula = value; } } } } \ No newline at end of file |