Skip to content

Commit 3a7f1fb

Browse files
committed
Ignore more strict binary/string conversion.
MySQL 8.0.24 can't compare arbitrary binary data to a utf8mb4 string column.
1 parent 8ba116b commit 3a7f1fb

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/MySqlConnector/MySqlErrorCode.g.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3231,6 +3231,11 @@ public enum MySqlErrorCode
32313231
/// </summary>
32323232
CannotExecuteInReadOnlyTransaction = 1792,
32333233

3234+
/// <summary>
3235+
/// ER_CANNOT_CONVERT_STRING
3236+
/// </summary>
3237+
CannotConvertString = 3854,
3238+
32343239
/// <summary>
32353240
/// ER_CLIENT_INTERACTION_TIMEOUT
32363241
/// </summary>

tests/SideBySide/DataTypes.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -457,8 +457,15 @@ public async Task QueryWithGuidParameter(bool oldGuids)
457457
csb.OldGuids = oldGuids;
458458
using var connection = new MySqlConnection(csb.ConnectionString);
459459
await connection.OpenAsync().ConfigureAwait(false);
460-
Assert.Equal(oldGuids ? 0L : 1L, (await connection.QueryAsync<long>(@"select count(*) from datatypes_strings where guid = @guid", new { guid = new Guid("fd24a0e8-c3f2-4821-a456-35da2dc4bb8f") }).ConfigureAwait(false)).SingleOrDefault());
461-
Assert.Equal(oldGuids ? 0L : 1L, (await connection.QueryAsync<long>(@"select count(*) from datatypes_strings where guidbin = @guid", new { guid = new Guid("fd24a0e8-c3f2-4821-a456-35da2dc4bb8f") }).ConfigureAwait(false)).SingleOrDefault());
460+
try
461+
{
462+
Assert.Equal(oldGuids ? 0L : 1L, (await connection.QueryAsync<long>(@"select count(*) from datatypes_strings where guid = @guid", new { guid = new Guid("fd24a0e8-c3f2-4821-a456-35da2dc4bb8f") }).ConfigureAwait(false)).SingleOrDefault());
463+
Assert.Equal(oldGuids ? 0L : 1L, (await connection.QueryAsync<long>(@"select count(*) from datatypes_strings where guidbin = @guid", new { guid = new Guid("fd24a0e8-c3f2-4821-a456-35da2dc4bb8f") }).ConfigureAwait(false)).SingleOrDefault());
464+
}
465+
catch (MySqlException ex) when (oldGuids && ex.Number == 3854 /* MySqlErrorCode.CannotConvertString */)
466+
{
467+
// new error in MySQL 8.0.24
468+
}
462469
Assert.Equal(oldGuids ? 1L : 0L, (await connection.QueryAsync<long>(@"select count(*) from datatypes_blobs where guidbin = @guid", new { guid = new Guid(0x33221100, 0x5544, 0x7766, 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF) }).ConfigureAwait(false)).SingleOrDefault());
463470
}
464471

0 commit comments

Comments
 (0)