class PLSQL::Type

Public Instance Methods

attribute_names() click to toggle source

list of object type attribute names

# File lib/plsql/type.rb, line 90
def attribute_names
  @attribute_names ||= @attributes.keys.sort_by{|k| @attributes[k][:position]}
end
collection?() click to toggle source

is type collection?

# File lib/plsql/type.rb, line 85
def collection?
  @is_collection ||= @typecode == 'COLLECTION'
end
new(*args, &block) click to toggle source

create new PL/SQL object instance

# File lib/plsql/type.rb, line 95
def new(*args, &block)
  procedure = find_procedure(:new)
  # in case of collections pass array of elements as one argument for constructor
  if collection? && !(args.size == 1 && args[0].is_a?(Array))
    args = [args]
  end
  result = procedure.exec_with_options(args, {:skip_self => true}, &block)
  # TODO: collection constructor should return Array of ObhjectInstance objects
  if collection?
    result
  else
    # TODO: what to do if block is passed to constructor?
    ObjectInstance.create(self, result)
  end
end