[ruby-oci8-commit] [445] trunk/ruby-oci8: delete unused and unworkable features: dynamic fetch and xmldb.

nobody at rubyforge.org nobody at rubyforge.org
Sat Aug 27 04:51:45 EDT 2011


Revision: 445
Author:   kubo
Date:     2011-08-27 04:51:45 -0400 (Sat, 27 Aug 2011)

Log Message:
-----------
delete unused and unworkable features: dynamic fetch and xmldb.

Modified Paths:
--------------
    trunk/ruby-oci8/ChangeLog
    trunk/ruby-oci8/ext/oci8/bind.c
    trunk/ruby-oci8/ext/oci8/extconf.rb
    trunk/ruby-oci8/ext/oci8/lob.c
    trunk/ruby-oci8/ext/oci8/object.c
    trunk/ruby-oci8/ext/oci8/oci8.h
    trunk/ruby-oci8/ext/oci8/oci8lib.c
    trunk/ruby-oci8/ext/oci8/ocidatetime.c
    trunk/ruby-oci8/ext/oci8/ocinumber.c
    trunk/ruby-oci8/ext/oci8/oradate.c
    trunk/ruby-oci8/ext/oci8/stmt.c

Removed Paths:
-------------
    trunk/ruby-oci8/ext/oci8/xmldb.c

Modified: trunk/ruby-oci8/ChangeLog
===================================================================
--- trunk/ruby-oci8/ChangeLog	2011-08-27 08:13:28 UTC (rev 444)
+++ trunk/ruby-oci8/ChangeLog	2011-08-27 08:51:45 UTC (rev 445)
@@ -1,4 +1,11 @@
 2011-08-27  KUBO Takehiro  <kubo at jiubao.org>
+	*  ext/oci8/bind.c, ext/oci8/extconf.rb, ext/oci8/lob.c, ext/oci8/object.c,
+	   ext/oci8/oci8.h, ext/oci8/oci8lib.c, ext/oci8/ocidatetime.c,
+	   ext/oci8/ocinumber.c, ext/oci8/oradate.c, ext/oci8/stmt.c,
+	   ext/oci8/xmldb.c: delete unused and unworkable features: dynamic fetch
+	      and xmldb.
+
+2011-08-27  KUBO Takehiro  <kubo at jiubao.org>
 	* ext/oci8/bind.c, lib/oci8/bindtype.rb, lib/oci8/properties.rb: add
 	    OCI8.properties[:length_semantics].
 

Modified: trunk/ruby-oci8/ext/oci8/bind.c
===================================================================
--- trunk/ruby-oci8/ext/oci8/bind.c	2011-08-27 08:13:28 UTC (rev 444)
+++ trunk/ruby-oci8/ext/oci8/bind.c	2011-08-27 08:51:45 UTC (rev 445)
@@ -113,8 +113,6 @@
     bind_string_init,
     NULL,
     NULL,
-    NULL,
-    NULL,
     SQLT_LVC,
     bind_string_post_bind_hook,
 };
@@ -152,155 +150,10 @@
     bind_string_init,
     NULL,
     NULL,
-    NULL,
-    NULL,
     SQLT_LVB
 };
 
-#ifdef USE_DYNAMIC_FETCH /* don't use DYNAMIC_FETCH. It doesn't work well... */
 /*
- * bind_long
- */
-typedef struct {
-    VALUE obj;
-    ub4 alen;
-    char buf[1];
-} bind_long_t;
-#define bind_long_offset ((size_t)((bind_long_t*)0)->buf)
-
-static void bind_long_mark(oci8_base_t *base)
-{
-    oci8_bind_t *obind = (oci8_bind_t*)base;
-    ub4 idx = 0;
-
-    if (obind->valuep == NULL)
-        return;
-    do {
-        bind_long_t *bl = (bind_long_t *)((char*)obind->valuep + obind->alloc_sz * idx);
-        rb_gc_mark(bl->obj);
-    } while (++idx < obind->maxar_sz);
-}
-
-static VALUE bind_long_get(oci8_bind_t *obind, void *data, void *null_struct)
-{
-    bind_long_t *bl = (bind_long_t *)data;
-    return RTEST(bl->obj) ? rb_str_dup(bl->obj) : Qnil;
-}
-
-static void bind_long_set(oci8_bind_t *obind, void *data, void **null_structp, VALUE val)
-{
-    bind_long_t *bl = (bind_long_t *)data;
-    bl->obj = rb_str_dup(val);
-}
-
-static void bind_long_init(oci8_bind_t *obind, VALUE svc, VALUE val, VALUE length)
-{
-    sb4 sz = 0;
-
-    if (!NIL_P(length)) {
-        sz = NUM2INT(length);
-    }
-    if (sz < 4000) {
-        sz = 4000;
-    }
-    sz += bind_long_offset;
-    obind->value_sz = INT_MAX;
-    obind->alloc_sz = (sz + (sizeof(VALUE) - 1)) & ~(sizeof(VALUE) - 1);
-}
-
-static void bind_long_init_elem(oci8_bind_t *obind, VALUE svc)
-{
-    ub4 idx = 0;
-
-    do {
-        bind_long_t *bl = (bind_long_t *)((char*)obind->valuep + obind->alloc_sz * idx);
-        bl->obj = Qnil;
-    } while (++idx < obind->maxar_sz);
-}
-
-static ub1 bind_long_in(oci8_bind_t *obind, ub4 idx, ub1 piece, void **valuepp, ub4 **alenpp, void **indpp)
-{
-    bind_long_t *bl = (bind_long_t *)((char*)obind->valuep + obind->alloc_sz * idx);
-
-    *alenpp = &bl->alen;
-    *indpp = &obind->u.inds[idx];
-    if (NIL_P(bl->obj)) {
-        *valuepp = NULL;
-        bl->alen = 0;
-        obind->u.inds[idx] = -1;
-    } else {
-        StringValue(bl->obj);
-        *valuepp = RSTRING_PTR(bl->obj);
-        bl->alen = RSTRING_LEN(bl->obj);
-        obind->u.inds[idx] = 0;
-    }
-    return OCI_ONE_PIECE;
-}
-
-static void bind_long_out(oci8_bind_t *obind, ub4 idx, ub1 piece, void **valuepp, ub4 **alenpp, void **indpp)
-{
-    bind_long_t *bl = (bind_long_t *)((char*)obind->valuep + obind->alloc_sz * idx);
-
-    switch (piece) {
-    case OCI_NEXT_PIECE:
-    case OCI_LAST_PIECE:
-        if (bl->alen > 0) {
-            if (!RTEST(bl->obj)) {
-                bl->obj = rb_str_buf_new(bl->alen);
-            }
-            rb_str_buf_cat(bl->obj, bl->buf, bl->alen);
-        }
-        break;
-    default:
-        /* OCI_FIRST_PIECE is passed at the first call according to manuals.
-         * But OCI_ONE_PIECE is passed on Oracle 8 and 8i on Windows...
-         */
-        bl->obj = Qnil;
-    }
-    *valuepp = bl->buf;
-    *alenpp = &bl->alen;
-    *indpp = &obind->u.inds[idx];
-    bl->alen = obind->alloc_sz - bind_long_offset;
-    obind->u.inds[idx] = 0;
-}
-
-static const oci8_bind_class_t bind_long_class = {
-    {
-        bind_long_mark,
-        oci8_bind_free,
-        sizeof(oci8_bind_t)
-    },
-    bind_long_get,
-    bind_long_set,
-    bind_long_init,
-    bind_long_init_elem,
-    bind_long_in,
-    bind_long_out,
-    NULL,
-    SQLT_CHR
-};
-
-/*
- * bind_long_raw
- */
-static const oci8_bind_class_t bind_long_raw_class = {
-    {
-        bind_long_mark,
-        oci8_bind_free,
-        sizeof(oci8_bind_t)
-    },
-    bind_long_get,
-    bind_long_set,
-    bind_long_init,
-    bind_long_init_elem,
-    bind_long_in,
-    bind_long_out,
-    NULL,
-    SQLT_BIN
-};
-#endif /* USE_DYNAMIC_FETCH */
-
-/*
  * bind_binary_double
  */
 static VALUE bind_binary_double_get(oci8_bind_t *obind, void *data, void *null_struct)
