[Mono-dev] OdbcParameter.CopyValue does not implement Binary

Nagappan A nagappan at gmail.com
Tue Jul 15 13:36:38 EDT 2008


Hello Ernesto,

Could you please attach a test to verify your patch ?

Thanks
Nagappan

2008/7/14 Ernesto <equistango at gmail.com>:

>
> I noted OdbcParameter.CopyValue does not implement OdbcType.Binary:
>
> DataBase.Execute: System.NotImplementedException: The requested feature is
> not implemented.
>  at System.Data.Odbc.OdbcParameter.CopyValue () [0x000be] in
> /home/usuario/mono/mcs/class/System.Data/System.Data.Odbc/OdbcParameter.cs:432
>
>  at (wrapper remoting-invoke-with-check)
> System.Data.Odbc.OdbcParameter:CopyValue ()
>  at System.Data.Odbc.OdbcCommand.BindParameters () [0x0002d] in
> /home/usuario/mono/mcs/class/System.Data/System.Data.Odbc/OdbcCommand.cs:465
>
>  ...
>
> However it implements OdbcType.VarBinary and OdbcType.Image, which should
> be the same (like Char, VarChar and Text all get the same treatment).
> If you think it's ok, this is a patch to give Binary the same treatment as
> VarBinary. Passed the test suite and tested in real life with myodbc.
>
> Regards,
> Ernesto
>
>
> Index: OdbcParameter.cs
> ===================================================================
> --- OdbcParameter.cs    (revision 107657)
> +++ OdbcParameter.cs    (working copy)
> @@ -428,8 +428,6 @@
>                        byte [] nativeBytes, buffer;
>
>                        switch (_typeMap.OdbcType) {
> -                       case OdbcType.Binary:
> -                               throw new NotImplementedException ();
>                        case OdbcType.Bit:
>                                Marshal.WriteByte (_nativeBuffer,
> Convert.ToByte (Value));
>                                return;
> @@ -488,6 +486,7 @@
>                                return;
>                        case OdbcType.VarBinary:
>                        case OdbcType.Image:
> +                       case OdbcType.Binary:
>                                if (Value.GetType ().IsArray &&
>                                    Value.GetType ().GetElementType () ==
> typeof (byte)) {
>                                        Marshal.Copy ( (byte []) Value, 0,
> _nativeBuffer, ((byte []) Value).Length);
>
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
>


-- 
Linux Desktop (GUI Application) Testing Project -
http://ldtp.freedesktop.org
http://nagappanal.blogspot.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20080715/140e3023/attachment.html 


More information about the Mono-devel-list mailing list