From: Date: October 23 2006 6:59pm Subject: Connector/NET commit: r429 - in branches/1.0: . TestSuite mysqlclient List-Archive: http://lists.mysql.com/commits/14201 X-Bug: 23538 Message-Id: <200610231659.k9NGxodG023276@bk-internal.mysql.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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(); } } + + /// + /// Bug #23538 Exception thrown when GetSchemaTable is called and "fields" is null. + /// + [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");