Author: gert
Date: 2007-10-19 13:12:55 -0400 (Fri, 19 Oct 2007)
New Revision: 87836
Modified:
trunk/mcs/class/System.Data/System.Data.Odbc/ChangeLog
trunk/mcs/class/System.Data/System.Data.Odbc/OdbcTransaction.cs
trunk/mcs/class/System.Data/System.Data.OleDb/ChangeLog
trunk/mcs/class/System.Data/System.Data.OleDb/OleDbTransaction.cs
trunk/mcs/class/System.Data/System.Data.SqlClient/ChangeLog
trunk/mcs/class/System.Data/System.Data.SqlClient/SqlTransaction.cs
Log:
* OdbcTransaction.cs: Clear connection in Commit and Rollback.
In IsolationLevel, throw IOE if transaction is no longer open.
* SqlTransaction.cs: Clear connection in commit. In IsolationLevel,
throw IOE if transaction is no longer open.
* OleDbTransaction.cs: Clear connection in Commit and Rollback. In
IsolationLevel and Begin overloads, throw IOE if transaction is no
longer open.
Modified: trunk/mcs/class/System.Data/System.Data.Odbc/ChangeLog
===================================================================
--- trunk/mcs/class/System.Data/System.Data.Odbc/ChangeLog 2007-10-19
16:04:39 UTC (rev 87835)
+++ trunk/mcs/class/System.Data/System.Data.Odbc/ChangeLog 2007-10-19
17:12:55 UTC (rev 87836)
@@ -1,5 +1,10 @@
2007-10-19 Gert Driesen <[EMAIL PROTECTED]>
+ * OdbcTransaction.cs: Clear connection in Commit and Rollback.
+ In IsolationLevel, throw IOE if transaction is no longer open.
+
+2007-10-19 Gert Driesen <[EMAIL PROTECTED]>
+
* OdbcTransaction.cs: Keep state of the transaction, and update it
when performing commit or rollback. In Dispose (bool), only perform
a rollback if transaction was not committed or rollback before.
Modified: trunk/mcs/class/System.Data/System.Data.Odbc/OdbcTransaction.cs
===================================================================
--- trunk/mcs/class/System.Data/System.Data.Odbc/OdbcTransaction.cs
2007-10-19 16:04:39 UTC (rev 87835)
+++ trunk/mcs/class/System.Data/System.Data.Odbc/OdbcTransaction.cs
2007-10-19 17:12:55 UTC (rev 87836)
@@ -218,6 +218,7 @@
throw new OdbcException (new OdbcError
("SQLEndTran", OdbcHandleType.Dbc, connection.hDbc));
SetAutoCommit (connection, true); // restore
default auto-commit
connection.transaction = null;
+ connection = null;
isOpen = false;
} else
throw new InvalidOperationException ();
@@ -238,6 +239,7 @@
throw new OdbcException (new OdbcError
("SQLEndTran", OdbcHandleType.Dbc, connection.hDbc));
SetAutoCommit (connection, true); // restore
default auto-commit
connection.transaction = null;
+ connection = null;
isOpen = false;
} else
throw new InvalidOperationException ();
@@ -264,6 +266,9 @@
#endif
IsolationLevel IsolationLevel {
get {
+ if (!isOpen)
+ throw
ExceptionHelper.TransactionNotUsable (GetType ());
+
if (isolationlevel ==
IsolationLevel.Unspecified)
isolationlevel = GetIsolationLevel
(Connection);
return isolationlevel;
Modified: trunk/mcs/class/System.Data/System.Data.OleDb/ChangeLog
===================================================================
--- trunk/mcs/class/System.Data/System.Data.OleDb/ChangeLog 2007-10-19
16:04:39 UTC (rev 87835)
+++ trunk/mcs/class/System.Data/System.Data.OleDb/ChangeLog 2007-10-19
17:12:55 UTC (rev 87836)
@@ -1,5 +1,11 @@
2007-10-19 Gert Driesen <[EMAIL PROTECTED]>
+ * OleDbTransaction.cs: Clear connection in Commit and Rollback. In
+ IsolationLevel and Begin overloads, throw IOE if transaction is no
+ longer open.
+
+2007-10-19 Gert Driesen <[EMAIL PROTECTED]>
+
* OleDbTransaction.cs: Keep track of whether transaction is open and
whether it's disposed. In Commit an Rollback, throw an IOE if the
transaction is no longer open. In Dispose (bool), perform a rollback
Modified: trunk/mcs/class/System.Data/System.Data.OleDb/OleDbTransaction.cs
===================================================================
--- trunk/mcs/class/System.Data/System.Data.OleDb/OleDbTransaction.cs
2007-10-19 16:04:39 UTC (rev 87835)
+++ trunk/mcs/class/System.Data/System.Data.OleDb/OleDbTransaction.cs
2007-10-19 17:12:55 UTC (rev 87836)
@@ -124,6 +124,9 @@
#endif
IsolationLevel IsolationLevel {
get {
+ if (!isOpen)
+ throw
ExceptionHelper.TransactionNotUsable (GetType ());
+
switch
(libgda.gda_transaction_get_isolation_level (gdaTransaction)) {
case GdaTransactionIsolation.ReadCommitted :
return IsolationLevel.ReadCommitted;
@@ -144,11 +147,15 @@
public OleDbTransaction Begin ()
{
+ if (!isOpen)
+ throw ExceptionHelper.TransactionNotUsable
(GetType ());
return new OleDbTransaction (connection, depth + 1);
}
public OleDbTransaction Begin (IsolationLevel isolevel)
{
+ if (!isOpen)
+ throw ExceptionHelper.TransactionNotUsable
(GetType ());
return new OleDbTransaction (connection, depth + 1,
isolevel);
}
@@ -164,6 +171,7 @@
if (!libgda.gda_connection_commit_transaction
(connection.GdaConnection,
gdaTransaction))
throw new InvalidOperationException ();
+ connection = null;
isOpen = false;
}
@@ -208,6 +216,7 @@
if (!libgda.gda_connection_rollback_transaction
(connection.GdaConnection,
gdaTransaction))
throw new InvalidOperationException ();
+ connection = null;
isOpen = false;
}
Modified: trunk/mcs/class/System.Data/System.Data.SqlClient/ChangeLog
===================================================================
--- trunk/mcs/class/System.Data/System.Data.SqlClient/ChangeLog 2007-10-19
16:04:39 UTC (rev 87835)
+++ trunk/mcs/class/System.Data/System.Data.SqlClient/ChangeLog 2007-10-19
17:12:55 UTC (rev 87836)
@@ -1,5 +1,10 @@
2007-10-19 Gert Driesen <[EMAIL PROTECTED]>
+ * SqlTransaction.cs: Clear connection in commit. In IsolationLevel,
+ throw IOE if transaction is no longer open.
+
+2007-10-19 Gert Driesen <[EMAIL PROTECTED]>
+
* SqlTransaction.cs: Avoid unnecessary initialization. Remove
isRolledBack since its essentially the same as isOpen. Use
ExceptionHelper.TransactionNotUsable instead of duplicating code.
Modified: trunk/mcs/class/System.Data/System.Data.SqlClient/SqlTransaction.cs
===================================================================
--- trunk/mcs/class/System.Data/System.Data.SqlClient/SqlTransaction.cs
2007-10-19 16:04:39 UTC (rev 87835)
+++ trunk/mcs/class/System.Data/System.Data.SqlClient/SqlTransaction.cs
2007-10-19 17:12:55 UTC (rev 87836)
@@ -81,7 +81,11 @@
override
#endif // NET_2_0
IsolationLevel IsolationLevel {
- get { return isolationLevel; }
+ get {
+ if (!isOpen)
+ throw
ExceptionHelper.TransactionNotUsable (GetType ());
+ return isolationLevel;
+ }
}
IDbConnection IDbTransaction.Connection {
@@ -103,6 +107,7 @@
connection.Tds.Execute ("COMMIT TRANSACTION");
connection.Transaction = null;
+ connection = null;
isOpen = false;
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches