From: Michael D. <mik...@us...> - 2004-12-04 22:42:00
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1955/NHibernate/Impl Modified Files: BatcherImpl.cs SessionImpl.cs Log Message: Modified more exceptions to not be "throw e" and instead just be "throw" Moved internal fields from IList to ISet where applicable. Fixed generation of sql from hql that was causing spacing problems with MySql. Index: SessionImpl.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl/SessionImpl.cs,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** SessionImpl.cs 30 Nov 2004 18:36:50 -0000 1.53 --- SessionImpl.cs 4 Dec 2004 22:41:21 -0000 1.54 *************** *** 6,9 **** --- 6,11 ---- using System.Text.RegularExpressions; + using Iesi.Collections; + using NHibernate.Cache; using NHibernate.Collection; *************** *** 52,56 **** private IdentityMap collections; //key=PersistentCollection, value=CollectionEntry ! private IDictionary nullifiables = new Hashtable(); //set of Keys of deleted objects private IInterceptor interceptor; --- 54,58 ---- private IdentityMap collections; //key=PersistentCollection, value=CollectionEntry ! private ISet nullifiables = new HashedSet(); //set of Keys of deleted objects private IInterceptor interceptor; *************** *** 627,631 **** this.entitiesByKey = (IDictionary)info.GetValue( "entitiesByKey", typeof(IDictionary) ); this.proxiesByKey = (IDictionary)info.GetValue( "proxiesByKey", typeof(IDictionary) ); ! this.nullifiables = (IDictionary)info.GetValue( "nullifiables", typeof(IDictionary) ); this.interceptor = (IInterceptor)info.GetValue( "interceptor", typeof(IInterceptor) ); --- 629,633 ---- this.entitiesByKey = (IDictionary)info.GetValue( "entitiesByKey", typeof(IDictionary) ); this.proxiesByKey = (IDictionary)info.GetValue( "proxiesByKey", typeof(IDictionary) ); ! this.nullifiables = (ISet)info.GetValue( "nullifiables", typeof(ISet) ); this.interceptor = (IInterceptor)info.GetValue( "interceptor", typeof(IInterceptor) ); *************** *** 662,666 **** info.AddValue( "entitiesByKey", entitiesByKey, typeof(IDictionary) ); info.AddValue( "proxiesByKey", proxiesByKey, typeof(IDictionary) ); ! info.AddValue( "nullifiables", nullifiables, typeof(IDictionary) ); info.AddValue( "interceptor", interceptor, typeof(IInterceptor) ); --- 664,668 ---- info.AddValue( "entitiesByKey", entitiesByKey, typeof(IDictionary) ); info.AddValue( "proxiesByKey", proxiesByKey, typeof(IDictionary) ); ! info.AddValue( "nullifiables", nullifiables, typeof(ISet) ); info.AddValue( "interceptor", interceptor, typeof(IInterceptor) ); *************** *** 1396,1409 **** NullifyTransientReferences(entry.DeletedState, propTypes, false, obj); ! // in h2.0.3 this is a Set ! IDictionary oldNullifiables = null; ArrayList oldDeletions = null; if ( persister.HasCascades ) { ! oldNullifiables = new Hashtable(nullifiables); oldDeletions = (ArrayList) deletions.Clone(); } ! nullifiables[ new Key(entry.Id, persister) ] = new object(); entry.Status = Status.Deleted; // before any callbacks, etc, so subdeletions see that this deletion happend first ScheduledDeletion delete = new ScheduledDeletion(entry.Id, version, obj, persister, this); --- 1398,1411 ---- NullifyTransientReferences(entry.DeletedState, propTypes, false, obj); ! ISet oldNullifiables = null; ArrayList oldDeletions = null; if ( persister.HasCascades ) { ! oldNullifiables = new HashedSet( ); ! oldNullifiables.AddAll( nullifiables ); oldDeletions = (ArrayList) deletions.Clone(); } ! nullifiables.Add( new Key(entry.Id, persister) ); entry.Status = Status.Deleted; // before any callbacks, etc, so subdeletions see that this deletion happend first ScheduledDeletion delete = new ScheduledDeletion(entry.Id, version, obj, persister, this); *************** *** 1429,1433 **** int start = deletions.Count; ! IDictionary newNullifiables = nullifiables; nullifiables = oldNullifiables; --- 1431,1435 ---- int start = deletions.Count; ! ISet newNullifiables = nullifiables; nullifiables = oldNullifiables; *************** *** 1441,1448 **** { cascading--; ! foreach(DictionaryEntry oldNullifyDictEntry in oldNullifiables) ! { ! newNullifiables[oldNullifyDictEntry.Key] = oldNullifyDictEntry.Value; ! } nullifiables = newNullifiables; } --- 1443,1447 ---- { cascading--; ! newNullifiables.AddAll( oldNullifiables ); nullifiables = newNullifiables; } *************** *** 1866,1874 **** // take the union of the query spaces (ie the queried tables) QueryTranslator[] q = new QueryTranslator[concreteQueries.Length]; ! ArrayList qs = new ArrayList(); for (int i=0; i<concreteQueries.Length; i++ ) { q[i] = scalar ? factory.GetShallowQuery( concreteQueries[i] ) : factory.GetQuery( concreteQueries[i] ); ! qs.AddRange( q[i].QuerySpaces ); } --- 1865,1873 ---- // take the union of the query spaces (ie the queried tables) QueryTranslator[] q = new QueryTranslator[concreteQueries.Length]; ! HashedSet qs = new HashedSet(); for (int i=0; i<concreteQueries.Length; i++ ) { q[i] = scalar ? factory.GetShallowQuery( concreteQueries[i] ) : factory.GetQuery( concreteQueries[i] ); ! qs.AddAll( q[i].QuerySpaces ); } *************** *** 2040,2044 **** /// <param name="querySpaces"></param> /// <returns></returns> ! private bool AutoFlushIfRequired(IList querySpaces) { --- 2039,2043 ---- /// <param name="querySpaces"></param> /// <returns></returns> ! private bool AutoFlushIfRequired(ISet querySpaces) { *************** *** 2620,2624 **** } ! private bool AreTablesToBeUpdated(IList tables) { return AreTablesToUpdated( updates, tables) || --- 2619,2623 ---- } ! private bool AreTablesToBeUpdated(ISet tables) { return AreTablesToUpdated( updates, tables) || *************** *** 2630,2634 **** } ! private bool AreTablesToUpdated(ICollection coll, IList theSet) { foreach( IExecutable executable in coll ) --- 2629,2633 ---- } ! private bool AreTablesToUpdated(ICollection coll, ISet theSet) { foreach( IExecutable executable in coll ) *************** *** 4026,4030 **** CriteriaLoader loader = new CriteriaLoader(persister, factory, criteria); object[] spaces = persister.PropertySpaces; ! ArrayList sett = new ArrayList(); for (int i=0; i<spaces.Length; i++) { --- 4025,4029 ---- CriteriaLoader loader = new CriteriaLoader(persister, factory, criteria); object[] spaces = persister.PropertySpaces; ! HashedSet sett = new HashedSet(); for (int i=0; i<spaces.Length; i++) { Index: BatcherImpl.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl/BatcherImpl.cs,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** BatcherImpl.cs 29 Oct 2004 05:53:49 -0000 1.11 --- BatcherImpl.cs 4 Dec 2004 22:41:20 -0000 1.12 *************** *** 3,6 **** --- 3,8 ---- using System.Data; + using Iesi.Collections; + using NHibernate.Driver; using NHibernate.Engine; *************** *** 28,33 **** private SqlString batchCommandSql; ! private ArrayList commandsToClose = new ArrayList(); ! private ArrayList readersToClose = new ArrayList(); public BatcherImpl(ISessionImplementor session) --- 30,35 ---- private SqlString batchCommandSql; ! private ISet commandsToClose = new HashedSet(); ! private ISet readersToClose = new HashedSet(); public BatcherImpl(ISessionImplementor session) *************** *** 199,207 **** } ! for( int i=0; i<readersToClose.Count; i++ ) { ! ((NHybridDataReader)readersToClose[i]).ReadIntoMemory(); } - } --- 201,208 ---- } ! foreach( NHybridDataReader reader in readersToClose ) { ! reader.ReadIntoMemory(); } } |