List:Commits« Previous MessageNext Message »
From:rburnett Date:October 23 2006 6:59pm
Subject:Connector/NET commit: r429 - in branches/1.0: . TestSuite mysqlclient
View as plain text  
Modified:
   branches/1.0/CHANGES
   branches/1.0/TestSuite/DataReaderTests.cs
   branches/1.0/mysqlclient/datareader.cs
Log:
Bug #23538 Exception thrown when GetSchemaTable is called and "fields" is null. 


Modified: branches/1.0/CHANGES
===================================================================
--- branches/1.0/CHANGES	2006-10-23 16:57:27 UTC (rev 428)
+++ branches/1.0/CHANGES	2006-10-23 16:59:49 UTC (rev 429)
@@ -5,7 +5,8 @@
     Bugs fixed or addressed
     -----------------------
     Bug #23268 System.FormatException when invoking procedure with ENUM input parameter 
-    
+		Bug #23538 Exception thrown when GetSchemaTable is called and "fields" is null. 
+		
 Version 1.0.8 RC
 
     Other changes

Modified: branches/1.0/TestSuite/DataReaderTests.cs
===================================================================
--- branches/1.0/TestSuite/DataReaderTests.cs	2006-10-23 16:57:27 UTC (rev 428)
+++ branches/1.0/TestSuite/DataReaderTests.cs	2006-10-23 16:59:49 UTC (rev 429)
@@ -840,5 +840,23 @@
 					reader.Close();
 			}
 		}
+
+		/// <summary>
+		/// Bug #23538 Exception thrown when GetSchemaTable is called and "fields" is null. 
+		/// </summary>
+		[Category("5.0")]
+		[Test]
+		public void GetSchemaTableOnEmptyResultset()
+		{
+			execSQL("CREATE PROCEDURE spTest() BEGIN END");
+
+			MySqlCommand cmd = new MySqlCommand("spTest", conn);
+			cmd.CommandType = CommandType.StoredProcedure;
+			using (MySqlDataReader reader = cmd.ExecuteReader())
+			{
+				DataTable dt = reader.GetSchemaTable();
+				Assert.IsNull(dt);
+			}
+		}
 	}
 }

Modified: branches/1.0/mysqlclient/datareader.cs
===================================================================
--- branches/1.0/mysqlclient/datareader.cs	2006-10-23 16:57:27 UTC (rev 428)
+++ branches/1.0/mysqlclient/datareader.cs	2006-10-23 16:59:49 UTC (rev 429)
@@ -472,7 +472,7 @@
 			// Only Results from SQL SELECT Queries 
 			// get a DataTable for schema of the result
 			// otherwise, DataTable is null reference
-			if (fields.Length == 0) return null;
+			if (fields == null || fields.Length == 0) return null;
 
 			DataTable dataTableSchema = new DataTable("SchemaTable");
 

Thread
Connector/NET commit: r429 - in branches/1.0: . TestSuite mysqlclientrburnett23 Oct