Exemplo n.º 1
0
        private void CommitInternal()
        {
            if (null == _transaction)
            {
                return;
            }
            if (null != _nestedTransaction)
            {
                OleDbTransaction transaction = (OleDbTransaction)_nestedTransaction.Target;
                if ((null != transaction) && _nestedTransaction.IsAlive)
                {
                    transaction.CommitInternal();
                }
                _nestedTransaction = null;
            }
            OleDbHResult hr = _transaction.Commit();

            if (!_transaction.MustComplete)
            {
                _transaction.Dispose();
                _transaction = null;

                DisposeManaged();
            }
            if (hr < 0)
            {
                // if an exception is thrown, user can try to commit their transaction again
                ProcessResults(hr);
            }
        }
Exemplo n.º 2
0
 private void CommitInternal()
 {
     if (this._transaction != null)
     {
         if (this._nestedTransaction != null)
         {
             OleDbTransaction target = (OleDbTransaction)this._nestedTransaction.Target;
             if ((target != null) && this._nestedTransaction.IsAlive)
             {
                 target.CommitInternal();
             }
             this._nestedTransaction = null;
         }
         OleDbHResult hr = this._transaction.Commit();
         if (!this._transaction.MustComplete)
         {
             this._transaction.Dispose();
             this._transaction = null;
             this.DisposeManaged();
         }
         if (hr < OleDbHResult.S_OK)
         {
             this.ProcessResults(hr);
         }
     }
 }
Exemplo n.º 3
0
        private void CommitInternal()
        {
            if (null == this.localTransaction)
            {
                return;
            }
            if (null != this.weakTransaction)
            {
                OleDbTransaction transaction = (OleDbTransaction)this.weakTransaction.Target;
                if ((null != transaction) && this.weakTransaction.IsAlive)
                {
                    transaction.CommitInternal();
                }
                this.weakTransaction = null;
            }
#if DEBUG
            if (AdapterSwitches.OleDbTrace.TraceInfo)
            {
                ODB.Trace_Begin("ITransactionLocal", "Commit");
            }
#endif
            int hr;
            hr = this.localTransaction.Commit(0, /*OleDbTransactionControl.SynchronousPhaseTwo*/ 2, 0);

#if DEBUG
            if (AdapterSwitches.OleDbTrace.TraceInfo)
            {
                ODB.Trace_End("ITransactionLocal", "Commit", hr);
            }
#endif
            if (hr < 0)
            {
                if (ODB.XACT_E_NOTRANSACTION == hr)
                {
                    Marshal.Release(this.iunknown);
                    this.iunknown = IntPtr.Zero;

                    this.localTransaction = null;
                    DisposeManaged();
                }
                ProcessResults(hr);
            }

            if (IntPtr.Zero != this.iunknown)
            {
                Marshal.Release(this.iunknown);
                this.iunknown = IntPtr.Zero;
            }

            // if an exception is thrown, user can try to commit their transaction again
            this.localTransaction = null;
            DisposeManaged();
            GC.KeepAlive(this);
            GC.SuppressFinalize(this);
        }