[Mono-dev] OdbcParameter.CopyValue does not implement Binary
Nagappan A
nagappan at gmail.com
Tue Jul 15 21:46:42 EDT 2008
Hello Ernesto,
This looks good. Varadhan has to commit it though ! :)
PS: #8 should not be included in actual test. I guess it will fail.
Thanks
Nagappan
On Tue, Jul 15, 2008 at 4:30 PM, Ernesto <equistango at gmail.com> wrote:
> 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
>>
>
>
> Index: OdbcParameterTest.cs
> ===================================================================
> --- OdbcParameterTest.cs (revision 107988)
> +++ OdbcParameterTest.cs (working copy)
> @@ -60,6 +60,10 @@
> param = new OdbcParameter ("test", OdbcType.NText);
> Assert.AreEqual (null, param.Value, "#6");
> Assert.AreEqual (OdbcType.NText, param.OdbcType,
> "#7");
> +
> + param = new OdbcParameter ("test",
> OdbcType.Binary);
> + Assert.AreEqual (null, param.Value, "#8");
> + Assert.AreEqual (OdbcType.Binary, param.OdbcType,
> "#9");
> }
>
> }
>
>
--
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/7e086284/attachment.html
More information about the Mono-devel-list
mailing list