@@ -334,8 +187,6 @@
     bind_binary_double_init,
     NULL,
     NULL,
-    NULL,
-    NULL,
     SQLT_BDOUBLE
 };
 
@@ -500,10 +351,6 @@
     /* register primitive data types. */
     oci8_define_bind_class("String", &bind_string_class);
     oci8_define_bind_class("RAW", &bind_raw_class);
-#ifdef USE_DYNAMIC_FETCH
-    oci8_define_bind_class("Long", &bind_long_class);
-    oci8_define_bind_class("LongRaw", &bind_long_raw_class);
-#endif /* USE_DYNAMIC_FETCH */
     if (oracle_client_version >= ORAVER_10_1) {
         oci8_define_bind_class("BinaryDouble", &bind_binary_double_class);
     }

Modified: trunk/ruby-oci8/ext/oci8/extconf.rb
===================================================================
--- trunk/ruby-oci8/ext/oci8/extconf.rb	2011-08-27 08:13:28 UTC (rev 444)
+++ trunk/ruby-oci8/ext/oci8/extconf.rb	2011-08-27 08:51:45 UTC (rev 445)
@@ -89,7 +89,7 @@
          "stmt.o", "bind.o", "metadata.o", "attr.o",
          "lob.o", "oradate.o",
          "ocinumber.o", "ocidatetime.o", "object.o", "apiwrap.o",
-         "encoding.o", "xmldb.o", "oranumber_util.o"]
+         "encoding.o", "oranumber_util.o"]
 
 if RUBY_PLATFORM =~ /mswin32|cygwin|mingw32|bccwin32/
   $defs << "-DUSE_WIN32_C"

Modified: trunk/ruby-oci8/ext/oci8/lob.c
===================================================================
--- trunk/ruby-oci8/ext/oci8/lob.c	2011-08-27 08:13:28 UTC (rev 444)
+++ trunk/ruby-oci8/ext/oci8/lob.c	2011-08-27 08:51:45 UTC (rev 445)
@@ -692,8 +692,6 @@
         bind_lob_init,
         bind_lob_init_elem,
         NULL,
-        NULL,
-        NULL,
         SQLT_CLOB
     },
     &cOCI8CLOB
@@ -711,8 +709,6 @@
         bind_lob_init,
         bind_lob_init_elem,
         NULL,
-        NULL,
-        NULL,
         SQLT_CLOB,
         bind_lob_post_bind_hook_for_nclob,
     },
@@ -731,8 +727,6 @@
         bind_lob_init,
         bind_lob_init_elem,
         NULL,
-        NULL,
-        NULL,
         SQLT_BLOB
     },
     &cOCI8BLOB
@@ -750,8 +744,6 @@
         bind_lob_init,
         bind_lob_init_elem,
         NULL,
-        NULL,
-        NULL,
         SQLT_BFILE
     },
     &cOCI8BFILE

Modified: trunk/ruby-oci8/ext/oci8/object.c
===================================================================
--- trunk/ruby-oci8/ext/oci8/object.c	2011-08-27 08:13:28 UTC (rev 444)
+++ trunk/ruby-oci8/ext/oci8/object.c	2011-08-27 08:51:45 UTC (rev 445)
@@ -656,8 +656,6 @@
     bind_named_type_init,
     bind_named_type_init_elem,
     NULL,
-    NULL,
-    NULL,
     SQLT_NTY,
     bind_name_type_post_bind_hook,
 };

Modified: trunk/ruby-oci8/ext/oci8/oci8.h
===================================================================
--- trunk/ruby-oci8/ext/oci8/oci8.h	2011-08-27 08:13:28 UTC (rev 444)
+++ trunk/ruby-oci8/ext/oci8/oci8.h	2011-08-27 08:51:45 UTC (rev 445)
@@ -29,9 +29,6 @@
 #ifdef __cplusplus
 }
 #endif
-#ifdef HAVE_XMLOTN_H
-#include "xmlotn.h"
-#endif
 
 #define ORAVERNUM(major, minor, update, patch, port_update) \
     (((major) << 24) | ((minor) << 20) | ((update) << 12) | ((patch) << 8) | (port_update))
@@ -259,8 +256,6 @@
     void (*set)(oci8_bind_t *obind, void *data, void **null_structp, VALUE val);
     void (*init)(oci8_bind_t *obind, VALUE svc, VALUE val, VALUE length);
     void (*init_elem)(oci8_bind_t *obind, VALUE svc);
-    ub1 (*in)(oci8_bind_t *obind, ub4 idx, ub1 piece, void **valuepp, ub4 **alenpp, void **indpp);
-    void (*out)(oci8_bind_t *obind, ub4 idx, ub1 piece, void **valuepp, ub4 **alenpp, void **indpp);
     void (*pre_fetch_hook)(oci8_bind_t *obind, VALUE svc);
     ub2 dty;
     void (*post_bind_hook)(oci8_bind_t *obind);
@@ -513,18 +508,6 @@
 /* object.c */
 void Init_oci_object(VALUE mOCI);
 
-/* xmldb.c */
-#ifndef XMLCTX_DEFINED
-#define XMLCTX_DEFINED
-struct xmlctx;
-typedef struct xmlctx xmlctx;
-#endif
-#ifndef XML_TYPES
-typedef struct xmlnode xmlnode;
-#endif
-void Init_oci_xmldb(void);
-VALUE oci8_make_rexml(struct xmlctx *xctx, xmlnode *node);
-
 /* attr.c */
 VALUE oci8_get_sb1_attr(oci8_base_t *base, ub4 attrtype);
 VALUE oci8_get_ub2_attr(oci8_base_t *base, ub4 attrtype);

Modified: trunk/ruby-oci8/ext/oci8/oci8lib.c
===================================================================
--- trunk/ruby-oci8/ext/oci8/oci8lib.c	2011-08-27 08:13:28 UTC (rev 444)
+++ trunk/ruby-oci8/ext/oci8/oci8lib.c	2011-08-27 08:51:45 UTC (rev 445)
@@ -133,7 +133,6 @@
     Init_ora_date();
     Init_oci_datetime();
     Init_oci_object(cOCI8);
-    Init_oci_xmldb();
 
 #ifdef USE_WIN32_C
     Init_oci8_win32(cOCI8);

Modified: trunk/ruby-oci8/ext/oci8/ocidatetime.c
===================================================================
--- trunk/ruby-oci8/ext/oci8/ocidatetime.c	2011-08-27 08:13:28 UTC (rev 444)
+++ trunk/ruby-oci8/ext/oci8/ocidatetime.c	2011-08-27 08:51:45 UTC (rev 445)
@@ -263,8 +263,6 @@
     bind_ocitimestamp_tz_init,
     bind_ocitimestamp_tz_init_elem,
     NULL,
-    NULL,
-    NULL,
     SQLT_TIMESTAMP_TZ
 };
 
@@ -436,8 +434,6 @@
     bind_ociinterval_ym_init,
     bind_ociinterval_ym_init_elem,
     NULL,
-    NULL,
-    NULL,
     SQLT_INTERVAL_YM
 };
 
@@ -452,8 +448,6 @@
     bind_ociinterval_ds_init,
     bind_ociinterval_ds_init_elem,
     NULL,
-    NULL,
-    NULL,
     SQLT_INTERVAL_DS
 };
 

Modified: trunk/ruby-oci8/ext/oci8/ocinumber.c
===================================================================
--- trunk/ruby-oci8/ext/oci8/ocinumber.c	2011-08-27 08:13:28 UTC (rev 444)
+++ trunk/ruby-oci8/ext/oci8/ocinumber.c	2011-08-27 08:51:45 UTC (rev 445)
@@ -321,10 +321,6 @@
         char buf[256];
         sword rv;
 
-        double dbl;
-
-        oci_lc(OCINumberToReal(errhp, s, sizeof(double), &dbl));
-
         rv = oranumber_to_str(s, buf, sizeof(buf));
         if (rv <= 0) {
             char buf[ORANUMBER_DUMP_BUF_SIZ];
@@ -1469,8 +1465,6 @@
     bind_ocinumber_init,
     bind_ocinumber_init_elem,
     NULL,
-    NULL,
-    NULL,
     SQLT_VNU,
 };
 
@@ -1485,8 +1479,6 @@
     bind_ocinumber_init,
     bind_ocinumber_init_elem,
     NULL,
-    NULL,
-    NULL,
     SQLT_VNU,
 };
 
@@ -1501,8 +1493,6 @@
     bind_ocinumber_init,
     bind_ocinumber_init_elem,
     NULL,
-    NULL,
-    NULL,
     SQLT_VNU,
 };
 

Modified: trunk/ruby-oci8/ext/oci8/oradate.c
===================================================================
--- trunk/ruby-oci8/ext/oci8/oradate.c	2011-08-27 08:13:28 UTC (rev 444)
+++ trunk/ruby-oci8/ext/oci8/oradate.c	2011-08-27 08:51:45 UTC (rev 445)
@@ -568,8 +568,6 @@
     bind_oradate_init,
     bind_oradate_init_elem,
     NULL,
-    NULL,
-    NULL,
     SQLT_DAT,
 };
 

Modified: trunk/ruby-oci8/ext/oci8/stmt.c
===================================================================
--- trunk/ruby-oci8/ext/oci8/stmt.c	2011-08-27 08:13:28 UTC (rev 444)
+++ trunk/ruby-oci8/ext/oci8/stmt.c	2011-08-27 08:51:45 UTC (rev 445)
@@ -101,7 +101,6 @@
     oci8_bind_t *obind;
     const oci8_bind_class_t *bind_class;
     sword status;
-    ub4 mode;
 
     position = NUM2INT(vposition); /* 1 */
     obind = oci8_get_bind(vbindobj); /* 2 */
@@ -109,12 +108,7 @@
         oci8_base_free(&obind->base); /* TODO: OK? */
     }
     bind_class = (const oci8_bind_class_t *)obind->base.klass;
