From: NHibernate J. <mik...@us...> - 2006-11-06 16:51:37
|
NHybridDataReader.ReadIntoMemory fails when the result is 0 records. "Invalid attempt to read when no data is present". ----------------------------------------------------------------------------------------------------------------------- Key: NH-793 URL: http://jira.nhibernate.org/browse/NH-793 Project: NHibernate Type: Bug Components: Core Versions: 1.0.2, 1.0.3 Reporter: dstefanov Priority: Critical public bool Read() { // DS 6/30/06 - If the result is 0 records the read will always return false // and the _isMidstream should be false so we don't attempt to read from the // reader when we do ReadIntoMemory. We were getting an error // "Invalid attempt to read when no data is present" when trying to get data // from the reader is such cases. // //_isMidstream = true; //return _reader.Read(); // _isMidstream = _reader.Read(); return _isMidstream; } -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.nhibernate.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
From: NHibernate J. <mik...@us...> - 2006-11-07 10:00:27
|
[ http://jira.nhibernate.org/browse/NH-793?page=comments#action_14310 ] Sergey Koshcheyev commented on NH-793: -------------------------------------- Please attach a simple test case to reproduce the bug. > NHybridDataReader.ReadIntoMemory fails when the result is 0 records. "Invalid attempt to read when no data is present". > ----------------------------------------------------------------------------------------------------------------------- > > Key: NH-793 > URL: http://jira.nhibernate.org/browse/NH-793 > Project: NHibernate > Type: Bug > Components: Core > Versions: 1.0.2, 1.0.3 > Reporter: dstefanov > Priority: Critical > > public bool Read() > { > // DS 6/30/06 - If the result is 0 records the read will always return false > // and the _isMidstream should be false so we don't attempt to read from the > // reader when we do ReadIntoMemory. We were getting an error > // "Invalid attempt to read when no data is present" when trying to get data > // from the reader is such cases. > // > //_isMidstream = true; > //return _reader.Read(); > // > _isMidstream = _reader.Read(); > return _isMidstream; > } -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.nhibernate.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
From: NHibernate J. <mik...@us...> - 2006-11-13 20:02:49
|
[ http://jira.nhibernate.org/browse/NH-793?page=all ] Sergey Koshcheyev closed NH-793: -------------------------------- Resolution: Incomplete > NHybridDataReader.ReadIntoMemory fails when the result is 0 records. "Invalid attempt to read when no data is present". > ----------------------------------------------------------------------------------------------------------------------- > > Key: NH-793 > URL: http://jira.nhibernate.org/browse/NH-793 > Project: NHibernate > Type: Bug > Components: Core > Versions: 1.0.2, 1.0.3 > Reporter: dstefanov > Priority: Critical > > public bool Read() > { > // DS 6/30/06 - If the result is 0 records the read will always return false > // and the _isMidstream should be false so we don't attempt to read from the > // reader when we do ReadIntoMemory. We were getting an error > // "Invalid attempt to read when no data is present" when trying to get data > // from the reader is such cases. > // > //_isMidstream = true; > //return _reader.Read(); > // > _isMidstream = _reader.Read(); > return _isMidstream; > } -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.nhibernate.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
From: NHibernate J. <mik...@us...> - 2006-11-14 17:03:32
|
[ http://jira.nhibernate.org/browse/NH-793?page=comments#action_14399 ] dstefanov commented on NH-793: ------------------------------ // to reproduce the bug use this code: try { string strConn = "Data Source=.;Initial catalog=Northwind;Persist Security Info=False;Integrated Security=SSPI;Connect Timeout=30"; SqlConnection conn = new SqlConnection( strConn ); conn.Open(); SqlCommand cmd = conn.CreateCommand(); cmd.CommandText = "SELECT * FROM ORDERS WHERE OrderID is null"; // the result set has no rows (0 rows) NHybridDataReader reader = new NHybridDataReader( cmd.ExecuteReader() ); reader.Read(); reader.ReadIntoMemory(); } catch ( Exception ex ) { Debug.WriteLine(ex); } > NHybridDataReader.ReadIntoMemory fails when the result is 0 records. "Invalid attempt to read when no data is present". > ----------------------------------------------------------------------------------------------------------------------- > > Key: NH-793 > URL: http://jira.nhibernate.org/browse/NH-793 > Project: NHibernate > Type: Bug > Components: Core > Versions: 1.0.2, 1.0.3 > Reporter: dstefanov > Priority: Critical > > public bool Read() > { > // DS 6/30/06 - If the result is 0 records the read will always return false > // and the _isMidstream should be false so we don't attempt to read from the > // reader when we do ReadIntoMemory. We were getting an error > // "Invalid attempt to read when no data is present" when trying to get data > // from the reader is such cases. > // > //_isMidstream = true; > //return _reader.Read(); > // > _isMidstream = _reader.Read(); > return _isMidstream; > } -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.nhibernate.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
From: NHibernate J. <mik...@us...> - 2006-11-14 19:05:27
|
[ http://jira.nhibernate.org/browse/NH-793?page=comments#action_14400 ] Sergey Koshcheyev commented on NH-793: -------------------------------------- Can you reproduce the bug without using NHybridDataReader directly, i.e. only using public NHibernate API? > NHybridDataReader.ReadIntoMemory fails when the result is 0 records. "Invalid attempt to read when no data is present". > ----------------------------------------------------------------------------------------------------------------------- > > Key: NH-793 > URL: http://jira.nhibernate.org/browse/NH-793 > Project: NHibernate > Type: Bug > Components: Core > Versions: 1.0.2, 1.0.3 > Reporter: dstefanov > Priority: Critical > > public bool Read() > { > // DS 6/30/06 - If the result is 0 records the read will always return false > // and the _isMidstream should be false so we don't attempt to read from the > // reader when we do ReadIntoMemory. We were getting an error > // "Invalid attempt to read when no data is present" when trying to get data > // from the reader is such cases. > // > //_isMidstream = true; > //return _reader.Read(); > // > _isMidstream = _reader.Read(); > return _isMidstream; > } -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.nhibernate.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
From: NHibernate J. <mik...@us...> - 2006-11-14 19:41:26
|
[ http://jira.nhibernate.org/browse/NH-793?page=comments#action_14401 ] dstefanov commented on NH-793: ------------------------------ I'm not very familiar with the whole NHibernate API. I'm only using NHybridDataReader and NDataReader in my application. The fix I'm proposing has been tested and is very easy to check. As seen from the repro if you Read() from the reader and the result set is empty then the Read() method returns false. In that case the _isMidstream should show if we are in the middle of reading the result set. In this specific case the dataset is empty and should not be considered in the midstream. If the ReadIntoMemory() is called at this moment it checks the _isMidstream and if true assumes it can safely Read() from the stream (and it will get true or false; both valid). In our case the code fails with exception since we are already at the end of the dataset and there is no more data to read. The fix sets the _isMidstream to false for this case so the ReadIntoMemory() won't Read() from the reader and won't fail. Bottom line is - we can't be in the middle of an empty dataset. > NHybridDataReader.ReadIntoMemory fails when the result is 0 records. "Invalid attempt to read when no data is present". > ----------------------------------------------------------------------------------------------------------------------- > > Key: NH-793 > URL: http://jira.nhibernate.org/browse/NH-793 > Project: NHibernate > Type: Bug > Components: Core > Versions: 1.0.2, 1.0.3 > Reporter: dstefanov > Priority: Critical > > public bool Read() > { > // DS 6/30/06 - If the result is 0 records the read will always return false > // and the _isMidstream should be false so we don't attempt to read from the > // reader when we do ReadIntoMemory. We were getting an error > // "Invalid attempt to read when no data is present" when trying to get data > // from the reader is such cases. > // > //_isMidstream = true; > //return _reader.Read(); > // > _isMidstream = _reader.Read(); > return _isMidstream; > } -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.nhibernate.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
From: NHibernate J. <mik...@us...> - 2006-11-14 19:51:26
|
[ http://jira.nhibernate.org/browse/NH-793?page=comments#action_14402 ] dstefanov commented on NH-793: ------------------------------ ( I should correct my previous comment. ) I'm not very familiar with the whole NHibernate API. I'm only using NHybridDataReader and NDataReader in my application. The fix I'm proposing has been tested and is very easy to check. As seen from the repro if you Read() from the reader and the result set is empty then the Read() method returns false. In that case the _isMidstream should show if we are in the middle of reading the result set. In this specific case the dataset is empty and should not be considered in the midstream. If the ReadIntoMemory() is called at this moment it checks the _isMidstream and if true assumes it can safely read the record values from the stream - GetValues(). In our case the code fails with exception since the dataset is empty and there is no record to read. The fix sets the _isMidstream to false for this case so the ReadIntoMemory() will call Read() from the reader before it reads the values and the Read() will return false and won't fail. Bottom line is - we can't be in the middle of an empty dataset. > NHybridDataReader.ReadIntoMemory fails when the result is 0 records. "Invalid attempt to read when no data is present". > ----------------------------------------------------------------------------------------------------------------------- > > Key: NH-793 > URL: http://jira.nhibernate.org/browse/NH-793 > Project: NHibernate > Type: Bug > Components: Core > Versions: 1.0.2, 1.0.3 > Reporter: dstefanov > Priority: Critical > > public bool Read() > { > // DS 6/30/06 - If the result is 0 records the read will always return false > // and the _isMidstream should be false so we don't attempt to read from the > // reader when we do ReadIntoMemory. We were getting an error > // "Invalid attempt to read when no data is present" when trying to get data > // from the reader is such cases. > // > //_isMidstream = true; > //return _reader.Read(); > // > _isMidstream = _reader.Read(); > return _isMidstream; > } -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.nhibernate.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
From: NHibernate J. <mik...@us...> - 2006-11-14 20:01:29
|
[ http://jira.nhibernate.org/browse/NH-793?page=all ] Sergey Koshcheyev reopened NH-793: ---------------------------------- > NHybridDataReader.ReadIntoMemory fails when the result is 0 records. "Invalid attempt to read when no data is present". > ----------------------------------------------------------------------------------------------------------------------- > > Key: NH-793 > URL: http://jira.nhibernate.org/browse/NH-793 > Project: NHibernate > Type: Bug > Components: Core > Versions: 1.0.2, 1.0.3 > Reporter: dstefanov > Priority: Critical > > public bool Read() > { > // DS 6/30/06 - If the result is 0 records the read will always return false > // and the _isMidstream should be false so we don't attempt to read from the > // reader when we do ReadIntoMemory. We were getting an error > // "Invalid attempt to read when no data is present" when trying to get data > // from the reader is such cases. > // > //_isMidstream = true; > //return _reader.Read(); > // > _isMidstream = _reader.Read(); > return _isMidstream; > } -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.nhibernate.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
From: NHibernate J. <mik...@us...> - 2006-11-14 20:03:23
|
[ http://jira.nhibernate.org/browse/NH-793?page=all ] Sergey Koshcheyev updated NH-793: --------------------------------- Fix Version: 1.2.0.CR1 Priority: Trivial (was: Critical) Ok, I'll fix it in 1.2.0.CR1 then since from your description it looks like it is not critical at all. > NHybridDataReader.ReadIntoMemory fails when the result is 0 records. "Invalid attempt to read when no data is present". > ----------------------------------------------------------------------------------------------------------------------- > > Key: NH-793 > URL: http://jira.nhibernate.org/browse/NH-793 > Project: NHibernate > Type: Bug > Components: Core > Versions: 1.0.2, 1.0.3 > Reporter: dstefanov > Priority: Trivial > Fix For: 1.2.0.CR1 > > public bool Read() > { > // DS 6/30/06 - If the result is 0 records the read will always return false > // and the _isMidstream should be false so we don't attempt to read from the > // reader when we do ReadIntoMemory. We were getting an error > // "Invalid attempt to read when no data is present" when trying to get data > // from the reader is such cases. > // > //_isMidstream = true; > //return _reader.Read(); > // > _isMidstream = _reader.Read(); > return _isMidstream; > } -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.nhibernate.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
From: NHibernate J. <mik...@us...> - 2006-11-20 10:37:27
|
[ http://jira.nhibernate.org/browse/NH-793?page=all ] Sergey Koshcheyev closed NH-793: -------------------------------- Resolution: Fixed > NHybridDataReader.ReadIntoMemory fails when the result is 0 records. "Invalid attempt to read when no data is present". > ----------------------------------------------------------------------------------------------------------------------- > > Key: NH-793 > URL: http://jira.nhibernate.org/browse/NH-793 > Project: NHibernate > Type: Bug > Components: Core > Versions: 1.0.2, 1.0.3 > Reporter: dstefanov > Priority: Trivial > Fix For: 1.2.0.CR1 > > public bool Read() > { > // DS 6/30/06 - If the result is 0 records the read will always return false > // and the _isMidstream should be false so we don't attempt to read from the > // reader when we do ReadIntoMemory. We were getting an error > // "Invalid attempt to read when no data is present" when trying to get data > // from the reader is such cases. > // > //_isMidstream = true; > //return _reader.Read(); > // > _isMidstream = _reader.Read(); > return _isMidstream; > } -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.nhibernate.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |