private int RollbackInternal(bool exceptionHandling) { int hr = 0; if (null != this.localTransaction) { Marshal.Release(this.iunknown); this.iunknown = IntPtr.Zero; // there is no recovery if Rollback throws an exception UnsafeNativeMethods.ITransactionLocal local = this.localTransaction; this.localTransaction = null; if (null != this.weakTransaction) { OleDbTransaction transaction = (OleDbTransaction)this.weakTransaction.Target; if ((null != transaction) && this.weakTransaction.IsAlive) { hr = transaction.RollbackInternal(exceptionHandling); GC.KeepAlive(transaction); GC.SuppressFinalize(transaction); if (hr < 0) { SafeNativeMethods.ClearErrorInfo(); return(hr); } } this.weakTransaction = null; } #if DEBUG if (AdapterSwitches.OleDbTrace.TraceInfo) { ODB.Trace_Begin("ITransactionLocal", "Abort"); } #endif hr = local.Abort(0, 0, 0); #if DEBUG if (AdapterSwitches.OleDbTrace.TraceInfo) { ODB.Trace_End("ITransactionLocal", "Abort", hr); } #endif if (hr < 0) { if (exceptionHandling) { ProcessResults(hr); } else { SafeNativeMethods.ClearErrorInfo(); } } } return(hr); }
/*protected virtual*/ internal OleDbHResult RollbackInternal(bool exceptionHandling) { OleDbHResult hr = 0; if (null != _transaction) { if (null != _nestedTransaction) { OleDbTransaction transaction = (OleDbTransaction)_nestedTransaction.Target; if ((null != transaction) && _nestedTransaction.IsAlive) { hr = transaction.RollbackInternal(exceptionHandling); if (exceptionHandling && (hr < 0)) { SafeNativeMethods.Wrapper.ClearErrorInfo(); return(hr); } } _nestedTransaction = null; } hr = _transaction.Abort(); _transaction.Dispose(); _transaction = null; if (hr < 0) { if (exceptionHandling) { ProcessResults(hr); } else { SafeNativeMethods.Wrapper.ClearErrorInfo(); } } } return(hr); }
internal OleDbHResult RollbackInternal(bool exceptionHandling) { OleDbHResult hr = OleDbHResult.S_OK; if (this._transaction != null) { if (this._nestedTransaction != null) { OleDbTransaction target = (OleDbTransaction)this._nestedTransaction.Target; if ((target != null) && this._nestedTransaction.IsAlive) { hr = target.RollbackInternal(exceptionHandling); if (exceptionHandling && (hr < OleDbHResult.S_OK)) { SafeNativeMethods.Wrapper.ClearErrorInfo(); return(hr); } } this._nestedTransaction = null; } hr = this._transaction.Abort(); this._transaction.Dispose(); this._transaction = null; if (hr >= OleDbHResult.S_OK) { return(hr); } if (exceptionHandling) { this.ProcessResults(hr); return(hr); } SafeNativeMethods.Wrapper.ClearErrorInfo(); } return(hr); }