Class: JDBCHelper::FunctionWrapper

Inherits:
ObjectWrapper show all
Defined in:
lib/jdbc-helper/wrapper/function_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) ⇒ Object

Returns the result of the function call with the given parameters



15
16
17
18
19
20
21
22
# File 'lib/jdbc-helper/wrapper/function_wrapper.rb', line 15

def call(*args)
	pstmt = @connection.prepare("select #{name}(#{args.map{'?'}.join ','}) from dual")
	begin
		pstmt.query(*args)[0][0]
	ensure
		pstmt.close
	end
end