Class: JDBCHelper::ProcedureWrapper

Inherits:
ObjectWrapper show all
Defined in:
lib/jdbc-helper/wrapper/procedure_wrapper.rb

Overview

conn.function(:coalesce).call(nil, nil, ‘king’)

Instance Attribute Summary

Attributes inherited from ObjectWrapper

#connection, #name

Instance Method Summary collapse

Methods inherited from ObjectWrapper

#initialize

Constructor Details

This class inherits a constructor from JDBCHelper::ObjectWrapper

Instance Method Details

#call(*args) ⇒ Hash

Executes the procedure and returns the values of INOUT & OUT parameters in Hash

Returns:

  • (Hash)


16
17
18
19
20
21
22
23
24
25
# File 'lib/jdbc-helper/wrapper/procedure_wrapper.rb', line 16

def call(*args)
	param_count = args.first.kind_of?(Hash) ? args.first.keys.length : args.length

	cstmt = @connection.prepare_call "{call #{name}(#{Array.new(param_count){'?'}.join ', '})}"
	begin
		cstmt.call *args
	ensure
		cstmt.close
	end
end