Unexpected pattern of auto-assigned parameter types
Posted: Thu 16 Mar 2017 19:31
I am working on a cross-db ADO.NET wrapper project. I am using the DbProviderFactory for connections, and working with System.Data.Common classes. I have noticed the following, when reading back a TINYINT(1) return value from a test function:
On the Devart dotConnect for MySQL driver:
- If I assign a bool value to my return parameter, the parameter DbType gets automatically set to Int64 and the returned value is a C# short (!)
- If I assign a byte value, the parameter DbType is set to Int16 and the returned value is a C# short
- If I assign an sbyte value, the parameter DbType is set to Int16 and the returned value is a C# short
This compares to the Oracle/MySQL Connector/NET driver on which:
- If I assign a bool value to my return parameter, the parameter DbType gets automatically set to SByte and the returned value is a C# sbyte
- If I assign a byte value, the parameter DbType is set to Byte and the returned value is a C# byte
- If I assign an sbyte value, the parameter DbType is set to SByte and the returned value is a C# sbyte
I find the pattern of results in dotConnect for MySQL quite unexpected (unlike the pattern in Connector/NET) and I suspect other users might find it so too?
Thanks.
On the Devart dotConnect for MySQL driver:
- If I assign a bool value to my return parameter, the parameter DbType gets automatically set to Int64 and the returned value is a C# short (!)
- If I assign a byte value, the parameter DbType is set to Int16 and the returned value is a C# short
- If I assign an sbyte value, the parameter DbType is set to Int16 and the returned value is a C# short
This compares to the Oracle/MySQL Connector/NET driver on which:
- If I assign a bool value to my return parameter, the parameter DbType gets automatically set to SByte and the returned value is a C# sbyte
- If I assign a byte value, the parameter DbType is set to Byte and the returned value is a C# byte
- If I assign an sbyte value, the parameter DbType is set to SByte and the returned value is a C# sbyte
I find the pattern of results in dotConnect for MySQL quite unexpected (unlike the pattern in Connector/NET) and I suspect other users might find it so too?
Thanks.