Skip to content

Commit 7ec2228

Browse files
committed
Use session isolation level by default. Fixes #801
1 parent 90cd1c5 commit 7ec2228

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/MySqlConnector/Core/StandardEnlistedTransaction.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ protected override void OnStart()
2929
_ => "repeatable read",
3030
};
3131

32-
using var cmd = new MySqlCommand($"set transaction isolation level {isolationLevel};", Connection);
32+
using var cmd = new MySqlCommand($"set session transaction isolation level {isolationLevel};", Connection);
3333
cmd.ExecuteNonQuery();
3434

3535
var consistentSnapshotText = Transaction.IsolationLevel == IsolationLevel.Snapshot ? " with consistent snapshot" : "";

src/MySqlConnector/MySql.Data.MySqlClient/MySqlConnection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ private async ValueTask<MySqlTransaction> BeginDbTransactionAsync(IsolationLevel
7171
_ => throw new NotSupportedException("IsolationLevel.{0} is not supported.".FormatInvariant(isolationLevel))
7272
};
7373

74-
using (var cmd = new MySqlCommand($"set transaction isolation level {isolationLevelValue};", this))
74+
using (var cmd = new MySqlCommand($"set session transaction isolation level {isolationLevelValue};", this))
7575
{
7676
await cmd.ExecuteNonQueryAsync(ioBehavior, cancellationToken).ConfigureAwait(false);
7777

0 commit comments

Comments
 (0)