@@ -13,7 +13,7 @@ namespace Xtensive.Sql.Drivers.MySql
1313{
1414 internal class Connection : SqlConnection
1515 {
16- private readonly MySqlConnection underlyingConnection ;
16+ private MySqlConnection underlyingConnection ;
1717 private MySqlTransaction activeTransaction ;
1818
1919 /// <inheritdoc/>
@@ -39,22 +39,28 @@ public override DbParameter CreateParameter()
3939 [ SecuritySafeCritical ]
4040 public override void BeginTransaction ( )
4141 {
42- EnsureTrasactionIsNotActive ( ) ;
42+ EnsureIsNotDisposed ( ) ;
43+ EnsureTransactionIsNotActive ( ) ;
44+
4345 activeTransaction = underlyingConnection . BeginTransaction ( ) ;
4446 }
4547
4648 /// <inheritdoc/>
4749 [ SecuritySafeCritical ]
4850 public override void BeginTransaction ( IsolationLevel isolationLevel )
4951 {
50- EnsureTrasactionIsNotActive ( ) ;
52+ EnsureIsNotDisposed ( ) ;
53+ EnsureTransactionIsNotActive ( ) ;
54+
5155 activeTransaction = underlyingConnection . BeginTransaction ( SqlHelper . ReduceIsolationLevel ( isolationLevel ) ) ;
5256 }
5357
5458 /// <inheritdoc/>
5559 public override void MakeSavepoint ( string name )
5660 {
61+ EnsureIsNotDisposed ( ) ;
5762 EnsureTransactionIsActive ( ) ;
63+
5864 string commandText = string . Format ( "SAVEPOINT {0}" , name ) ;
5965 using ( DbCommand command = CreateCommand ( commandText ) )
6066 command . ExecuteNonQuery ( ) ;
@@ -63,7 +69,9 @@ public override void MakeSavepoint(string name)
6369 /// <inheritdoc/>
6470 public override void RollbackToSavepoint ( string name )
6571 {
72+ EnsureIsNotDisposed ( ) ;
6673 EnsureTransactionIsActive ( ) ;
74+
6775 string commandText = string . Format ( "ROLLBACK TO SAVEPOINT {0}; RELEASE SAVEPOINT {0};" , name ) ;
6876 using ( DbCommand command = CreateCommand ( commandText ) )
6977 command . ExecuteNonQuery ( ) ;
@@ -72,7 +80,9 @@ public override void RollbackToSavepoint(string name)
7280 /// <inheritdoc/>
7381 public override void ReleaseSavepoint ( string name )
7482 {
83+ EnsureIsNotDisposed ( ) ;
7584 EnsureTransactionIsActive ( ) ;
85+
7686 string commandText = string . Format ( "RELEASE SAVEPOINT {0}" , name ) ;
7787 using ( DbCommand command = CreateCommand ( commandText ) )
7888 command . ExecuteNonQuery ( ) ;
@@ -84,6 +94,12 @@ protected override void ClearActiveTransaction()
8494 activeTransaction = null ;
8595 }
8696
97+ /// <inheritdoc/>
98+ protected override void ClearUnderlyingConnection ( )
99+ {
100+ underlyingConnection = null ;
101+ }
102+
87103 // Constructors
88104
89105 [ SecuritySafeCritical ]
0 commit comments