[Mono-dev] Patch for SqlCommand

Amc Gmail amc1999 at gmail.com
Wed Jun 6 14:36:33 EDT 2007


IMHO, we just need to remove from SqlDataReader Close() unnecessary line:
        command.Connection.DataReader = null;
because right after this we have
        command.CloseDataReader (moreResults);
which doing same things at the beginning of  CloseDataReader():
        Connection.DataReader = null;

Sorry, i can't test this today, it would be really nice if someone can
verify it.

also in SqlCommand.Dispose(), OdbcCommand.Dispose() and some other
places call of
    base.Dispose (disposing);
may be a good idea. without it Disposed events seems to be not going through.
regards,
amc




On 6/6/07, Neil Cawse <neilcawse at geotab.com> wrote:
>
>
>
>
> At the moment SqlCommand is broken in our application from a recent commit.
>
>
>
> SqlDataReader is internally constructed with the SqlCommand that created it.
>
> The close method of SqlDataReader relies on the fact that the connection for
> a command still exists:
>
> command.Connection.DataReader = null
>
> A previous commit sets this to null in the SqlCommand.Dispose
>
>
>
> There may be better fixed with some re-architecture – not sure..
>
>
>
> Index:
> /home/neilcawse/mymono/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs
>
> ===================================================================
>
> ---
> /home/neilcawse/mymono/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs
>    (revision 78769)
>
> +++
> /home/neilcawse/mymono/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs
>    (working copy)
>
> @@ -582,7 +582,6 @@
>
>                       if (disposing) {
>
>                              parameters.Clear();
>
>                              transaction = null;
>
> -                            connection = null;
>
>                       }
>
>                       disposed = true;
>
>                }
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
>
>



More information about the Mono-devel-list mailing list