From: Kevin W. <kev...@us...> - 2004-12-31 19:51:29
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12503 Modified Files: EnumerableImpl.cs Log Message: fixing xml comments and letting ReSharper do reformatting Index: EnumerableImpl.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl/EnumerableImpl.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** EnumerableImpl.cs 29 Nov 2004 18:43:21 -0000 1.7 --- EnumerableImpl.cs 31 Dec 2004 19:51:20 -0000 1.8 *************** *** 1,10 **** - using System; using System.Collections; using System.Data; ! using NHibernate.Engine; using NHibernate.Type; ! namespace NHibernate.Impl { /// <summary> --- 1,9 ---- using System.Collections; using System.Data; ! using log4net; using NHibernate.Engine; using NHibernate.Type; ! namespace NHibernate.Impl { /// <summary> *************** *** 16,28 **** internal class EnumerableImpl : IEnumerable, IEnumerator { ! private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof(EnumerableImpl)); ! private IDataReader _reader; private ISessionImplementor _sess; ! private IType[] _types; private bool _single; ! private object[] _currentResults; private bool _hasNext; ! private string[][] _names; private IDbCommand _cmd; --- 15,27 ---- internal class EnumerableImpl : IEnumerable, IEnumerator { ! private static readonly ILog log = LogManager.GetLogger( typeof( EnumerableImpl ) ); ! private IDataReader _reader; private ISessionImplementor _sess; ! private IType[ ] _types; private bool _single; ! private object[ ] _currentResults; private bool _hasNext; ! private string[ ][ ] _names; private IDbCommand _cmd; *************** *** 45,49 **** /// The <see cref="IDataReader"/> should already be positioned on the first record in <see cref="RowSelection"/>. /// </remarks> ! public EnumerableImpl(IDataReader reader, IDbCommand cmd, ISessionImplementor sess, IType[] types, string[][] columnNames, RowSelection selection) { _reader = reader; --- 44,48 ---- /// The <see cref="IDataReader"/> should already be positioned on the first record in <see cref="RowSelection"/>. /// </remarks> ! public EnumerableImpl( IDataReader reader, IDbCommand cmd, ISessionImplementor sess, IType[ ] types, string[ ][ ] columnNames, RowSelection selection ) { _reader = reader; *************** *** 54,83 **** _selection = selection; ! _single = _types.Length==1; } ! private void PostMoveNext(bool hasNext) { _hasNext = hasNext; _currentRow++; ! if( _selection!=null && _selection.MaxRows!=RowSelection.NoValue ) { _hasNext = _hasNext && ( _currentRow < _selection.MaxRows ); } // there are no more records in the DataReader so clean up ! if( !_hasNext ) { ! log.Debug("exhausted results"); _currentResults = null; _sess.Batcher.CloseQueryCommand( _cmd, _reader ); ! } ! else { ! log.Debug("retreiving next results"); _currentResults = new object[_types.Length]; ! // move through each of the ITypes contained in the IDataReader and convert them // to their objects. ! for (int i=0; i<_types.Length; i++) { // The IType knows how to extract its value out of the IDataReader. If the IType --- 53,82 ---- _selection = selection; ! _single = _types.Length == 1; } ! private void PostMoveNext( bool hasNext ) { _hasNext = hasNext; _currentRow++; ! if( _selection != null && _selection.MaxRows != RowSelection.NoValue ) { _hasNext = _hasNext && ( _currentRow < _selection.MaxRows ); } // there are no more records in the DataReader so clean up ! if( !_hasNext ) { ! log.Debug( "exhausted results" ); _currentResults = null; _sess.Batcher.CloseQueryCommand( _cmd, _reader ); ! } ! else { ! log.Debug( "retreiving next results" ); _currentResults = new object[_types.Length]; ! // move through each of the ITypes contained in the IDataReader and convert them // to their objects. ! for( int i = 0; i < _types.Length; i++ ) { // The IType knows how to extract its value out of the IDataReader. If the IType *************** *** 85,89 **** // the IType is an Entity type then the IType will extract the id from the IDataReader // and use the ISession to load an instance of the object. ! _currentResults[i] = _types[i].NullSafeGet(_reader, _names[i], _sess, null); } } --- 84,88 ---- // the IType is an Entity type then the IType will extract the id from the IDataReader // and use the ISession to load an instance of the object. ! _currentResults[ i ] = _types[ i ].NullSafeGet( _reader, _names[ i ], _sess, null ); } } *************** *** 96,100 **** /// An <see cref="IEnumerator" /> that can be used to iterate through the query results. /// </returns> ! public IEnumerator GetEnumerator() { this.Reset(); --- 95,99 ---- /// An <see cref="IEnumerator" /> that can be used to iterate through the query results. /// </returns> ! public IEnumerator GetEnumerator() { this.Reset(); *************** *** 114,126 **** /// returned. /// </remarks> ! public object Current { ! get { ! if( _single ) { ! return _currentResults[0]; ! } ! else { return _currentResults; --- 113,125 ---- /// returned. /// </remarks> ! public object Current { ! get { ! if( _single ) { ! return _currentResults[ 0 ]; ! } ! else { return _currentResults; *************** *** 136,147 **** /// ; <c>false</c> if the enumerator has passed the end of the query results. ///</returns> ! public bool MoveNext() { PostMoveNext( _reader.Read() ); ! return _hasNext; } ! public void Reset() { //can't reset the reader...we are SOL --- 135,147 ---- /// ; <c>false</c> if the enumerator has passed the end of the query results. ///</returns> ! public bool MoveNext() { PostMoveNext( _reader.Read() ); ! return _hasNext; } ! /// <summary></summary> ! public void Reset() { //can't reset the reader...we are SOL *************** *** 150,152 **** } ! } --- 150,152 ---- } ! } \ No newline at end of file |