### Home Classes Methods

### In Files

- lib/dbi/trace.rb

### Parent

AspectR::Aspect

### Methods

- ::new
- #post
- #pre

### Files

- README

### Class/Module Index

Quicksearch

- DBI
- DBI::BaseDatabase
- DBI::BaseDriver
- DBI::BaseStatement
- DBI::Binary
- DBI::ColumnInfo
- DBI::DataError
- DBI::DatabaseError
- DBI::DatabaseHandle
- DBI::Date
- DBI::DriverHandle
- DBI::Error
- DBI::Handle
- DBI::HandleTracer
- DBI::IntegrityError
- DBI::InterfaceError
- DBI::InternalError
- DBI::NotImplementedError
- DBI::NotSupportedError
- DBI::OperationalError
- DBI::ProgrammingError
- DBI::Row
- DBI::SQL
- DBI::SQL::PreparedStatement
- DBI::StatementHandle
- DBI::Time
- DBI::Timestamp
- DBI::Type
- DBI::Type::Boolean
- DBI::Type::Decimal
- DBI::Type::Float
- DBI::Type::Integer
- DBI::Type::Null
- DBI::Type::Timestamp
- DBI::Type::Varchar
- DBI::TypeUtil
- DBI::Utils
- DBI::Utils::ConvParam
- DBI::Utils::TableFormatter
- DBI::Utils::XMLFormatter
- DBI::Warning
- Class

No matching classes.

# DBI::HandleTracer

### Public Class Methods

new(klass) click to toggle source

    # File lib/dbi/trace.rb, line 31
    def initialize(klass)
      @never_wrap = /^__|^send$|^id$|^class$|^$ /
      self.wrap(klass, :pre, :post, methods(klass))
    end

### Public Instance Methods

post(method, object, exitstatus, *args) click to toggle source

    # File lib/dbi/trace.rb, line 49
    def post(method, object, exitstatus, *args)

      case object.trace_mode
      when 1, 2 # return values and errors
        arrow = object.trace_mode == 1 ? "<=" : "<-"
        if exitstatus.kind_of? Array
          object.trace_output << "#{arrow} #{method} for #{object} = #{exitstatus[0] || 'nil'}\n"
        else
          if exitstatus == true
            object.trace_output << "!! #{$!.message.chomp}\n"
          end
          object.trace_output << "#{arrow} #{method} for #{object}\n"
        end

      when 3
        if exitstatus.kind_of? Array
          object.trace_output << "<- #{method} for #{object.inspect} = #{exitstatus[0].inspect}\n"
        else
          if exitstatus == true
            object.trace_output << "!! #{$!.inspect}\n"
          end
          object.trace_output << "<- #{method} for #{object.inspect}\n"
        end
      end

    end

pre(method, object, exitstatus, *args) click to toggle source

trace methods --------------------------------------------------------------

    # File lib/dbi/trace.rb, line 38
    def pre(method, object, exitstatus, *args)

      par = args.collect{|a| a.inspect}.join(", ")

      if object.trace_mode == 2 then
        object.trace_output << "-> #{method} for #{object} (#{par})\n"
      elsif object.trace_mode == 3 then
        object.trace_output << "-> #{method} for #{object.inspect} (#{par})\n"
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.