class Oraora::OCI

Wrapper around OCI8 to add some extra stuff

Public Class Methods

new(*args) click to toggle source

Wrapped in a separate thread as OCI8 seems to ignore interrupts

Calls superclass method
# File lib/oraora/oci.rb, line 5
def initialize(*args)
  ret = nil
  thread = Thread.new { ret = super }
  thread.join
  ret
end

Public Instance Methods

exec(sql, *bindvars, &block) click to toggle source

Wrapped in a separate thread with Interrupt handling

Calls superclass method
# File lib/oraora/oci.rb, line 21
def exec(sql, *bindvars, &block)
  ret = nil
  thread = Thread.new { ret = super }
  thread.join
  ret
rescue Interrupt
  self.break
  raise
end
logoff() click to toggle source

Wrapped in a separate thread as OCI8 seems to ignore interrupts

Calls superclass method
# File lib/oraora/oci.rb, line 13
def logoff
  ret = nil
  thread = Thread.new { ret = super }
  thread.join
  ret
end
pluck(sql, *bindvars) click to toggle source

Returns the query result as an array of arrays

# File lib/oraora/oci.rb, line 43
def pluck(sql, *bindvars)
  result = []
  exec(sql, *bindvars) { |row| result << row }
  result
end
pluck_one(sql, *bindvars) click to toggle source

Returns first column of a query as an array

# File lib/oraora/oci.rb, line 50
def pluck_one(sql, *bindvars)
  result = []
  exec(sql, *bindvars) { |row| result << row.first }
  result
end
select_one(sql, *bindvars) click to toggle source

Wrapped in a separate thread with Interrupt handling

Calls superclass method
# File lib/oraora/oci.rb, line 32
def select_one(sql, *bindvars)
  ret = nil
  thread = Thread.new { ret = super }
  thread.join
  ret
rescue Interrupt
  self.break
  raise
end