导航

// System.Data.SqlClient.SqlTransaction
public override void Rollback()
{
    if (this.IsYukonPartialZombie)
    {
        if (Bid.AdvancedOn)
        {
            Bid.Trace("<sc.SqlTransaction.Rollback|ADV> %d# partial zombie no rollback required\n"this.ObjectID);
        }
        this._internalTransaction = null;
        return;
    }
    this.ZombieCheck();
    SqlStatistics statistics = null;
    IntPtr intPtr;
    Bid.ScopeEnter(out intPtr, "<sc.SqlTransaction.Rollback|API> %d#"this.ObjectID);
    SNIHandle target = null;
    RuntimeHelpers.PrepareConstrainedRegions();
    try
    {
        target = SqlInternalConnection.GetBestEffortCleanupTarget(this._connection);
        statistics = SqlStatistics.StartTimer(this.Statistics);
        this._isFromAPI = true;
        this._internalTransaction.Rollback();
    }
    catch (OutOfMemoryException e)
    {
        this._connection.Abort(e);
        throw;
    }
    catch (StackOverflowException e2)
    {
        this._connection.Abort(e2);
        throw;
    }
    catch (ThreadAbortException e3)
    {
        this._connection.Abort(e3);
        SqlInternalConnection.BestEffortCleanup(target);
        throw;
    }
    finally
    {
        this._isFromAPI = false;
        SqlStatistics.StopTimer(statistics);
        Bid.ScopeLeave(ref intPtr);
    }
}

// System.Data.SqlClient.SqlInternalTransaction
internal void Rollback()
{
    IntPtr intPtr;
    Bid.ScopeEnter(out intPtr, "<sc.SqlInternalTransaction.Rollback|API> %d#"this.ObjectID);
    if (this._innerConnection.IsLockedForBulkCopy)
    {
        throw SQL.ConnectionLockedForBcpEvent();
    }
    this._innerConnection.ValidateConnectionForExecute(null);
    try
    {
        this._innerConnection.ExecuteTransaction(SqlInternalConnection.TransactionRequest.IfRollback, null, IsolationLevel.Unspecified, nullfalse);
        this.Zombie();
    }
    catch (Exception e)
    {
        if (!ADP.IsCatchableExceptionType(e))
        {
            throw;
        }
        this.CheckTransactionLevelAndZombie();
        if (!this._disposing)
        {
            throw;
        }
    }
    finally
    {
        Bid.ScopeLeave(ref intPtr);
    }
}

// System.Data.SqlClient.SqlInternalConnectionTds
internal override void ExecuteTransaction(SqlInternalConnection.TransactionRequest transactionRequest, string name, IsolationLevel iso, SqlInternalTransaction internalTransaction, bool isDelegateControlRequest)
{
    if (base.IsConnectionDoomed)
    {
        if (transactionRequest == SqlInternalConnection.TransactionRequest.Rollback || transactionRequest == SqlInternalConnection.TransactionRequest.IfRollback)
        {
            return;
        }
        throw SQL.ConnectionDoomed();
    }
    else
    {
        if ((transactionRequest == SqlInternalConnection.TransactionRequest.Commit || transactionRequest == SqlInternalConnection.TransactionRequest.Rollback || transactionRequest == SqlInternalConnection.TransactionRequest.IfRollback) && !this.Parser.MARSOn && this.Parser._physicalStateObj.BcpLock)
        {
            throw SQL.ConnectionLockedForBcpEvent();
        }
        string transactionName = (name == null) ? string.Empty : name;
        if (!this._parser.IsYukonOrNewer)
        {
            this.ExecuteTransactionPreYukon(transactionRequest, transactionName, iso, internalTransaction);
            return;
        }
        this.ExecuteTransactionYukon(transactionRequest, transactionName, iso, internalTransaction, isDelegateControlRequest);
        return;
    }
}