class Infrataster::Contexts::OracledbQueryContext
Public Instance Methods
results()
click to toggle source
# File lib/infrataster/contexts/oracledb_query_context.rb, line 9 def results options = { port: 1521, user: '', password: '', service_name: '' } if server.options[:oracledb] options = options.merge(server.options[:oracledb]) end server.forward_port(options[:port]) do |address, new_port| if options.has_key?(:privilege) then conn = OCI8.new( options[:user], options[:password], "//#{address}:#{new_port}/#{options[:service_name]}", options[:privilege] ) else conn = OCI8.new( options[:user], options[:password], "//#{address}:#{new_port}/#{options[:service_name]}" ) end cursor = conn.parse(resource.query) cursor.exec() rows = [] while r = cursor.fetch_hash() rows.push(r) end cursor.close conn.logoff rows end end