-    if (bind_class->out == NULL) {
-        mode = OCI_DEFAULT;
-    } else {
-        mode = OCI_DYNAMIC_FETCH;
-    }
-    status = OCIDefineByPos(stmt->base.hp.stmt, &obind->base.hp.dfn, oci8_errhp, position, obind->valuep, obind->value_sz, bind_class->dty, NIL_P(obind->tdo) ? obind->u.inds : NULL, NULL, 0, mode);
+    status = OCIDefineByPos(stmt->base.hp.stmt, &obind->base.hp.dfn, oci8_errhp, position, obind->valuep, obind->value_sz, bind_class->dty, NIL_P(obind->tdo) ? obind->u.inds : NULL, NULL, 0, OCI_DEFAULT);
     if (status != OCI_SUCCESS) {
         oci8_raise(oci8_errhp, status, stmt->base.hp.ptr);
     }
@@ -151,7 +145,6 @@
     VALUE old_value;
     void *indp;
     ub4 *curelep;
-    ub4 mode;
 
     if (NIL_P(vplaceholder)) { /* 1 */
         placeholder_ptr = NULL;
@@ -175,11 +168,6 @@
         oci8_base_free(&obind->base); /* TODO: OK? */
     }
     bind_class = (const oci8_bind_class_t *)obind->base.klass;
-    if (bind_class->in != NULL || bind_class->out != NULL) {
-        mode = OCI_DATA_AT_EXEC;
-    } else {
-        mode = OCI_DEFAULT;
-    }
 
     indp = NIL_P(obind->tdo) ? obind->u.inds : NULL;
     if (obind->maxar_sz == 0) {
@@ -188,9 +176,9 @@
         curelep = &obind->curar_sz;
     }
     if (placeholder_ptr == (char*)-1) {
-        status = OCIBindByPos(stmt->base.hp.stmt, &obind->base.hp.bnd, oci8_errhp, position, obind->valuep, obind->value_sz, bind_class->dty, indp, NULL, 0, 0, 0, mode);
+        status = OCIBindByPos(stmt->base.hp.stmt, &obind->base.hp.bnd, oci8_errhp, position, obind->valuep, obind->value_sz, bind_class->dty, indp, NULL, 0, 0, 0, OCI_DEFAULT);
     } else {
-        status = OCIBindByName(stmt->base.hp.stmt, &obind->base.hp.bnd, oci8_errhp, TO_ORATEXT(placeholder_ptr), placeholder_len, obind->valuep, obind->value_sz, bind_class->dty, indp, NULL, 0, 0, 0, mode);
+        status = OCIBindByName(stmt->base.hp.stmt, &obind->base.hp.bnd, oci8_errhp, TO_ORATEXT(placeholder_ptr), placeholder_len, obind->valuep, obind->value_sz, bind_class->dty, indp, NULL, 0, 0, 0, OCI_DEFAULT);
     }
     if (status != OCI_SUCCESS) {
         oci8_raise(oci8_errhp, status, stmt->base.hp.stmt);
@@ -250,54 +238,6 @@
         mode = svcctx->is_autocommit ? OCI_COMMIT_ON_SUCCESS : OCI_DEFAULT;
     }
     rv = oci8_call_stmt_execute(svcctx, stmt, iters, mode);
-#ifdef USE_DYNAMIC_FETCH
-    while (rv == OCI_NEED_DATA) {
-        oci8_bind_t *obind;
-        const oci8_bind_class_t *bind_class;
-        /* get piece info. */
-        dvoid *hp;
-        ub4 type;
-        ub1 in_out;
-        ub4 iter;
-        ub4 idx;
-        ub1 piece;
-        /* set piece info. */
-        void *valuep;
-        ub4 *alenp;
-        void *indp;
-
-        oci_lc(OCIStmtGetPieceInfo(stmt->base.hp.ptr, oci8_errhp, &hp, &type, &in_out, &iter, &idx, &piece));
-        obind = (oci8_bind_t*)stmt->base.children;
-        do {
-            if (obind->base.hp.ptr == hp) {
-                if (type != OCI_HTYPE_BIND)
-                    rb_bug("ruby-oci8: expect OCI_HTYPE_BIND but %d", type);
-                bind_class = (const oci8_bind_class_t *)obind->base.klass;
-                switch (in_out) {
-                case OCI_PARAM_IN:
-                    if (bind_class->in == NULL)
-                        rb_bug("....");
-                    piece = bind_class->in(obind, idx, piece, &valuep, &alenp, &indp);
-                    break;
-                case OCI_PARAM_OUT:
-                    if (bind_class->out == NULL)
-                        rb_bug("....");
-                    bind_class->out(obind, idx, piece, &valuep, &alenp, &indp);
-                    break;
-                default:
-                    rb_bug("ruby-oci8: expect OCI_PARAM_IN or OCI_PARAM_OUT but %d", in_out);
-                }
-                oci_lc(OCIStmtSetPieceInfo(obind->base.hp.ptr, OCI_HTYPE_BIND, oci8_errhp, valuep, alenp, 0, indp, NULL));
-                break;
-            }
-            obind = (oci8_bind_t*)obind->base.next;
-        } while (obind != (oci8_bind_t*)stmt->base.children);
-        if (obind == (oci8_bind_t*)stmt) {
-            rb_bug("ruby-oci8: No bind handle is found.");
-        }
-        rv = oci8_call_stmt_execute(svcctx, stmt, iters, mode);
-    }
-#endif /* USE_DYNAMIC_FETCH */
     if (IS_OCI_ERROR(rv)) {
         oci8_raise(oci8_errhp, rv, stmt->base.hp.stmt);
     }
@@ -351,78 +291,12 @@
         } while (obind != (oci8_bind_t*)stmt->base.children);
     }
     rv = OCIStmtFetch_nb(svcctx, stmt->base.hp.stmt, oci8_errhp, 1, OCI_FETCH_NEXT, OCI_DEFAULT);
