Class: DBI::Handle
- Inherits:
-
Object
- Object
- DBI::Handle
- Defined in:
- lib/dbi/handles.rb
Overview
Base class for all handles.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#convert_types ⇒ Object
Returns the value of attribute convert_types.
-
#handle ⇒ Object
readonly
Returns the value of attribute handle.
-
#trace_mode ⇒ Object
readonly
Returns the value of attribute trace_mode.
-
#trace_output ⇒ Object
readonly
Returns the value of attribute trace_output.
Instance Method Summary collapse
-
#func(function, *values) ⇒ Object
Leverage a driver-specific method.
-
#initialize(handle, convert_types = true) ⇒ Handle
constructor
A new instance of Handle.
-
#trace(mode = nil, output = nil) ⇒ Object
Please seee DBI.trace.
Constructor Details
#initialize(handle, convert_types = true) ⇒ Handle
Returns a new instance of Handle.
14 15 16 17 18 |
# File 'lib/dbi/handles.rb', line 14 def initialize(handle, convert_types=true) @handle = handle @trace_mode = @trace_output = nil @convert_types = convert_types end |
Instance Attribute Details
#convert_types ⇒ Object
Returns the value of attribute convert_types.
12 13 14 |
# File 'lib/dbi/handles.rb', line 12 def convert_types @convert_types end |
#handle ⇒ Object (readonly)
Returns the value of attribute handle.
11 12 13 |
# File 'lib/dbi/handles.rb', line 11 def handle @handle end |
#trace_mode ⇒ Object (readonly)
Returns the value of attribute trace_mode.
10 11 12 |
# File 'lib/dbi/handles.rb', line 10 def trace_mode @trace_mode end |
#trace_output ⇒ Object (readonly)
Returns the value of attribute trace_output.
10 11 12 |
# File 'lib/dbi/handles.rb', line 10 def trace_output @trace_output end |
Instance Method Details
#func(function, *values) ⇒ Object
Leverage a driver-specific method. The method name will have “__” prepended to them before calling, and the DBD must define them as such for them to work.
33 34 35 36 37 38 39 40 41 |
# File 'lib/dbi/handles.rb', line 33 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
Please seee DBI.trace.
21 22 23 24 25 26 |
# File 'lib/dbi/handles.rb', line 21 def trace(mode=nil, output=nil) # FIXME trace raise InterfaceError, "the trace module has been removed until it actually works." @trace_mode = mode || @trace_mode || DBI::DEFAULT_TRACE_MODE @trace_output = output || @trace_output || DBI::DEFAULT_TRACE_OUTPUT end |