Class: OCI8::BindArgumentHelper
Overview
:nodoc:
Instance Attribute Summary collapse
-
#arg_str ⇒ Object
readonly
Returns the value of attribute arg_str.
Instance Method Summary collapse
- #exec(con, csr) ⇒ Object
-
#initialize(*args) ⇒ BindArgumentHelper
constructor
A new instance of BindArgumentHelper.
Constructor Details
#initialize(*args) ⇒ BindArgumentHelper
Returns a new instance of BindArgumentHelper.
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/oci8/object.rb', line 64 def initialize(*args) if args.length == 1 and args[0].is_a? Hash @arg_str = args[0].keys.collect do |key| "#{key}=>:#{key}"; end.join(', ') @bind_vars = args[0] else ary = [] @bind_vars = {} args.each_with_index do |obj, idx| key = ':' + (idx + 1).to_s ary << key @bind_vars[key] = obj end @arg_str = ary.join(', ') end end |
Instance Attribute Details
#arg_str ⇒ Object (readonly)
Returns the value of attribute arg_str.
63 64 65 |
# File 'lib/oci8/object.rb', line 63 def arg_str @arg_str end |
Instance Method Details
#exec(con, csr) ⇒ Object
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/oci8/object.rb', line 80 def exec(con, csr) @bind_vars.each do |key, val| if val.is_a? OCI8::Object::Base tdo = con.get_tdo_by_class(val.class) csr.bind_param(key, nil, :named_type_internal, tdo) csr[key].attributes = val else csr.bind_param(key, val ? val : '') end end csr.exec @bind_vars.each do |key, val| if val.is_a? OCI8::Object::Base val.instance_variable_set(:@attributes, csr[key].attributes) end end end |