-#ifdef USE_DYNAMIC_FETCH
-    while (rv == OCI_NEED_DATA) {
-        /* get piece info. */
-        dvoid *hp;
-        ub4 type;
-        ub1 in_out;
-        ub4 iter;
-        ub4 idx;
-        ub1 piece;
-        /* set piece info. */
-        void *valuep;
-        ub4 *alenp;
-        void *indp;
-
-        oci_lc(OCIStmtGetPieceInfo(stmt->base.hp.ptr, oci8_errhp, &hp, &type, &in_out, &iter, &idx, &piece));
-        obind = (oci8_bind_t *)stmt->base.children;
-        do {
-            if (obind->base.hp.ptr == hp) {
-                if (type != OCI_HTYPE_DEFINE)
-                    rb_bug("ruby-oci8: expect OCI_HTYPE_DEFINE but %d", type);
-                bind_class = (const oci8_bind_class_t *)obind->base.klass;
-                switch (in_out) {
-                case OCI_PARAM_OUT:
-                    if (bind_class->out == NULL)
-                        rb_bug("....");
-                    bind_class->out(obind, idx, piece, &valuep, &alenp, &indp);
-                    break;
-                default:
-                    rb_bug("ruby-oci8: expect OCI_PARAM_OUT but %d", in_out);
-                }
-                oci_lc(OCIStmtSetPieceInfo(obind->base.hp.ptr, OCI_HTYPE_DEFINE, oci8_errhp, valuep, alenp, 0, indp, NULL));
-                break;
-            }
-            obind = (oci8_bind_t *)obind->base.next;
-        } while (obind != (oci8_bind_t*)stmt->base.children);
-        if (obind == (oci8_bind_t*)stmt) {
-            rb_bug("ruby-oci8: No define handle is found.");
-        }
-        rv = OCIStmtFetch_nb(svcctx, stmt->base.hp.stmt, oci8_errhp, 1, OCI_FETCH_NEXT, OCI_DEFAULT);
-    }
-#endif /* USE_DYNAMIC_FETCH */
     if (rv == OCI_NO_DATA) {
         return Qnil;
     }
     if (IS_OCI_ERROR(rv)) {
         oci8_raise(oci8_errhp, rv, stmt->base.hp.stmt);
     }
-#ifdef USE_DYNAMIC_FETCH
-    obind = (oci8_bind_t *)stmt->base.children;
-    do {
-        /* set piece info. */
-        void *valuep;
-        ub4 *alenp;
-        void *indp;
-        ub1 piece = OCI_LAST_PIECE;
-
-        if (obind->base.type == OCI_HTYPE_DEFINE) {
-            bind_class = (const oci8_bind_class_t *)obind->base.klass;
-            if (bind_class->out != NULL) {
-                if (obind->maxar_sz == 0) {
-                    bind_class->out(obind, 0, piece, &valuep, &alenp, &indp);
-                } else {
-                    ub4 idx;
-                    for (idx = 0; idx < obind->curar_sz; idx++) {
-                        bind_class->out(obind, idx, piece, &valuep, &alenp, &indp);
-                    }
-                }
-            }
-        }
-        obind = (oci8_bind_t *)obind->base.next;
-    } while (obind != (oci8_bind_t*)stmt->base.children);
-#endif /* USE_DYNAMIC_FETCH */
     ary = rb_ary_new2(RARRAY_LEN(stmt->defns));
     for (idx = 0; idx < RARRAY_LEN(stmt->defns); idx++) {
         rb_ary_store(ary, idx, oci8_bind_get_data(RARRAY_PTR(stmt->defns)[idx]));
@@ -746,8 +620,6 @@
     bind_stmt_set,
     bind_stmt_init,
     bind_stmt_init_elem,
-    NULL,
-    NULL,
     bind_stmt_init_elem,
     SQLT_RSET
 };

