Data types backwards on stored procedure?

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for MySQL
Post Reply
TimKington
Posts: 2
Joined: Thu 11 Dec 2008 22:20

Data types backwards on stored procedure?

Post by TimKington » Thu 11 Dec 2008 22:27

I'm calling a stored procedure with many parameters, two of which are:
inout tinyIntVal tinyint, inout smallIntVal smallint

I add two Parameters to the command:
MySqlType = TinyInt, value = 77 (sbyte)
MySqlType = SmallInt, value = 55 (short)

After executing the procedure, the tinyint parameter has a value of 77 (short), and the smallint has a value of 55 (byte). Shouldn't the types be the other way around? Also, the tinyint parameter should come back as an sbyte, shouldn't it?

I'm using version 5.0.12.0

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Fri 12 Dec 2008 13:00

We have reproduced the issue. We will investigate it and notify you about the results as soon as possible.

TimKington
Posts: 2
Joined: Thu 11 Dec 2008 22:20

Post by TimKington » Fri 12 Dec 2008 19:56

I'm seeing the same thing with unsigned types. If I have
inout smallU smallint unsigned, inout tinyU tinyint unsigned

I get a short back for the tinyint, and a byte back for the smallint.

In general for unsigned types, I'm getting back signed types - bigint unsigned gives back a long, mediumint unsigned and int unsigned give back ints. Shouldn't these be unsigned types? ulong and uint respectively?

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Tue 23 Dec 2008 15:02

When you create parameter, you set its type. And the type of the returning value depends only on the type of this parameter.
1. The tinyint type corresponds to the short type of .NET Framework. The returning value always will be of the short type. We don't map it to sbyte, because sbyte is not supported by CLR.
2. SmallInt is mapped to short. We have fixed the bug with mapping it to byte.

We don't map the returning types as unsinged, because unsigned types are not supported by CLR.

Post Reply