From 2b593229c252da7e1e945ca5088779a29cbe3e4f Mon Sep 17 00:00:00 2001 From: John Luke Date: Fri, 5 Dec 2003 03:57:56 +0000 Subject: 2003-12-04 John Luke * SqlXmlTextReader.cs: applied patch from Chris Masters fix peek so it checks if it is at the end and also to make sure that if Read() advances the position past the end of the localBuffer array, it makes a call to GetNextBuffer(). fixes bug #40253 System.IndexOutOfRangeException when using SqlCommand.ExecuteXmlReader() svn path=/trunk/mcs/; revision=20797 --- mcs/class/System.Data/System.Data.SqlClient/ChangeLog | 8 ++++++++ mcs/class/System.Data/System.Data.SqlClient/SqlXmlTextReader.cs | 5 ++++- 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'mcs/class/System.Data/System.Data.SqlClient') diff --git a/mcs/class/System.Data/System.Data.SqlClient/ChangeLog b/mcs/class/System.Data/System.Data.SqlClient/ChangeLog index b7cd25553a8..059099f5caf 100755 --- a/mcs/class/System.Data/System.Data.SqlClient/ChangeLog +++ b/mcs/class/System.Data/System.Data.SqlClient/ChangeLog @@ -1,3 +1,11 @@ +2003-12-04 John Luke + + * SqlXmlTextReader.cs: applied patch from Chris Masters + fix peek so it checks if it is at the end and also to make sure that if Read() + advances the position past the end of the localBuffer array, it makes + a call to GetNextBuffer(). fixes bug #40253 System.IndexOutOfRangeException when + using SqlCommand.ExecuteXmlReader() + 2003-11-20 Joerg Rosenkranz * SqlConnection (SetDefaultConnectionParameters): diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlXmlTextReader.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlXmlTextReader.cs index 4bd8a6eeea3..908ab0b5058 100644 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlXmlTextReader.cs +++ b/mcs/class/System.Data/System.Data.SqlClient/SqlXmlTextReader.cs @@ -78,7 +78,6 @@ namespace System.Data.SqlClient { else { eof = true; localBuffer = ""; - return false; } return true; } @@ -91,6 +90,8 @@ namespace System.Data.SqlClient { if (!moreResults) return -1; } + if (eof && position >= localBuffer.Length) + return -1; return (int) localBuffer[position]; } @@ -98,6 +99,8 @@ namespace System.Data.SqlClient { { int result = Peek (); position += 1; + if (!eof && position >= localBuffer.Length) + GetNextBuffer (); return result; } -- cgit v1.2.3