[Mono-dev] Patch for SqlCommand

A Nagappan anagappan at novell.com
Thu Jun 7 09:00:23 EDT 2007


Hi,
  Tested the attached patch, could you please verify it in your
environment ?

Thanks
Nagappan

Nagappan A <anagappan at novell.com>
Linux Desktop Testing Project - http://ldtp.freedesktop.org
http://nagappanal.blogspot.com

Novell, Inc.
SUSE® Linux Enterprise 10
Your Linux is ready™
http://www.novell.com/linux


>>> "Amc Gmail" <amc1999 at gmail.com> 06/07/07 12:06 AM >>>
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
>
>
>
_______________________________________________
Mono-devel-list mailing list
Mono-devel-list at lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: dispose.patch
Url: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20070607/304893fe/attachment.pl 


More information about the Mono-devel-list mailing list