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
Data types backwards on stored procedure?
-
- Posts: 2
- Joined: Thu 11 Dec 2008 22:20
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?
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?
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.
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.