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

Liming Lian liming.lian at oracle.com
Thu Mar 20 02:19:53 EDT 2008


Hi Kubo,

Thanks for sharing. As you said, the XML DB implementation depends on 
object types support. This raised my interest on how object types are 
supported in Ruby-OCI8. By hacking the code, I am still not sure how to 
use this feature and whether it has been fully implemented. It will be 
appreciated if  you could show me some Ruby code samples on how to 
manipulate Object types in database supposing that this feature is 
available.

Thanks in advance!

Liming
> Hi Liming,
>
> On Wed, Mar 12, 2008 at 12:25 PM, Liming Lian <liming.lian at oracle.com> wrote:
>   
>> Hi Kubo,
>>
>> I am looking into XML DB support in Ruby-OCI8. It is apparent the
>> existed code in xmldb.c only implements part of this functionality. And
>> it is quite standalone and focuses only on how to construct REXML
>> objects from XML data. The missing parts are: defining new data type of
>> XMLType for binding, operating XML data in database and some other
>> functions related to OCI operations.
>>     
>
> Yes. I had implemented oci8_make_rexml() to construct REXML objects
> from XML data in Oracle type attributes. It was called from tdo.c,
> which was deleted about one year ago. When I reconstructed Oracle
> object type support, I didn't add code for XML type. That's because
> I thought I would add it after XML type binding was finished.
> But it have been postponed.
>
>   
>> Another issue I concern is that, the XML DB support depends on XMLDB
>> development toolkit(XDK). We have to check the host environment to
>> determine if the XDK is available in the configuration phase.  To check
>> prerequisite of XDK installation, I think we have to change the
>> ext/oci8/extconf.rb or ext/oci8/oraconf.rb a little bit to generate
>> proper Makefile for compiling oci8lib.
>>     
>
> As for oci8_make_rexml(), it doesn't need XMLDB headers. Required
> function prototypes are copied to xmldb.c.
>
>   
>> Before taking further step into improving XML DB support in OCI8, I
>> would like to know your thoughts  including how did you previously plan
>> to design xmldb.c, what's the difficulties you have ever met, and does
>> this module depends on any other parts in Ruby-OCI8. I believe those
>> information is a great of importance to me.
>>     
>
> * How did you previously plan to design xmldb.c.
>
> previous plan:
>   xmldb.c
>    - conversion between REXML objects and XML data
>
>   tdo.c
>    - binding XML data
>    - get/set XML data in object type attributes
>
> * Does this module depends on any other parts in Ruby-OCI8.
>
> current plan:
>   xmldb.c
>    - conversion between REXML objects and XML data
>    - binding XML data
>
>   object.c
>    - get/set XML data in object type attributes
>
> Almost XML type support are implemented in xmldb.c.
>  - bind class (OCI8::BindType::REXML?)
>  - conversion between XML data and REXML objects
>
> The number of non-static C functions in xmldb.c is only three.
>   void Init_oci_xmldb(void);
>   VALUE oci8_make_rexml(struct xmlctx *xctx, xmlnode *node);
>     construct REXML objects from XML data.
>   void oci8_set_rexml(struct xmlctx *xctx, xmlnode *node, VALUE obj);
>     1. clear all contents of a XML datum
>     2. set REXML object's contents to the XML datum.
>
> object.c uses oci8_make_rexml and oci8_set_rexml to get and set
> XML type attributes in Oracle object types.
>
> * What's the difficulties you have ever met.
>
> 1. whitespaces
>
> Whitespaces in XML text may or may not be reserved when converting
> to DOM objects. I have forgot the details.
>
> 2. encoding
>
> REXML's encoding must be UTF-8. But XML type's encoding depends on
> NLS_LANG.
> _______________________________________________
> ruby-oci8-devel mailing list
> ruby-oci8-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/ruby-oci8-devel
>   



More information about the ruby-oci8-devel mailing list