You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Software versions
MySqlConnector version: 2.3.7
Server type (MySQL, MariaDB, Aurora, etc.) and version: Mysql 5.6
.NET version: any
Describe the bug
Mysql 5.6 stores guids in binary format. binary(16)
When you define a guid output parameter mysqlconnector cannot convert byte[] received from mysql to Guid.
Because it tries to convert it via ToString -> Parse
Exception
System.FormatException
HResult=0x80131537
Message=Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).
Source=System.Private.CoreLib
StackTrace:
at System.Guid.GuidResult.SetFailure(Boolean overflow, String failureMessageID)
at System.Guid.TryParseExactN(ReadOnlySpan`1 guidString, GuidResult& result)
at System.Guid.TryParseGuid(ReadOnlySpan`1 guidString, GuidResult& result)
at System.Guid.Parse(String input)
at MySqlConnector.Core.TypeMapper.<>c.<.ctor>b__3_13(Object o) in C:\git\MySqlConnector\src\MySqlConnector\Core\TypeMapper.cs:line 114
at MySqlConnector.Core.DbTypeMapping.DoConversion(Object obj) in C:\git\MySqlConnector\src\MySqlConnector\Core\DbTypeMapping.cs:line 14
at MySqlConnector.MySqlDataReader.<ReadOutParametersAsync>d__111.MoveNext() in C:\git\MySqlConnector\src\MySqlConnector\MySqlDataReader.cs:line 671
at MySqlConnector.MySqlDataReader.<InitAsync>d__107.MoveNext() in C:\git\MySqlConnector\src\MySqlConnector\MySqlDataReader.cs:line 486
at MySqlConnector.Core.CommandExecutor.<ExecuteReaderAsync>d__0.MoveNext() in C:\git\MySqlConnector\src\MySqlConnector\Core\CommandExecutor.cs:line 56
at System.Threading.Tasks.ValueTask`1.get_Result()
at System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable`1.ConfiguredValueTaskAwaiter.GetResult()
at MySqlConnector.MySqlCommand.<ExecuteNonQueryAsync>d__78.MoveNext() in C:\git\MySqlConnector\src\MySqlConnector\MySqlCommand.cs:line 309
at System.Threading.Tasks.ValueTask`1.get_Result()
at MySqlConnector.MySqlCommand.ExecuteNonQuery() in C:\git\MySqlConnector\src\MySqlConnector\MySqlCommand.cs:line 108
at ConsoleApp3.Program.TestNullOutParam(String connStr) in C:\git\MySqlConnector\ConsoleApp3\Program.cs:line 52
at ConsoleApp3.Program.Main(String[] args) in C:\git\MySqlConnector\ConsoleApp3\Program.cs:line 16
DROP PROCEDURE IF EXISTS `aa_test_out_par`$$
CREATE PROCEDURE `aa_test_out_par`
(
OUT v_OrigID BINARY(16)
)
BEGINSELECT id INTO v_OrigID FROM ....
END$$
v_OrigID is guid stored in binary(16)
Expected behavior
it is expected when byte[] is recieved from Mysql side and the output parameter type is Guid
then mysqlconnector should create guid from byte[] like New Guid(byte[]) instead of converting the object to string and parsing back to Guid.
The text was updated successfully, but these errors were encountered:
Neither LittleEndianBinary16 nor Binary16 specified in the connection string works.
there are no issues with the data received using a reader. it works fine with LittleEndianBinary16.
The problem is only with output parameters.
but there is a workaround
var p = new MySqlParameter("@name1", MySqlDbType.Binary) works.
and then to create manually the guid from byte[]
Software versions
MySqlConnector version: 2.3.7
Server type (MySQL, MariaDB, Aurora, etc.) and version: Mysql 5.6
.NET version: any
Describe the bug
Mysql 5.6 stores guids in binary format. binary(16)
When you define a guid output parameter mysqlconnector cannot convert byte[] received from mysql to Guid.
Because it tries to convert it via ToString -> Parse
Exception
Code sample
stored proc sample:
v_OrigID is guid stored in binary(16)
Expected behavior
it is expected when byte[] is recieved from Mysql side and the output parameter type is Guid
then mysqlconnector should create guid from byte[] like New Guid(byte[]) instead of converting the object to string and parsing back to Guid.
The text was updated successfully, but these errors were encountered: