Bug #61589 connector/NET doesn't properly handle IsolationLevel.Snapshot
Submitted: 21 Jun 2011 15:04 Modified: 27 Jun 2011 20:53
Reporter: Matthew Lord Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / NET Severity:S3 (Non-critical)
Version:6.3.6 OS:Any
Assigned to: Julio Casal CPU Architecture:Any

[21 Jun 2011 15:04] Matthew Lord
Description:
           Transaction = Connection.BeginTransaction(IsolationLevel.Snapshot);
           Transaction.Commit();

The above leads to a syntax error as this SQL statement ends up getting sent to the server:
"SET SESSION TRANSACTION ISOLATION LEVEL "

The problem is that we're not handling this isolation level in the related CASE statement:

cmd.CommandText = "SET SESSION TRANSACTION ISOLATION LEVEL ";
switch (iso)
{
case IsolationLevel.ReadCommitted:
  cmd.CommandText += "READ COMMITTED";
  break;
case IsolationLevel.ReadUncommitted:
  cmd.CommandText += "READ UNCOMMITTED";
  break;
case IsolationLevel.RepeatableRead:
  cmd.CommandText += "REPEATABLE READ";
  break;
case IsolationLevel.Serializable:
  cmd.CommandText += "SERIALIZABLE";
  break;
case IsolationLevel.Chaos:
  throw new NotSupportedException(Resources.ChaosNotSupported);
}
cmd.ExecuteNonQuery();

How to repeat:
N/A

Suggested fix:
We need to add another CASE:

case IsolationLevel.Snapshot:
  throw new NotSupportedException(Resources.SnapshotNotSupported);
[27 Jun 2011 20:53] Julio Casal
Thank you for your bug report. This issue has been committed to our source repository of that product and will be incorporated into the next release.

Fixed in 6.1.6, 6.2.5, 6.3.8 and 6.4.1+.

If necessary, you can access the source repository and build the latest available version, including the bug fix. More information about accessing the source trees is available at

    http://dev.mysql.com/doc/en/installing-source.html