Class: DBI::Handle

Inherits:
Object
  • Object
show all
Defined in:
lib/dbi.rb

Overview

Dispatch classes (Handle, DriverHandle, DatabaseHandle and StatementHandle)

Direct Known Subclasses

DatabaseHandle, DriverHandle, StatementHandle

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(handle) ⇒ Handle

Returns a new instance of Handle.



404
405
406
407
# File 'lib/dbi.rb', line 404

def initialize(handle)
   @handle = handle
   @trace_mode = @trace_output = nil
end

Instance Attribute Details

#handleObject (readonly)

Returns the value of attribute handle.



402
403
404
# File 'lib/dbi.rb', line 402

def handle
  @handle
end

#trace_modeObject (readonly)

Returns the value of attribute trace_mode.



401
402
403
# File 'lib/dbi.rb', line 401

def trace_mode
  @trace_mode
end

#trace_outputObject (readonly)

Returns the value of attribute trace_output.



401
402
403
# File 'lib/dbi.rb', line 401

def trace_output
  @trace_output
end

Instance Method Details

#func(function, *values) ⇒ Object

call a driver specific function



418
419
420
421
422
423
424
425
426
# File 'lib/dbi.rb', line 418

def func(function, *values)
   if @handle.respond_to?("__" + function.to_s) then
      @handle.send("__" + function.to_s, *values)  
   else
      raise InterfaceError, "Driver specific function <#{function}> not available."
   end
rescue ArgumentError
   raise InterfaceError, "Wrong # of arguments for driver specific function"
end

#trace(mode = nil, output = nil) ⇒ Object



409
410
411
412
# File 'lib/dbi.rb', line 409

def trace(mode=nil, output=nil)
   @trace_mode   = mode   || @trace_mode   || DBI::DEFAULT_TRACE_MODE
   @trace_output = output || @trace_output || DBI::DEFAULT_TRACE_OUTPUT
end