List:Commits« Previous MessageNext Message »
From:Reggie Burnett Date:March 31 2011 6:01pm
Subject:Re: bzr commit into connector-net-6.1 branch (julio.casal:879) Bug#60541
View as plain text  
On 3/31/2011 12:13 PM, Julio casal wrote:
> #At file:///C:/Users/jcasalt/Dev/connector-net/6.1/ based on
> revid:reggie.burnett@stripped
>
> === modified file 'MySql.Data/Provider/Source/command.cs'
> --- a/MySql.Data/Provider/Source/command.cs	2011-03-09 18:15:07 +0000
> +++ b/MySql.Data/Provider/Source/command.cs	2011-03-31 17:13:10 +0000
> @@ -269,6 +276,11 @@
>                        connection.ServerThread), c);
>                   cmd.ExecuteNonQuery();
>                   canceled = true;
> +
> +                if (connection.Reader != null)
> +                {
> +                    connection.Reader.Canceled = true;
> +                }

why do this?

>   			}
>   		}
>
> @@ -301,7 +313,7 @@
>                   throw new InvalidOperationException("Connection must be valid and
> open.");
>
>   			// Data readers have to be closed first
> -			if (connection.Reader != null)
> +            if (connection.IsInUse&&  !this.internallyCreated)
>   				throw new MySqlException("There is already an open DataReader associated with
> this Connection which
makes sense

> @@ -459,14 +472,6 @@
>                   }
>                   catch (Exception) { }
>
> -
> -                // if we caught an exception because of a cancel, then just return
> null
> -                if (ex.IsQueryAborted)
> -                {
> -                    if (TimedOut)
> -                        throw new MySqlException(Resources.Timeout);
> -                    return null;
> -                }

I don't think this is right.  Won't this cause the exception generated 
as the result of a cancel to get thrown to the user?  We don't want that.

> === modified file 'MySql.Data/Provider/Source/datareader.cs'
> --- a/MySql.Data/Provider/Source/datareader.cs	2010-12-14 15:18:14 +0000
> +++ b/MySql.Data/Provider/Source/datareader.cs	2011-03-31 17:13:10 +0000
> @@ -29,6 +29,7 @@
>   using System.Collections.Generic;
>   using System.Globalization;
>   using MySql.Data.MySqlClient.Properties;
> +using MySql.Data.Common;
>
>   namespace MySql.Data.MySqlClient
>   {
> @@ -45,6 +46,7 @@
>   		private long lastInsertId;
>   		private PreparableStatement statement;
>           private ResultSet resultSet;
> +        private bool canceled;
>
>   		// Used in special circumstances with stored procs to avoid exceptions from
> DbDataAdapter
>   		// If set, AffectedRows returns -1 instead of 0.
> @@ -96,6 +98,12 @@
>               get { return resultSet; }
>           }
>
> +        internal bool Canceled
> +        {
> +            get { return canceled; }
> +            set { canceled = value; }
> +        }
> +
>   		///<summary>
>   		/// Gets a value indicating the depth of nesting for the current row.  This
> method is not
>   		/// supported currently and always returns 0.
> @@ -185,7 +193,7 @@
>
>   			bool shouldCloseConnection = (commandBehavior& 
> CommandBehavior.CloseConnection) != 0;
>   			commandBehavior = CommandBehavior.Default;
> -			connection.Reader = null;
> +			connection.Reader = null;
>
>               // clear all remaining resultsets
>               resultSet.ClearAll();
> @@ -194,10 +202,17 @@
>   			// stored procedures it needs to update out and inout parameters
>   			command.Close(this);
>
> +            if (this.canceled&&  connection.driver.Version.isAtLeast(5, 1,
> 0))
> +            {
> +                // Issue dummy command to clear kill flag
> +                ClearKillFlag();
> +            }
> +
>   			if (shouldCloseConnection)
>   				connection.Close();
>
>   			command = null;
> +            connection.IsInUse = false;
>   			connection = null;
>
>   			isOpen = false;
> @@ -927,6 +942,33 @@
>   			return v;
>   		}
>
> +
> +        private void ClearKillFlag()
> +        {
> +            try
> +            {
> +                // This query will crash, releasing the kill flag. If it does not
> crash, doesn't matter anyway.
> +                Random rand = new Random();
> +                string dummyStatement = string.Format("SELECT v FROM T{0}",
> rand.Next(1000000));
Why use a random number to do this?

Thread
bzr commit into connector-net-6.1 branch (julio.casal:879) Bug#60541Julio casal31 Mar
  • Re: bzr commit into connector-net-6.1 branch (julio.casal:879) Bug#60541Reggie Burnett31 Mar