def transaction
      if @in_transaction
        case @nested_transactions
        when :ignore
          return yield
        when :fail, :raise
          fail Error::TransactionError, "nested transaction"
        end
      end
      
      @in_transaction = true
      @abort          = false
      
      begin
        catch(:finish_transaction) do
          try(:tranbegin)
          yield
        end
      rescue Exception
        @abort = true
        raise
      ensure
        try("tran#{@abort ? :abort : :commit}")
        @in_transaction = false
      end
    end
def transaction
      if @in_transaction
        case @nested_transactions
        when :ignore
          return yield
        when :fail, :raise
          fail Error::TransactionError, "nested transaction"
        end
      end
      
      @in_transaction = true
      @abort          = false
      
      begin
        catch(:finish_transaction) do
          try(:tranbegin)
          yield
        end
      rescue Exception
        @abort = true
        raise
      ensure
        try("tran#{@abort ? :abort : :commit}")
        @in_transaction = false
      end
    end
Transactions