Modified:
trunk/CHANGES
trunk/Driver/Source/SchemaProvider.cs
trunk/Driver/Source/command.cs
trunk/TestSuite/CommandTests.cs
Log:
merge from 5.0 branch
Modified: trunk/CHANGES
===================================================================
--- trunk/CHANGES 2007-01-05 23:14:12 UTC (rev 539)
+++ trunk/CHANGES 2007-01-08 15:02:30 UTC (rev 540)
@@ -1,3 +1,9 @@
+Version 5.0.4
+
+ Bugs fixed
+ ----------
+ Bug #25443 ExecuteScalar() hangs when more than one bad result
+
Version 5.0.3 12-31-2006
Bugs fixed
Modified: trunk/Driver/Source/SchemaProvider.cs
===================================================================
--- trunk/Driver/Source/SchemaProvider.cs 2007-01-05 23:14:12 UTC (rev 539)
+++ trunk/Driver/Source/SchemaProvider.cs 2007-01-08 15:02:30 UTC (rev 540)
@@ -103,7 +103,11 @@
dt.Columns.Add("CREATE_OPTIONS", typeof(string));
dt.Columns.Add("TABLE_COMMENT", typeof(string));
- DataTable databases = GetDatabases(restrictions);
+ // we have to new up a new restriction array here since
+ // GetDatabases takes the database in the first slot
+ string[] dbRestriction = new string[1] { restrictions[1] };
+ DataTable databases = GetDatabases(dbRestriction);
+
foreach (DataRow db in databases.Rows)
{
restrictions[1] = db["SCHEMA_NAME"].ToString();
Modified: trunk/Driver/Source/command.cs
===================================================================
--- trunk/Driver/Source/command.cs 2007-01-05 23:14:12 UTC (rev 539)
+++ trunk/Driver/Source/command.cs 2007-01-08 15:02:30 UTC (rev 540)
@@ -414,24 +414,29 @@
{
lastInsertedId = -1;
object val = null;
- MySqlDataReader reader = ExecuteReader();
- try
- {
- if (reader != null)
- {
- if (reader.Read())
- val = reader.GetValue(0);
- reader.Close();
- lastInsertedId = reader.InsertedId;
- reader = null;
- }
- }
- catch (Exception)
- {
- if (reader != null)
- reader.Close();
- throw;
- }
+
+ MySqlDataReader reader = ExecuteReader();
+ if (reader == null) return null;
+
+ try
+ {
+ if (reader.Read())
+ val = reader.GetValue(0);
+ }
+ catch (Exception)
+ {
+ throw;
+ }
+ finally
+ {
+ if (reader != null)
+ {
+ reader.Close();
+ lastInsertedId = reader.InsertedId;
+ }
+ reader = null;
+ }
+
return val;
}
Modified: trunk/TestSuite/CommandTests.cs
===================================================================
--- trunk/TestSuite/CommandTests.cs 2007-01-05 23:14:12 UTC (rev 539)
+++ trunk/TestSuite/CommandTests.cs 2007-01-08 15:02:30 UTC (rev 540)
@@ -382,6 +382,39 @@
Assert.Fail(ex.Message);
}
}
+
+ /// <summary>
+ /// Bug #25443 ExecuteScalar() hangs when more than one bad result
+ /// </summary>
+ [Test]
+ public void ExecuteWithOneBadQuery()
+ {
+ MySqlCommand command = new MySqlCommand("SELECT 1; SELECT * FROM foo", conn);
+ try
+ {
+ command.ExecuteScalar();
+ }
+ catch (MySqlException)
+ {
+ }
+ catch (Exception ex)
+ {
+ Assert.Fail(ex.Message);
+ }
+
+ // now try using ExecuteNonQuery
+ try
+ {
+ command.ExecuteNonQuery();
+ }
+ catch (MySqlException)
+ {
+ }
+ catch (Exception ex)
+ {
+ Assert.Fail(ex.Message);
+ }
+ }
}
| Thread |
|---|
| • Connector/NET commit: r540 - in trunk: . Driver/Source TestSuite | rburnett | 8 Jan |