[ruby-oci8-devel] About XML DB support in Ruby-OCI8

KUBO Takehiro kubo at jiubao.org
Thu Mar 27 06:28:19 EDT 2008


Hi Liming,

On Wed, Mar 26, 2008 at 12:16 PM, Liming Lian <liming.lian at oracle.com> wrote:

>  I am only familiar with passing Hash parameter to make_bind_object.
>  Meantime, I notice method make_bind_object also accepts param of
>  OCI8::Metadata::Base type.  I am wondering how to construct such
>  OCI8::Metadata::Base object so that we can bind or define XMLType in a
>  manner other than the one I have tried.  Any hints? Code sample is
>  appreciated!

OCI8::Metadata::Base is passed only when a column is not defined explicitly.
Its actual type is OCI8::Metadata::Column which is declared in
lib/oci8/metadata.rb.

File: lib/oci8/oci8.rb
    def exec(*bindvars)
      bind_params(*bindvars)
      __execute(nil)
      case type
      when :select_stmt
        define_columns()
      ....
    end

    # I would refactor this code....
    def define_columns
      num_cols = __param_count
      1.upto(num_cols) do |i|
        parm = __paramGet(i) # => parm is a OCI8::Metadata::Column.
        define_a_column(i, parm) unless __defiend?(i) # If the column
is not explicitly defined, define it.
        @column_metadata[i - 1] = parm
      end
      num_cols
    end # define_columns


More information about the ruby-oci8-devel mailing list