[Mono-dev] OdbcParameter.CopyValue does not implement Binary
Ernesto
equistango at gmail.com
Tue Jul 15 19:30:27 EDT 2008
Nagappan A escribió:
> Hello Ernesto,
>
> Could you please attach a test to verify your patch ?
>
As you can see in my patch, the odbc type handling code is already
there. I'm suggesting using the current code to handle the Binary type
as well (it's already handling VarBinary).
I don't know exactly what to test for, since I didn't write the original
class and this is not a bug fix. Not even a new implementation.
The attached patch, however, will check whether OdbcType.Binary is beign
handled or not.
Does this help?
Regards,
Ernesto
> Thanks
> Nagappan
>
> 2008/7/14 Ernesto <equistango at gmail.com <mailto: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
> <mailto: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 embedded and charset-unspecified text was scrubbed...
Name: odbcparamenter_binary_test.patch
Url: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20080715/9e8f90e7/attachment.pl
More information about the Mono-devel-list
mailing list