public override void Commit() { OdbcConnection connection = _connection; if (null == connection) { throw ADP.TransactionZombied(this); } connection.CheckState(ADP.CommitTransaction); // MDAC 68289 //Note: SQLEndTran success if not actually in a transaction, so we have to throw //since the IDbTransaciton spec indicates this is an error for the managed packages if (null == _handle) { throw ODBC.NotInTransaction(); } ODBC32.RetCode retcode = _handle.CompleteTransaction(ODBC32.SQL_COMMIT); if (retcode == ODBC32.RetCode.ERROR) { //If an error has occurred, we will throw an exception in HandleError, //and leave the transaction active for the user to retry connection.HandleError(_handle, retcode); } //Transaction is complete... connection.LocalTransaction = null; _connection = null; _handle = null; }
public override void Rollback() { OdbcConnection connection = this._connection; if (connection == null) { throw ADP.TransactionZombied(this); } connection.CheckState("RollbackTransaction"); if (this._handle == null) { throw ODBC.NotInTransaction(); } ODBC32.RetCode retcode = this._handle.CompleteTransaction(1); if (retcode == ODBC32.RetCode.ERROR) { connection.HandleError(this._handle, retcode); } connection.LocalTransaction = null; this._connection = null; this._handle = null; }
public override void Commit() { OdbcConnection.ExecutePermission.Demand(); OdbcConnection connection = this._connection; if (connection == null) { throw ADP.TransactionZombied(this); } connection.CheckState("CommitTransaction"); if (this._handle == null) { throw ODBC.NotInTransaction(); } ODBC32.RetCode retcode = this._handle.CompleteTransaction(0); if (retcode == ODBC32.RetCode.ERROR) { connection.HandleError(this._handle, retcode); } connection.LocalTransaction = null; this._connection = null; this._handle = null; }