Hello!

        It would be great if I could do:

$sth->bind_param_inout(":mytable1", [EMAIL PROTECTED], 100, { TYPE => 
DBD::Oracle::ORA_VARCHAR2 } );

But autogenerated code from DBD prohibits array reference binds.

In DBD::Oracle there is an .xs file:

--------- Oracle.xs ----------
#include "Oracle.h"

DBISTATE_DECLARE;

MODULE = DBD::Oracle    PACKAGE = DBD::Oracle
...
------------------------------

After processing, we get the following:

--------- Oracle.xsi ---------
void
bind_param_inout(sth, param, value_ref, maxlen, attribs=Nullsv)
    SV *        sth
    SV *        param
    SV *        value_ref
    IV          maxlen
    SV *        attribs
    CODE:
    {
    IV sql_type = 0;
    D_imp_sth(sth);
    SV *value;
    if (!SvROK(value_ref) || SvTYPE(SvRV(value_ref)) > SVt_PVMG)
        croak("bind_param_inout needs a reference to a scalar value");
    value = SvRV(value_ref);
    if (SvREADONLY(value))
        croak("Modification of a read-only value attempted");
    if (SvGMAGICAL(value))
        mg_get(value);
    if (attribs) {
        if (SvNIOK(attribs)) {
            sql_type = SvIV(attribs);
            attribs = Nullsv;
        }
        else {
            SV **svp;
            DBD_ATTRIBS_CHECK("bind_param", sth, attribs);
            DBD_ATTRIB_GET_IV(attribs, "TYPE",4, svp, sql_type);
        }
    }
    ST(0) = dbd_bind_ph(sth, imp_sth, param, value, sql_type, attribs, TRUE, 
maxlen)
                ? &sv_yes : &sv_no;
    }
------------------------------

        But it would be great to bind arrays inout. What is the proper way to 
allow array bind?
Should we change:

--- Oracle.xsi.orig     Thu Sep  6 19:24:17 2007
+++ Oracle.xsi  Thu Sep  6 19:27:27 2007
@@ -526,13 +526,21 @@
     IV sql_type = 0;
     D_imp_sth(sth);
     SV *value;
-    if (!SvROK(value_ref) || SvTYPE(SvRV(value_ref)) > SVt_PVMG)
-       croak("bind_param_inout needs a reference to a scalar value");
+    if (!SvROK(value_ref) ||
+        (
+               (SvTYPE(SvRV(value_ref)) > SVt_PVMG) &&
+               (SvTYPE(SvRV(value_ref))!=SVt_PVAV )
+       )
+    )
+       croak("bind_param_inout needs a reference to a scalar or array value");
     value = SvRV(value_ref);
     if (SvREADONLY(value))
        croak("Modification of a read-only value attempted");
     if (SvGMAGICAL(value))
        mg_get(value);
+    if(SvTYPE(SvRV(value_ref))==SVt_PVAV){
+       value=value_ref;
+    }
     if (attribs) {
        if (SvNIOK(attribs)) {
            sql_type = SvIV(attribs);


                Bye. Alex.

Reply via email to