Deleted: trunk/ruby-oci8/ext/oci8/xmldb.c
===================================================================
--- trunk/ruby-oci8/ext/oci8/xmldb.c	2011-08-27 08:13:28 UTC (rev 444)
+++ trunk/ruby-oci8/ext/oci8/xmldb.c	2011-08-27 08:51:45 UTC (rev 445)
@@ -1,383 +0,0 @@
-/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
-#include "oci8.h"
-
-#if 0 /* disabled for a while. */ && (ORACLE_CLIENT_VERSION >= ORAVER_10_1 || defined RUNTIME_API_CHECK)
-
-#ifndef HAVE_XMLOTN_H
-/* declarations in xmlproc.h of Oracle XML Development Kit */
-typedef xmlnode xmlelemnode;
-typedef xmlnode xmlpinode;
-typedef xmlnode xmldocnode;
-typedef xmlnode xmldtdnode;
-typedef xmlnode xmlnotenode;
-typedef xmlnode xmlnamedmap;
-typedef xmlnode xmlattrnode;
-
-typedef enum {
-    XMLERR_OK = 0,
-} xmlerr;
-
-typedef enum {
-    XMLDOM_NONE     = 0,  /* bogus node */
-    XMLDOM_ELEM     = 1,  /* element */
-    XMLDOM_ATTR     = 2,  /* attribute */
-    XMLDOM_TEXT     = 3,  /* char data not escaped by CDATA */
-    XMLDOM_CDATA    = 4,  /* char data escaped by CDATA */
-    XMLDOM_ENTREF   = 5,  /* entity reference */
-    XMLDOM_ENTITY   = 6,  /* entity */
-    XMLDOM_PI       = 7,  /* <?processing instructions?> */
-    XMLDOM_COMMENT  = 8,  /* <!-- Comments --> */
-    XMLDOM_DOC      = 9,  /* Document */
-    XMLDOM_DTD      = 10, /* DTD */
-    XMLDOM_FRAG     = 11, /* Document fragment */
-    XMLDOM_NOTATION = 12, /* notation */
-    XMLDOM_ELEMDECL = 13, /* DTD element declaration */
-    XMLDOM_ATTRDECL = 14, /* DTD attribute declaration */
-    XMLDOM_CPELEM   = 15, /* element */
-    XMLDOM_CPCHOICE = 16, /* choice (a|b) */
-    XMLDOM_CPSEQ    = 17, /* sequence (a,b) */
-    XMLDOM_CPPCDATA = 18, /* #PCDATA */
-    XMLDOM_CPSTAR   = 19, /* '*' (zero or more) */
-    XMLDOM_CPPLUS   = 20, /* '+' (one or more) */
-    XMLDOM_CPOPT    = 21, /* '?' (optional) */
-    XMLDOM_CPEND    = 22  /* end marker */
-} xmlnodetype;
-
-typedef struct xmldomcb {
-    void *cb[1];
-} xmldomcb;
-
-typedef struct xmlctxhead {
-    ub4           cw_xmlctxhead;        /* checkword */
-    oratext      *name_xmlctxhead;      /* name for context */
-    void         *cb_xmlctxhead;        /* top-level function callbacks */
-    xmldomcb     *domcb_xmlctxhead;     /* DOM function callbacks */
-} xmlctxhead;
-#define XML_DOMCB(xctx) ((xmlctxhead *) xctx)->domcb_xmlctxhead
-
-typedef xmlerr (*XmlDomGetDecl_t)(xmlctx *xctx, xmldocnode *doc, oratext **ver, oratext **enc, sb4 *std);
-#define XmlDomGetDecl(xctx, doc, ver, enc, std) \
-      ((XmlDomGetDecl_t)XML_DOMCB(xctx)->cb[0])((xctx), (doc), (ver), (enc), (std))
-
-typedef xmldtdnode* (*XmlDomGetDTD_t)(xmlctx *xctx, xmldocnode *doc);
-#define XmlDomGetDTD(xctx, doc) \
-      ((XmlDomGetDTD_t)XML_DOMCB(xctx)->cb[3])((xctx), (doc))
-
-typedef xmlnodetype (*XmlDomGetNodeType_t)(xmlctx *xctx, xmlnode *node);
-#define XmlDomGetNodeType(xctx, node) \
-      ((XmlDomGetNodeType_t)XML_DOMCB(xctx)->cb[34])((xctx), (node))
-
-typedef xmlnode* (*XmlDomGetFirstChild_t)(xmlctx *xctx, xmlnode *node);
-#define XmlDomGetFirstChild(xctx, node) \
-      ((XmlDomGetFirstChild_t)XML_DOMCB(xctx)->cb[46])((xctx), (node))
-
-typedef xmlnode* (*XmlDomGetNextSibling_t)(xmlctx *xctx, xmlnode *node);
-#define XmlDomGetNextSibling(xctx, node) \
-      ((XmlDomGetNextSibling_t)XML_DOMCB(xctx)->cb[53])((xctx), (node))
-
-typedef xmlnamedmap* (*XmlDomGetAttrs_t)(xmlctx *xctx, xmlelemnode *elem);
-#define XmlDomGetAttrs(xctx, node) \
-    ((XmlDomGetAttrs_t)XML_DOMCB(xctx)->cb[55])((xctx), (node))
-
-typedef xmlnode* (*XmlDomGetNodeMapItem_t)(xmlctx *xctx, xmlnamedmap *map, ub4 index);
-#define XmlDomGetNodeMapItem(xctx, map, index) \
-      ((XmlDomGetNodeMapItem_t)XML_DOMCB(xctx)->cb[82])((xctx), (map), (index))
-
-typedef ub4 (*XmlDomGetNodeMapLength_t)(xmlctx *xctx, xmlnamedmap *map);
-#define XmlDomGetNodeMapLength(xctx, map) \
-      ((XmlDomGetNodeMapLength_t)XML_DOMCB(xctx)->cb[83])((xctx), (map))
-
-typedef oratext* (*XmlDomGetCharData_t)(xmlctx *xctx, xmlnode *node);
-#define XmlDomGetCharData(xctx, node) \
-      ((XmlDomGetCharData_t)XML_DOMCB(xctx)->cb[90])((xctx), (node))
-
-typedef oratext* (*XmlDomGetAttrName_t)(xmlctx *xctx, xmlattrnode *attr);
-#define XmlDomGetAttrName(xctx, attr) \
-      ((XmlDomGetAttrName_t)XML_DOMCB(xctx)->cb[98])((xctx), (attr))
-
-typedef oratext* (*XmlDomGetAttrValue_t)(xmlctx *xctx, xmlattrnode *attr);
-#define XmlDomGetAttrValue(xctx, attr) \
-      ((XmlDomGetAttrValue_t)XML_DOMCB(xctx)->cb[106])((xctx), (attr))
-
-typedef oratext* (*XmlDomGetTag_t)(xmlctx *xctx, xmlelemnode *elem);
-#define XmlDomGetTag(xctx, elem) \
-      ((XmlDomGetTag_t)XML_DOMCB(xctx)->cb[112])((xctx), (elem))
-
-typedef oratext* (*XmlDomGetDTDName_t)(xmlctx *xctx, xmldtdnode *dtd);
-#define XmlDomGetDTDName(xctx, dtd) \
-      ((XmlDomGetDTDName_t)XML_DOMCB(xctx)->cb[131])((xctx), (dtd))
-
-typedef xmlnamedmap* (*XmlDomGetDTDEntities_t)(xmlctx *xctx, xmldtdnode *dtd);
-#define XmlDomGetDTDEntities(xctx, dtd) \
-      ((XmlDomGetDTDEntities_t)XML_DOMCB(xctx)->cb[132])((xctx), (dtd))
-
-typedef xmlnamedmap* (*XmlDomGetDTDNotations_t)(xmlctx *xctx, xmldtdnode *dtd);
-#define XmlDomGetDTDNotations(xctx, dtd) \
-      ((XmlDomGetDTDNotations_t)XML_DOMCB(xctx)->cb[133])((xctx), (dtd))
-
-typedef oratext* (*XmlDomGetDTDPubID_t)(xmlctx *xctx, xmldtdnode *dtd);
-#define XmlDomGetDTDPubID(xctx, dtd) \
-      ((XmlDomGetDTDPubID_t)XML_DOMCB(xctx)->cb[134])((xctx), (dtd))
-
-typedef oratext* (*XmlDomGetDTDSysID_t)(xmlctx *xctx, xmldtdnode *dtd);
-#define XmlDomGetDTDSysID(xctx, dtd) \
-      ((XmlDomGetDTDSysID_t)XML_DOMCB(xctx)->cb[135])((xctx), (dtd))
-
-typedef oratext* (*XmlDomGetPITarget_t)(xmlctx *xctx, xmlpinode *pi);
-#define XmlDomGetPITarget(xctx, pi) \
-      ((XmlDomGetPITarget_t)XML_DOMCB(xctx)->cb[143])((xctx), (pi))
-
-typedef oratext* (*XmlDomGetPIData_t)(xmlctx *xctx, xmlpinode *pi);
-#define XmlDomGetPIData(xctx, pi) \
-      ((XmlDomGetPIData_t)XML_DOMCB(xctx)->cb[144])((xctx), (pi))
-
-/* end of declarations in xmlproc.h of Oracle XML Development Kit */
-#endif /* HAVE_XMLOTN_H */
-
-static ID id_add;
-static ID id_add_attribute;
-static VALUE REXML_Element;
-static VALUE REXML_Text;
-static VALUE REXML_CData;
-static VALUE REXML_Instruction;
-static VALUE REXML_Comment;
-static VALUE REXML_Document;
-static VALUE REXML_XMLDecl;
-static VALUE REXML_DocType;
-static VALUE REXML_NotationDecl;
-
-static VALUE oci8_make_element(struct xmlctx *xctx, xmlelemnode *elem);
-static VALUE oci8_make_cdata(struct xmlctx *xctx, xmlnode *node);
-static VALUE oci8_make_text(struct xmlctx *xctx, xmlnode *node);
-static VALUE oci8_make_pi(struct xmlctx *xctx, xmlpinode *pi);
-static VALUE oci8_make_comment(struct xmlctx *xctx, xmlnode *node);
-static VALUE oci8_make_document(struct xmlctx *xctx, xmldocnode *doc);
-static VALUE oci8_make_dtd(struct xmlctx *xctx, xmldtdnode *dtd);
-
-static VALUE add_child_nodes(VALUE obj, struct xmlctx *xctx, xmlnode *node);
-static VALUE add_attributes(VALUE obj, struct xmlctx *xctx, xmlnode *node);
-static VALUE add_nodemap(VALUE obj, struct xmlctx *xctx, xmlnamedmap *map);
-
-void Init_oci_xmldb(void)
-{
-    id_add = rb_intern("add");
-    id_add_attribute = rb_intern("add_attribute");
-    rb_require("rexml/document");
-    REXML_Document = rb_eval_string("REXML::Document");
-    REXML_Element = rb_eval_string("REXML::Element");
-    REXML_Text = rb_eval_string("REXML::Text");
-    REXML_CData = rb_eval_string("REXML::CData");
-    REXML_Instruction = rb_eval_string("REXML::Instruction");
-    REXML_Comment = rb_eval_string("REXML::Comment");
-    REXML_XMLDecl = rb_eval_string("REXML::XMLDecl");
-    REXML_DocType = rb_eval_string("REXML::DocType");
-    REXML_NotationDecl = rb_eval_string("REXML::NotationDecl");
-}
-
-VALUE oci8_make_rexml(struct xmlctx *xctx, xmlnode *node)
-{
-    xmlnodetype nodetype = XmlDomGetNodeType(xctx, node);
-
-    switch (nodetype) {
-    case XMLDOM_NONE:     /*  0 */
-        rb_raise(rb_eRuntimeError, "unsupported XML node type: XMLDOM_NONE");
-    case XMLDOM_ELEM:     /*  1 */
-        return oci8_make_element(xctx, (xmlelemnode*)node);
-    case XMLDOM_ATTR:     /*  2 */
-        rb_raise(rb_eRuntimeError, "unsupported XML node type: XMLDOM_ATTR");
-    case XMLDOM_TEXT:     /*  3 */
-        return oci8_make_text(xctx, node);
-    case XMLDOM_CDATA:    /*  4 */
-        return oci8_make_cdata(xctx, node);
-    case XMLDOM_ENTREF:   /*  5 */
-        rb_raise(rb_eRuntimeError, "unsupported XML node type: XMLDOM_ENTREF");
-    case XMLDOM_ENTITY:   /*  6 */
-        rb_raise(rb_eRuntimeError, "unsupported XML node type: XMLDOM_ENTITY");
-    case XMLDOM_PI:       /*  7 */
-        return oci8_make_pi(xctx, (xmlpinode*)node);
-    case XMLDOM_COMMENT:  /*  8 */
-        return oci8_make_comment(xctx, node);
-    case XMLDOM_DOC:      /*  9 */
-        return oci8_make_document(xctx, (xmldocnode*)node);
-    case XMLDOM_DTD:      /* 10 */
-        return oci8_make_dtd(xctx, (xmldtdnode*)node);
-    case XMLDOM_FRAG:     /* 11 */
-        rb_raise(rb_eRuntimeError, "unsupported XML node type: XMLDOM_FRAG");
-    case XMLDOM_NOTATION: /* 12 */
-        rb_raise(rb_eRuntimeError, "unsupported XML node type: XMLDOM_NOTATION");
-    case XMLDOM_ELEMDECL: /* 13 */
-        rb_raise(rb_eRuntimeError, "unsupported XML node type: XMLDOM_ELEMDECL");
-    case XMLDOM_ATTRDECL: /* 14 */
-        rb_raise(rb_eRuntimeError, "unsupported XML node type: XMLDOM_ATTRDECL");
-    case XMLDOM_CPELEM:   /* 15 */
-        rb_raise(rb_eRuntimeError, "unsupported XML node type: XMLDOM_CPELEM");
-    case XMLDOM_CPCHOICE: /* 16 */
-        rb_raise(rb_eRuntimeError, "unsupported XML node type: XMLDOM_CPCHOICE");
-    case XMLDOM_CPSEQ:    /* 17 */
-        rb_raise(rb_eRuntimeError, "unsupported XML node type: XMLDOM_CPSEQ");
-    case XMLDOM_CPPCDATA: /* 18 */
-        rb_raise(rb_eRuntimeError, "unsupported XML node type: XMLDOM_CPPCDATA");
-    case XMLDOM_CPSTAR:   /* 19 */
-        rb_raise(rb_eRuntimeError, "unsupported XML node type: XMLDOM_CPSTAR");
-    case XMLDOM_CPPLUS:   /* 20 */
-        rb_raise(rb_eRuntimeError, "unsupported XML node type: XMLDOM_CPPLUS");
-    case XMLDOM_CPOPT:    /* 21 */
-        rb_raise(rb_eRuntimeError, "unsupported XML node type: XMLDOM_CPOPT");
-    case XMLDOM_CPEND:    /* 22 */
-        rb_raise(rb_eRuntimeError, "unsupported XML node type: XMLDOM_CPEND");
-    }
-    rb_raise(rb_eRuntimeError, "unsupported XML node type: %d", nodetype);
-}
-
-static VALUE oci8_make_element(struct xmlctx *xctx, xmlelemnode *elem)
-{
-    oratext *name;
-    VALUE obj;
-
-    name = XmlDomGetTag(xctx, elem);
-    obj = rb_funcall(REXML_Element, oci8_id_new, 1, rb_str_new2_ora(name));
-    add_attributes(obj, xctx, (xmlnode*)elem);
-    return add_child_nodes(obj, xctx, (xmlnode*)elem);
-}
-
-static VALUE oci8_make_text(struct xmlctx *xctx, xmlnode *node)
-{
-    oratext *data = XmlDomGetCharData(xctx, node);
-    return rb_funcall(REXML_Text, oci8_id_new, 1, rb_str_new2_ora(data));
-}
-
-static VALUE oci8_make_cdata(struct xmlctx *xctx, xmlnode *node)
-{
-    oratext *data = XmlDomGetCharData(xctx, node);
-    return rb_funcall(REXML_CData, oci8_id_new, 1, rb_str_new2_ora(data));
-}
-
-static VALUE oci8_make_pi(struct xmlctx *xctx, xmlpinode *pi)
-{
-    oratext *target;
-    oratext *data;
-
-    target= XmlDomGetPITarget(xctx, pi);
-    data = XmlDomGetPIData(xctx, pi);
-    return rb_funcall(REXML_Instruction, oci8_id_new, 2, rb_str_new2_ora(target), data ? rb_str_new2_ora(data) : Qnil);
-}
-
-static VALUE oci8_make_comment(struct xmlctx *xctx, xmlnode *node)
-{
-    oratext *data = XmlDomGetCharData(xctx, node);
-    return rb_funcall(REXML_Comment, oci8_id_new, 1, rb_str_new2_ora(data));
-}
-
-static VALUE oci8_make_document(struct xmlctx *xctx, xmldocnode *doc)
-{
-    xmlerr err;
-    oratext *ver;
-    oratext *enc;
-    sb4 std;
-#ifdef ENABLE_DTD
-    xmldtdnode* dtd;
-#endif
-    VALUE obj;
-    VALUE decl;
-
-    obj = rb_funcall(REXML_Document, oci8_id_new, 0);
-    err = XmlDomGetDecl(xctx, doc, &ver, &enc, &std);
-    if (err == XMLERR_OK) {
-        decl = rb_funcall(REXML_XMLDecl, oci8_id_new, 3,
-                          ver ? rb_str_new2_ora(ver) : Qnil,
-                          enc ? rb_str_new2_ora(enc) : Qnil,
-                          (std < 0) ? Qnil : ((std > 0) ? rb_str_new2("yes") : rb_str_new2("no")));
-        rb_funcall(obj, id_add, 1, decl);
-    }
-#ifdef ENABLE_DTD
-    dtd = XmlDomGetDTD(xctx, doc);
-    if (dtd != NULL) {
-        rb_funcall(obj, id_add, 1, oci8_make_dtd(xctx, dtd));
-    }
-#endif
-    return add_child_nodes(obj, xctx, (xmlnode*)doc);
-}
-
-static VALUE oci8_make_dtd(struct xmlctx *xctx, xmldtdnode *dtd)
-{
-    /*
-     * DTD support is not finished.
-     * I don't know how to get full dtd data from xmldtdnode.
-     */
-    oratext *name;
-    oratext *pubid;
-    oratext *sysid;
-    xmlnamedmap *entities;
-    xmlnamedmap *notations;
-    VALUE obj;
-
-    name = XmlDomGetDTDName(xctx, dtd);
-    pubid = XmlDomGetDTDPubID(xctx, dtd);
-    sysid = XmlDomGetDTDSysID(xctx, dtd);
-    entities = XmlDomGetDTDEntities(xctx, dtd);
-    notations = XmlDomGetDTDNotations(xctx, dtd);
-
-    obj = rb_funcall(REXML_DocType, oci8_id_new, 1, rb_str_new2_ora(name));
-    if (entities != NULL)
-        add_nodemap(obj, xctx, entities);
-    if (notations != NULL)
-        add_nodemap(obj, xctx, notations);
-    return obj;
-}
-
-static VALUE add_child_nodes(VALUE obj, struct xmlctx *xctx, xmlnode *node)
-{
-    node = XmlDomGetFirstChild(xctx, node);
-    while (node != NULL) {
-        rb_funcall(obj, id_add, 1, oci8_make_rexml(xctx, node));
-        node = XmlDomGetNextSibling(xctx, node);
-    }
-    return obj;
-}
-
-static VALUE add_attributes(VALUE obj, struct xmlctx *xctx, xmlnode *node)
-{
-    xmlnamedmap *attrs;
-    xmlnode *attr;
-    oratext *name;
-    oratext *value;
-    ub4 num;
-    ub4 idx;
-
-    attrs = XmlDomGetAttrs(xctx, node);
-    num = XmlDomGetNodeMapLength(xctx, attrs);
-    for (idx = 0; idx < num; idx++) {
-        attr = XmlDomGetNodeMapItem(xctx, attrs, idx);
-        name = XmlDomGetAttrName(xctx, attr);
-        value = XmlDomGetAttrValue(xctx, attr);
-        rb_funcall(obj, id_add_attribute, 2,
-                   rb_str_new2_ora(name),
-                   value ? rb_str_new2_ora(value) : Qnil);
-    }
-    return obj;
-}
-
-static VALUE add_nodemap(VALUE obj, struct xmlctx *xctx, xmlnamedmap *map)
-{
-    xmlnode *node;
-    ub4 num;
-    ub4 idx;
-
-    num = XmlDomGetNodeMapLength(xctx, map);
-    for (idx = 0; idx < num; idx++) {
-        node = XmlDomGetNodeMapItem(xctx, map, idx);
-        rb_funcall(obj, id_add, 1, oci8_make_rexml(xctx, node));
-    }
-    return obj;
-}
-
-#else
-void Init_oci_xmldb(void)
-{
-}
-
-VALUE oci8_make_rexml(struct xmlctx *xctx, xmlnode *node)
-{
-    rb_notimplement();
-}
-#endif




More information about the ruby-oci8-commit mailing list