Modified:
trunk/Driver/Source/command.cs
trunk/MySql.Web/Tests/MySql.Web.Tests.csproj
Log:
forgot these files from my merge from 5.1. There are still part of the merge from 5.1 up through r:1011
Modified: trunk/Driver/Source/command.cs
===================================================================
--- trunk/Driver/Source/command.cs 2007-09-20 15:08:30 UTC (rev 1013)
+++ trunk/Driver/Source/command.cs 2007-09-20 15:12:20 UTC (rev 1014)
@@ -520,8 +520,8 @@
#region Async Methods
- internal delegate int AsyncExecuteNonQueryDelegate();
- internal delegate MySqlDataReader AsyncExecuteReaderDelegate(CommandBehavior behavior);
+ internal delegate void AsyncDelegate(int type, CommandBehavior behavior);
+ internal Exception thrownException;
private string TrimSemicolons(string sql)
{
@@ -536,6 +536,22 @@
return sb.ToString(start, end - start + 1);
}
+ internal void AsyncExecuteWrapper(int type, CommandBehavior behavior)
+ {
+ thrownException = null;
+ try
+ {
+ if (type == 1)
+ ExecuteReader(behavior);
+ else
+ ExecuteNonQuery();
+ }
+ catch (Exception ex)
+ {
+ thrownException = ex;
+ }
+ }
+
/// <summary>
/// Initiates the asynchronous execution of the SQL statement or stored procedure
/// that is described by this <see cref="MySqlCommand"/>, and retrieves one or more
@@ -563,8 +579,8 @@
/// the returned rows. </returns>
public IAsyncResult BeginExecuteReader(CommandBehavior behavior)
{
- AsyncExecuteReaderDelegate del = new AsyncExecuteReaderDelegate(ExecuteReader);
- asyncResult = del.BeginInvoke(behavior, null, null);
+ AsyncDelegate del = new AsyncDelegate(AsyncExecuteWrapper);
+ asyncResult = del.BeginInvoke(1, behavior, null, null);
return asyncResult;
}
@@ -578,6 +594,8 @@
public MySqlDataReader EndExecuteReader(IAsyncResult result)
{
result.AsyncWaitHandle.WaitOne();
+ if (thrownException != null)
+ throw thrownException;
return connection.Reader;
}
@@ -597,9 +615,9 @@
/// which returns the number of affected rows. </returns>
public IAsyncResult BeginExecuteNonQuery(AsyncCallback callback, object stateObject)
{
- AsyncExecuteNonQueryDelegate del =
- new AsyncExecuteNonQueryDelegate(ExecuteNonQuery);
- asyncResult = del.BeginInvoke(callback, stateObject);
+ AsyncDelegate del = new AsyncDelegate(AsyncExecuteWrapper);
+ asyncResult = del.BeginInvoke(2, CommandBehavior.Default,
+ callback, stateObject);
return asyncResult;
}
@@ -612,9 +630,8 @@
/// which returns the number of affected rows. </returns>
public IAsyncResult BeginExecuteNonQuery()
{
- AsyncExecuteNonQueryDelegate del =
- new AsyncExecuteNonQueryDelegate(ExecuteNonQuery);
- asyncResult = del.BeginInvoke(null, null);
+ AsyncDelegate del = new AsyncDelegate(AsyncExecuteWrapper);
+ asyncResult = del.BeginInvoke(2, CommandBehavior.Default, null, null);
return asyncResult;
}
@@ -627,6 +644,8 @@
public int EndExecuteNonQuery(IAsyncResult asyncResult)
{
asyncResult.AsyncWaitHandle.WaitOne();
+ if (thrownException != null)
+ throw thrownException;
return (int)updatedRowCount;
}
Modified: trunk/MySql.Web/Tests/MySql.Web.Tests.csproj
===================================================================
--- trunk/MySql.Web/Tests/MySql.Web.Tests.csproj 2007-09-20 15:08:30 UTC (rev 1013)
+++ trunk/MySql.Web/Tests/MySql.Web.Tests.csproj 2007-09-20 15:12:20 UTC (rev 1014)
@@ -43,9 +43,6 @@
<Compile Include="UserManagement.cs" />
</ItemGroup>
<ItemGroup>
- <None Include="App.config" />
- </ItemGroup>
- <ItemGroup>
<ProjectReference Include="..\..\Driver\MySql.Data.csproj">
<Project>{E9DF5ED1-4CBD-4226-B931-9A51610AC14D}</Project>
<Name>MySql.Data</Name>
| Thread |
|---|
| • Connector/NET commit: r1014 - in trunk: Driver/Source MySql.Web/Tests | rburnett | 20 Sep |