Class: ODPI::Pool

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

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Pool

Returns a new instance of Pool.


35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/odpi/pool.rb', line 35

def initialize(*args)
  params = (args.last.is_a? Hash) ? args.pop : {}
  case args.length
  when 0
    username = params[:username]
    password = params[:password]
    database = params[:database]
  when 1
    username, password, database = ODPI.parse_connect_string(args[0])
  else
    username, password, database = args
  end
  @pool = Dpi::Pool.new(username, password, database, params)
end

Instance Method Details

#closeObject


65
66
67
# File 'lib/odpi/pool.rb', line 65

def close
  @pool.close(nil)
end

#connection(*args) ⇒ Object


50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/odpi/pool.rb', line 50

def connection(*args)
  params = (args.last.is_a? Hash) ? args.pop : {}
  case args.length
  when 0
    username = params[:username]
    password = params[:password]
    auth_mode = params[:auth_mode]
  when 1
    username, password, _, auth_mode = ODPI.parse_connect_string(args[0])
  else
    username, password, auth_mode = args
  end
  Connection.new(@pool.connection(username, password, auth_mode, params), false)
end