NullReferenceException when executing stored procedure with enum as parameter.
Happens on version 0.65 and 0.57. It was fine on version 0.56.
CREATE PROCEDURE `proced`(IN input enum ('One', 'Two', 'Three'))
...
command.CommandText = "proced";
command.CommandType = CommandType.StoredProcedure;
command.Parameters.Add(new MySqlParameter("input", "One"));
using(DbDataReader reader = await command.ExecuteReaderAsync()){}
...
I tried changing the parameter to varchar and it worked on all three versions.
CREATE PROCEDURE `proced`(IN input varchar(30))
...
Here's stack trace for version 0.65
System.NullReferenceException: Object reference not set to an instance of an object.
at MySqlConnector.Core.TypeMapper.GetMySqlDbType(String typeName, Boolean unsigned, Int32 length) in /_/src/MySqlConnector/Core/TypeMapper.cs:line 169
at MySqlConnector.Core.CachedParameter..ctor(Int32 ordinalPosition, String mode, String name, String dataType, Boolean unsigned, Int32 length) in /_/src/MySqlConnector/Core/CachedParameter.cs:line 21
at MySqlConnector.Core.CachedProcedure.FillAsync(IOBehavior ioBehavior, MySqlConnection connection, String schema, String component, CancellationToken cancellationToken)
at MySql.Data.MySqlClient.MySqlConnection.GetCachedProcedure(String name, Boolean revalidateMissing, IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/MySql.Data.MySqlClient/MySqlConnection.cs:line 550
at MySqlConnector.Core.CommandExecutor.ExecuteReaderAsync(IReadOnlyList`1 commands, ICommandPayloadCreator payloadCreator, CommandBehavior behavior, IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/Core/CommandExecutor.cs:line 39
==== Edit 1 ====
After digging in the source code, i found that CachedProcedure.FillAsync is no longer using DATA_TYPE column from information_schema.parameters, instead it parses the dataType from DTD_IDENTIFIER column. That should be fine, but the parser doesn't seem to handle enum.
DTD_IDENTIFIER value for enum parameter should look like this enum('YES','NO').
NullReferenceException when executing stored procedure with enum as parameter.
Happens on version 0.65 and 0.57. It was fine on version 0.56.
I tried changing the parameter to varchar and it worked on all three versions.
Here's stack trace for version 0.65
==== Edit 1 ====
After digging in the source code, i found that CachedProcedure.FillAsync is no longer using
DATA_TYPEcolumn frominformation_schema.parameters, instead it parses the dataType fromDTD_IDENTIFIERcolumn. That should be fine, but the parser doesn't seem to handle enum.DTD_IDENTIFIERvalue for enum parameter should look like thisenum('YES','NO').