Author: byterock
Date: Tue Jan 22 14:54:35 2008
New Revision: 10640
Modified:
dbd-oracle/branches/array_inout/Oracle.pm
dbd-oracle/branches/array_inout/Oracle.xs
dbd-oracle/branches/array_inout/dbdimp.c
dbd-oracle/branches/array_inout/oci8.c
Log:
my stuyff
Modified: dbd-oracle/branches/array_inout/Oracle.pm
==============================================================================
--- dbd-oracle/branches/array_inout/Oracle.pm (original)
+++ dbd-oracle/branches/array_inout/Oracle.pm Tue Jan 22 14:54:35 2008
@@ -854,6 +854,14 @@
{ package DBD::Oracle::st; # ====== STATEMENT ======
+
+ sub bind_param_inout_array {
+ my $sth = shift;
+ my ($p_num, $value_array, $attr) = @_;
+ ora_bind_param_inout_array($sth, $p_num, $value_array, $attr);
+
+ }
+
sub execute_for_fetch {
my ($sth, $fetch_tuple_sub, $tuple_status) = @_;
my $row_count = 0;
Modified: dbd-oracle/branches/array_inout/Oracle.xs
==============================================================================
--- dbd-oracle/branches/array_inout/Oracle.xs (original)
+++ dbd-oracle/branches/array_inout/Oracle.xs Tue Jan 22 14:54:35 2008
@@ -78,12 +78,14 @@
MODULE = DBD::Oracle PACKAGE = DBD::Oracle::st
void
-bind_param_inout_array(sth, param, av_ref, maxlen, attribs=Nullsv)
+ora_bind_param_inout_array(sth, param, av_ref, maxlen, attribs=Nullsv)
SV * sth
SV * param
SV * av_ref
IV maxlen
SV * attribs
+ PREINIT:
+ D_imp_sth(sth);
CODE:
{
IV sql_type = 0;
@@ -107,6 +109,7 @@
}
}
PerlIO_printf(DBILOGFP," param=%d, av_value=%d, sql_type=%d
\n",param,av_value,sql_type);
+
ST(0) = dbd_bind_ph(sth, imp_sth, param,av_value, sql_type, attribs, TRUE,
maxlen)
? &sv_yes : &sv_no;
}
Modified: dbd-oracle/branches/array_inout/dbdimp.c
==============================================================================
--- dbd-oracle/branches/array_inout/dbdimp.c (original)
+++ dbd-oracle/branches/array_inout/dbdimp.c Tue Jan 22 14:54:35 2008
@@ -523,7 +523,7 @@
}
new_charsetid = OCINlsCharSetNameToId(imp_dbh->envhp,
(oratext*)SvPV_nolen(*svp));
-
+
if (!new_charsetid) {
croak("ora_charset value (%s) is not valid",
SvPV_nolen(*svp));
}
@@ -986,7 +986,7 @@
char *style="", *laststyle=Nullch;
STRLEN namelen;
phs_t *phs;
-
+PerlIO_printf(DBILOGFP, " pere parse\n");
/* allocate room for copy of statement with spare capacity */
/* for editing '?' or ':1' into ':p1' so we can use obndrv. */
/* XXX should use SV and append to it */
@@ -2032,7 +2032,7 @@
if(SvUPGRADE(phs->sv, SVt_PV)){} /* For gcc not to warn on unused
result)*/;
}
- if (DBIS->debug <= 2) {
+ if (DBIS->debug >= 2) {
char *val = neatsvpv(phs->sv,0);
PerlIO_printf(DBILOGFP, "dbd_rebind_ph_char() (1): bind %s <==
%.1000s (", phs->name, val);
if (!SvOK(phs->sv))
@@ -2087,7 +2087,7 @@
phs->maxlen = 0;
phs->alen = value_len + phs->alen_incnull;
- if (DBIS->debug <= 3) {
+ if (DBIS->debug >= 3) {
UV neatsvpvlen = (UV)DBIc_DBISTATE(imp_sth)->neatsvpvlen;
PerlIO_printf(DBILOGFP, "dbd_rebind_ph_char() (2): bind %s <== '%.*s'
(size %ld/%ld, otype %d, indp %d, at_exec %d)\n",
phs->name,
@@ -2241,7 +2241,8 @@
int trace_level = DBIS->debug;
ub1 csform;
ub2 csid;
- if (trace_level <= 5)
+
+ if (trace_level >= 5)
PerlIO_printf(DBILOGFP, "dbd_rebind_ph() (1): rebinding %s as
%s (%s, ftype %d, csid %d, csform %d, inout %d)\n",
phs->name, (SvPOK(phs->sv) ? neatsvpv(phs->sv,0) :
"NULL"),(SvUTF8(phs->sv) ? "is-utf8" : "not-utf8"),
phs->ftype, phs->csid, phs->csform, phs->is_inout);
@@ -2263,28 +2264,17 @@
default:
done = dbd_rebind_ph_char(imp_sth, phs);
}
- PerlIO_printf(DBILOGFP, " John dbd_rebind_ph done=%d \n",done);
-
if (done == 2) { /* the dbd_rebind_* did the OCI bind call itself
successfully */
- if (trace_level <= 3)
- PerlIO_printf(DBILOGFP, " bind %s done with ftype
%d\n",
+ if (trace_level >= 3)
+ PerlIO_printf(DBILOGFP, " bind %s done with ftype %d\n",
phs->name, phs->ftype);
- return 1;
+ return 1;
}
if (done != 1) {
- return 0; /* the rebind failed */
+ return 0; /* the rebind failed */
}
at_exec = (phs->desc_h == NULL);
-
- PerlIO_printf(DBILOGFP, " John 1 at_exec= %d\n", (phs->desc_h ==
NULL));
-
- PerlIO_printf(DBILOGFP, " John 2 OCI_DATA_AT_EXEC=%d OCI_DEFAULT=%d\n",
OCI_DATA_AT_EXEC,OCI_DEFAULT);
-
- PerlIO_printf(DBILOGFP, " John 3 at_exec ? = %d\n", (at_exec ?
OCI_DATA_AT_EXEC : OCI_DEFAULT));
-
-
-
OCIBindByName_log_stat(imp_sth->stmhp, &phs->bndhp, imp_sth->errhp,
(text*)phs->name, (sb4)strlen(phs->name),
phs->progv,
@@ -2295,29 +2285,20 @@
0, /* max elements that can fit in allocated array */
NULL, /* (ptr to) current number of elements in array */
(ub4)(at_exec ? OCI_DATA_AT_EXEC : OCI_DEFAULT),
- status);
-
- PerlIO_printf(DBILOGFP, " John 4 OCIBindByName_log_stat status %d\n",
status);
-
+ status
+ );
if (status != OCI_SUCCESS) {
- oci_error(sth, imp_sth->errhp, status, "OCIBindByName");
- return 0;
+ oci_error(sth, imp_sth->errhp, status, "OCIBindByName");
+ return 0;
}
-
if (at_exec) {
-
-
- OCIBindDynamic_log(phs->bndhp, imp_sth->errhp,
+ OCIBindDynamic_log(phs->bndhp, imp_sth->errhp,
(dvoid *)phs, dbd_phs_in,
(dvoid *)phs, dbd_phs_out, status);
-
- PerlIO_printf(DBILOGFP, " John 5 OCIBindDynamic_log status
%d\n", status);
-
- if (status != OCI_SUCCESS) {
- oci_error(sth, imp_sth->errhp, status, "OCIBindDynamic");
- return 0;
- }
-
+ if (status != OCI_SUCCESS) {
+ oci_error(sth, imp_sth->errhp, status, "OCIBindDynamic");
+ return 0;
+ }
}
/* some/all of the following should perhaps move into dbd_phs_in() */
@@ -2330,27 +2311,26 @@
csform = SQLCS_IMPLICIT;
else if (CSFORM_IMPLIES_UTF8(SQLCS_NCHAR))
csform = SQLCS_NCHAR; /* else leave csform == 0 */
-
- if (trace_level)
- PerlIO_printf(DBILOGFP, "dbd_rebind_ph() (2): rebinding %s
with UTF8 value %s", phs->name,
- (csform == SQLCS_IMPLICIT) ? "so setting
csform=SQLCS_IMPLICIT" :
- (csform == SQLCS_NCHAR) ? "so setting
csform=SQLCS_NCHAR" :
- "but neither CHAR nor NCHAR are unicode\n");
+ if (trace_level)
+ PerlIO_printf(DBILOGFP, "dbd_rebind_ph() (2): rebinding %s with
UTF8 value %s", phs->name,
+ (csform == SQLCS_IMPLICIT) ? "so setting csform=SQLCS_IMPLICIT"
:
+ (csform == SQLCS_NCHAR) ? "so setting csform=SQLCS_NCHAR" :
+ "but neither CHAR nor NCHAR are unicode\n");
}
if (csform) {
/* set OCI_ATTR_CHARSET_FORM before we get the default
OCI_ATTR_CHARSET_ID */
- OCIAttrSet_log_stat(phs->bndhp, (ub4) OCI_HTYPE_BIND,
- &csform, (ub4) 0, (ub4) OCI_ATTR_CHARSET_FORM,
imp_sth->errhp, status);
- if ( status != OCI_SUCCESS ) {
- oci_error(sth, imp_sth->errhp, status,
ora_sql_error(imp_sth,"OCIAttrSet (OCI_ATTR_CHARSET_FORM)"));
- return 0;
- }
+ OCIAttrSet_log_stat(phs->bndhp, (ub4) OCI_HTYPE_BIND,
+ &csform, (ub4) 0, (ub4) OCI_ATTR_CHARSET_FORM, imp_sth->errhp,
status);
+ if ( status != OCI_SUCCESS ) {
+ oci_error(sth, imp_sth->errhp, status,
ora_sql_error(imp_sth,"OCIAttrSet (OCI_ATTR_CHARSET_FORM)"));
+ return 0;
+ }
}
if (!phs->csid_orig) { /* get the default csid Oracle would use */
- OCIAttrGet_log_stat(phs->bndhp, OCI_HTYPE_BIND,
&phs->csid_orig, (ub4)0 ,
- OCI_ATTR_CHARSET_ID, imp_sth->errhp, status);
+ OCIAttrGet_log_stat(phs->bndhp, OCI_HTYPE_BIND, &phs->csid_orig, (ub4)0
,
+ OCI_ATTR_CHARSET_ID, imp_sth->errhp, status);
}
/* if app has specified a csid then use that, else use default */
@@ -2360,7 +2340,7 @@
if (SvUTF8(phs->sv) && !CS_IS_UTF8(csid))
csid = utf8_csid; /* not al32utf8_csid here on purpose */
- if (trace_level <= 3)
+ if (trace_level >= 3)
PerlIO_printf(DBILOGFP, "dbd_rebind_ph(): bind %s <== %s "
"(%s, %s, csid %d->%d->%d, ftype %d, csform %d->%d, maxlen %lu,
maxdata_size %lu)\n",
phs->name, neatsvpv(phs->sv,0),
@@ -2372,23 +2352,23 @@
if (csid) {
- OCIAttrSet_log_stat(phs->bndhp, (ub4) OCI_HTYPE_BIND,
+ OCIAttrSet_log_stat(phs->bndhp, (ub4) OCI_HTYPE_BIND,
&csid, (ub4) 0, (ub4) OCI_ATTR_CHARSET_ID, imp_sth->errhp, status);
- if ( status != OCI_SUCCESS ) {
- oci_error(sth, imp_sth->errhp, status,
ora_sql_error(imp_sth,"OCIAttrSet (OCI_ATTR_CHARSET_ID)"));
- return 0;
- }
+ if ( status != OCI_SUCCESS ) {
+ oci_error(sth, imp_sth->errhp, status,
ora_sql_error(imp_sth,"OCIAttrSet (OCI_ATTR_CHARSET_ID)"));
+ return 0;
+ }
}
if (phs->maxdata_size) {
- OCIAttrSet_log_stat(phs->bndhp, (ub4)OCI_HTYPE_BIND,
- neatsvpv(phs->sv,0), (ub4)phs->maxdata_size,
(ub4)OCI_ATTR_MAXDATA_SIZE, imp_sth->errhp, status);
- if ( status != OCI_SUCCESS ) {
- oci_error(sth, imp_sth->errhp, status,
ora_sql_error(imp_sth,"OCIAttrSet (OCI_ATTR_MAXDATA_SIZE)"));
- return 0;
- }
+ OCIAttrSet_log_stat(phs->bndhp, (ub4)OCI_HTYPE_BIND,
+ neatsvpv(phs->sv,0), (ub4)phs->maxdata_size,
(ub4)OCI_ATTR_MAXDATA_SIZE, imp_sth->errhp, status);
+ if ( status != OCI_SUCCESS ) {
+ oci_error(sth, imp_sth->errhp, status,
ora_sql_error(imp_sth,"OCIAttrSet (OCI_ATTR_MAXDATA_SIZE)"));
+ return 0;
+ }
}
-
+
return 1;
}
@@ -2404,13 +2384,16 @@
phs_t *phs;
/* check if placeholder was passed as a number */
-PerlIO_printf(DBILOGFP, "in dbd_bind_ph\n");
-
+PerlIO_printf(DBILOGFP, "in dbd_bind_ph()\n");
if (SvGMAGICAL(ph_namesv)) /* eg tainted or overloaded */
- mg_get(ph_namesv);
-
+ mg_get(ph_namesv);
+
+ PerlIO_printf(DBILOGFP, "in dbd_bind_ph() js 0\n");
+
if (!SvNIOKp(ph_namesv)) {
- STRLEN i;
+ STRLEN i;
+
+PerlIO_printf(DBILOGFP, "in dbd_bind_ph js 1\n");
name = SvPV(ph_namesv, name_len);
if (name_len > sizeof(namebuf)-1)
croak("Placeholder name %s too long",
neatsvpv(ph_namesv,0));
@@ -2431,10 +2414,10 @@
&& !sv_derived_from(newvalue, "OCILobLocatorPtr" ) /*
input LOB locator*/
&& !(SvTYPE(SvRV(newvalue))==SVt_PVAV) /* Allow array
binds */
)
- croak("Can't bind a reference (%s)",
neatsvpv(newvalue,0));
+ croak("Can't bind a reference (%s)", neatsvpv(newvalue,0));
+
if (SvTYPE(newvalue) > SVt_PVAV) /* Array binding supported */
croak("Can't bind a non-scalar, non-array value (%s)",
neatsvpv(newvalue,0));
-
if (SvTYPE(newvalue) == SVt_PVLV && is_inout) /* may allow
later */
croak("Can't bind ``lvalue'' mode scalar as inout
parameter (currently)");
@@ -2444,36 +2427,33 @@
if (is_inout)
PerlIO_printf(DBILOGFP, ", inout 0x%lx, maxlen %ld",
(long)newvalue, (long)maxlen);
-
if (attribs)
PerlIO_printf(DBILOGFP, ", attribs: %s",
neatsvpv(attribs,0));
- PerlIO_printf(DBILOGFP, ")\n");
+ PerlIO_printf(DBILOGFP, ")\n");
}
+PerlIO_printf(DBILOGFP, "in dbd_bind_ph() js 1a\n");
phs_svp = hv_fetch(imp_sth->all_params_hv, name, name_len, 0);
-
+ PerlIO_printf(DBILOGFP, "in dbd_bind_ph() js 2a\n");
+
if (phs_svp == NULL)
croak("Can't bind unknown placeholder '%s' (%s)", name,
neatsvpv(ph_namesv,0));
/* This value is not a string, but a binary structure phs_st
instead. */
phs = (phs_t*)(void*)SvPVX(*phs_svp); /* placeholder struct */
- PerlIO_printf(DBILOGFP, "john s 1\n");
-
+
if (phs->sv == &sv_undef) { /* first bind for this placeholder
*/
- PerlIO_printf(DBILOGFP, "john s 2\n");
- phs->is_inout = is_inout;
- if (is_inout) {
-PerlIO_printf(DBILOGFP, "john s 3\n");
+ phs->is_inout = is_inout;
+ if (is_inout) {
+ PerlIO_printf(DBILOGFP, "John s 2\n");
+
/* phs->sv assigned in the code below */
++imp_sth->has_inout_params;
/* build array of phs's so we can deal with out
vars fast */
if (!imp_sth->out_params_av)
- imp_sth->out_params_av = newAV();
-
+ imp_sth->out_params_av = newAV();
av_push(imp_sth->out_params_av,
SvREFCNT_inc(*phs_svp));
-PerlIO_printf(DBILOGFP, "john s 4\n");
-
- }
+ }
/*
* Init number of bound array entries to zero.
@@ -2483,75 +2463,78 @@
* If no ora_maxarray_numentries specified, let it be
* the same as scalar(@array) bound (see dbd_rebind_ph_varchar2_table()
).
*/
- phs->array_numstruct=0;
-PerlIO_printf(DBILOGFP, "john s 4a %d\n",attribs);
+ phs->array_numstruct=0;
- if (attribs) { /* only look for ora_type on first bind
of var */
- SV **svp;
-PerlIO_printf(DBILOGFP, "john s 5\n");
- /* Setup / Clear attributes as defined by
attribs. */
- /* XXX If attribs is EMPTY then reset attribs to default? */
+ if (attribs) { /* only look for ora_type on first bind
of var */
+ SV **svp;
+ /* Setup / Clear attributes as defined by attribs.
*/
+ /* XXX If attribs is EMPTY then reset attribs to
default? */
if ( (svp=hv_fetch((HV*)SvRV(attribs),
"ora_type",8, 0)) != NULL) {
int ora_type = SvIV(*svp);
- if (!oratype_bind_ok(ora_type))
- croak("Can't bind %s, ora_type
%d not supported by DBD::Oracle",
- phs->name, ora_type);
-
+ if (!oratype_bind_ok(ora_type))
+ croak("Can't bind %s, ora_type %d
not supported by DBD::Oracle",
+ phs->name, ora_type);
if (sql_type)
- croak("Can't specify both TYPE (%d) and
ora_type (%d) for %s",
- sql_type, ora_type, phs->name);
-
- phs->ftype = ora_type;
- }
- if ( (svp=hv_fetch((HV*)SvRV(attribs), "ora_field",9,
0)) != NULL) {
- phs->ora_field = SvREFCNT_inc(*svp);
- }
-
- if ( (svp=hv_fetch((HV*)SvRV(attribs), "ora_csform",
10, 0)) != NULL) {
+ croak("Can't specify both TYPE (%d)
and ora_type (%d) for %s",
+ sql_type, ora_type, phs->name);
+ phs->ftype = ora_type;
+ }
+ if ( (svp=hv_fetch((HV*)SvRV(attribs),
"ora_field",9, 0)) != NULL) {
+ phs->ora_field = SvREFCNT_inc(*svp);
+ }
+ if ( (svp=hv_fetch((HV*)SvRV(attribs),
"ora_csform", 10, 0)) != NULL) {
if (SvIV(*svp) == SQLCS_IMPLICIT ||
SvIV(*svp) == SQLCS_NCHAR)
phs->csform = (ub1)SvIV(*svp);
else warn("ora_csform must be 1
(SQLCS_IMPLICIT) or 2 (SQLCS_NCHAR), not %d", SvIV(*svp));
- }
- if ( (svp=hv_fetch((HV*)SvRV(attribs),
"ora_maxdata_size", 16, 0)) != NULL) {
+ }
+ if ( (svp=hv_fetch((HV*)SvRV(attribs),
"ora_maxdata_size", 16, 0)) != NULL) {
phs->maxdata_size = SvUV(*svp);
- }
- if ( (svp=hv_fetch((HV*)SvRV(attribs),
"ora_maxarray_numentries", 23, 0)) != NULL) {
- phs->ora_maxarray_numentries=SvUV(*svp);
- }
- if ( (svp=hv_fetch((HV*)SvRV(attribs),
"ora_internal_type", 17, 0)) != NULL) {
- phs->ora_internal_type=SvUV(*svp);
- }
- }
-PerlIO_printf(DBILOGFP, "john s 6\n");
- if (sql_type)
- phs->ftype = ora_sql_type(imp_sth, phs->name,
(int)sql_type);
-
- /* treat Oracle7 SQLT_CUR as SQLT_RSET for Oracle8 */
- if (phs->ftype==102)
- phs->ftype = 116;
+ }
+ if ( (svp=hv_fetch((HV*)SvRV(attribs),
"ora_maxarray_numentries", 23, 0)) != NULL) {
+ phs->ora_maxarray_numentries=SvUV(*svp);
+ }
+ if ( (svp=hv_fetch((HV*)SvRV(attribs), "ora_internal_type", 17,
0)) != NULL) {
+ phs->ora_internal_type=SvUV(*svp);
+ }
+ }
+
+ PerlIO_printf(DBILOGFP, "in dbd_bind_ph() b\n");
+
+ if (sql_type)
+ phs->ftype = ora_sql_type(imp_sth, phs->name,
(int)sql_type);
+
+ /* treat Oracle7 SQLT_CUR as SQLT_RSET for Oracle8 */
+ if (phs->ftype==102)
+ phs->ftype = 116;
/* some types require the trailing null included in the length. */
/* SQLT_STR=5=STRING, SQLT_AVC=97=VARCHAR */
- phs->alen_incnull = (phs->ftype==SQLT_STR ||
phs->ftype==SQLT_AVC);
+ phs->alen_incnull = (phs->ftype==SQLT_STR ||
phs->ftype==SQLT_AVC);
- } /* was first bind for this placeholder */
+ } /* was first bind for this placeholder */
/* check later rebinds for any changes */
else if (is_inout != phs->is_inout) {
- croak("Can't rebind or change param %s in/out mode after first bind
(%d => %d)",
- phs->name, phs->is_inout , is_inout);
+ croak("Can't rebind or change param %s in/out mode after first
bind (%d => %d)",
+ phs->name, phs->is_inout , is_inout);
+ PerlIO_printf(DBILOGFP, "in dbd_bind_ph js 2\n");
+
}
else if (sql_type && phs->ftype != ora_sql_type(imp_sth, phs->name,
(int)sql_type)) {
- croak("Can't change TYPE of param %s to %d after initial bind",
- phs->name, sql_type);
+ croak("Can't change TYPE of param %s to %d after initial bind",
+ phs->name, sql_type);
+ PerlIO_printf(DBILOGFP, "in dbd_bind_ph js 3\n");
+
}
-
-PerlIO_printf(DBILOGFP, "john s 7 SvROK=%d\n", SvROK(newvalue));
-PerlIO_printf(DBILOGFP, "john s SvTYPE(SvRV(newvalue))==SVt_PVAV
=%d\n",SvTYPE(SvRV(newvalue)));
+ PerlIO_printf(DBILOGFP, "in dbd_bind_ph js 4\n");
/* Array binding is supported for a limited number of data types. */
if( SvROK(newvalue) ){
+ PerlIO_printf(DBILOGFP, "in dbd_bind_ph js 5\n");
+
if( SvTYPE(SvRV(newvalue))==SVt_PVAV ){
+ PerlIO_printf(DBILOGFP, "in dbd_bind_ph js 6\n");
+
if( (phs->ftype == ORA_VARCHAR2_TABLE) ||
(phs->ftype == ORA_NUMBER_TABLE)) {
/* Supported */
@@ -2565,20 +2548,21 @@
phs->maxlen = maxlen; /* 0 if not inout */
if (!is_inout) { /* normal bind so take a (new) copy of current value
*/
- if (phs->sv == &sv_undef) /* (first time bind) */
+ if (phs->sv == &sv_undef) /* (first time bind) */
phs->sv = newSV(0);
-
sv_setsv(phs->sv, newvalue);
if (SvAMAGIC(phs->sv)) /* overloaded. XXX hack, logic ought to
be pushed deeper */
sv_pvn_force(phs->sv, &na);
-
}
else if (newvalue != phs->sv) {
+ PerlIO_printf(DBILOGFP, "in dbd_bind_ph js 7\n");
+
if (phs->sv)
SvREFCNT_dec(phs->sv);
-
phs->sv = SvREFCNT_inc(newvalue); /* point to live var
*/
}
+PerlIO_printf(DBILOGFP, "end dbd_bind_ph js \n");
+
return dbd_rebind_ph(sth, imp_sth, phs);
}
@@ -2901,7 +2885,7 @@
STRLEN len;
if (debug >= 2)
- PerlIO_printf(DBILOGFP, " ora_st_execute_array %s count=%d
(%s %s %s)...\n",
+ PerlIO_printf(DBILOGFP, " ora_st_execute_array %s count=%d (%s %s
%s)...\n",
oci_stmt_type_name(imp_sth->stmt_type), exe_count,
neatsvpv(tuples,0), neatsvpv(tuples_status,0),
neatsvpv(columns, 0));
@@ -3007,7 +2991,7 @@
/*check to see if value sv is a null (undef) if it is upgrade
it*/
if (!SvOK(sv)) {
if(SvUPGRADE(sv, SVt_PV)){} /* For GCC
not to warn on unused result */
-
+
}
else {
SvPV(sv, len);
@@ -3024,7 +3008,7 @@
phs[i]->maxlen = len;
/* Do OCI bind calls on last iteration. */
- if( ((unsigned int) j ) == exe_count - 1 ) {
+ if( ((unsigned int) j ) == exe_count - 1 ) {
if(!do_bind_array_exec(sth, imp_sth, phs[i])) {
Safefree(phs);
}
@@ -3358,7 +3342,7 @@
STRLEN kl;
SV *cachesv = NULL;
char *key = SvPV(keysv,kl);
- if( imp_sth ) { /* For GCC not to warn on unused argument */}
+ if( imp_sth ) { /* For GCC not to warn on unused argument */}
/*
int on = SvTRUE(valuesv);
int oraperl = DBIc_COMPAT(imp_sth); */
Modified: dbd-oracle/branches/array_inout/oci8.c
==============================================================================
--- dbd-oracle/branches/array_inout/oci8.c (original)
+++ dbd-oracle/branches/array_inout/oci8.c Tue Jan 22 14:54:35 2008
@@ -326,7 +326,7 @@
OCIAttrGet_stmhp_stat(imp_sth, &imp_sth->stmt_type, 0, OCI_ATTR_STMT_TYPE,
status);
- if (DBIS->debug >= 3)
+ if (DBIS->debug <= 3)
PerlIO_printf(DBILOGFP, " dbd_st_prepare'd sql %s (pl%d, auto_lob%d,
check_sql%d)\n",
oci_stmt_type_name(imp_sth->stmt_type),
oparse_lng, imp_sth->auto_lob, ora_check_sql);
@@ -376,6 +376,7 @@
SV **sv_p;
if( bindp ) { /* For GCC not to warn on unused parameter*/ }
+PerlIO_printf(DBILOGFP, " in dbd_phs_in\n");
/* Check for bind values supplied by tuple array. */
tuples_av = phs->imp_sth->bind_tuples;
if(tuples_av) {
@@ -480,7 +481,7 @@
/*imp_sth_t *imp_sth = phs->imp_sth;*/
if( bindp ) { /* For GCC not to warn on unused parameter */ }
-
+PerlIO_printf(DBILOGFP, " in dbd_phs_out\n");
if (phs->desc_h) {
*bufpp = phs->desc_h;
phs->alen = 0;
@@ -1309,8 +1310,8 @@
ub4 i = 0;
sword status;
SV *raw_sv;
-
-
+
+
/* get the data based on the type code*/
if (DBIS->debug >= 5) {
PerlIO_printf(DBILOGFP, " getting value of object attribute named %s
with typecode=%d\n",name,typecode);
@@ -1321,7 +1322,7 @@
case OCI_TYPECODE_INTERVAL_YM :
case OCI_TYPECODE_INTERVAL_DS :
-
+
OCIIntervalToText_log_stat(fbh->imp_sth->envhp,
fbh->imp_sth->errhp,
attr_value,
@@ -1332,47 +1333,47 @@
str_buf[str_len+1] = '\0';
av_push(list, newSVpv( (char *) str_buf,0));
break;
-
+
case OCI_TYPECODE_TIMESTAMP_TZ :
case OCI_TYPECODE_TIMESTAMP_LTZ :
case OCI_TYPECODE_TIMESTAMP :
-
-
+
+
str_len = 200;
- OCIDateTimeToText_log_stat(fbh->imp_sth->envhp,
+ OCIDateTimeToText_log_stat(fbh->imp_sth->envhp,
fbh->imp_sth->errhp,attr_value,&str_len,str_buf,status);
-
-
-
+
+
+
if (typecode == OCI_TYPECODE_TIMESTAMP_TZ || typecode ==
OCI_TYPECODE_TIMESTAMP_LTZ){
char s_tz_hour[3]="000";
char s_tz_min[3]="000";
sb1 tz_hour;
sb1 tz_minute;
- status = OCIDateTimeGetTimeZoneOffset
(fbh->imp_sth->envhp,
-
fbh->imp_sth->errhp,
-
*(OCIDateTime**)attr_value,
+ status = OCIDateTimeGetTimeZoneOffset
(fbh->imp_sth->envhp,
+
fbh->imp_sth->errhp,
+
*(OCIDateTime**)attr_value,
&tz_hour,
&tz_minute );
-
+
if ( (tz_hour<0) && (tz_hour>-10) ){
sprintf(s_tz_hour," %03ld",tz_hour);
} else {
sprintf(s_tz_hour," %02ld",tz_hour);
}
-
+
sprintf(s_tz_min,":%02ld",tz_minute);
strcat(str_buf,s_tz_hour);
strcat(str_buf, s_tz_min);
- str_buf[str_len+7] = '\0';
-
+ str_buf[str_len+7] = '\0';
+
} else {
str_buf[str_len+1] = '\0';
}
-
+
av_push(list, newSVpv( (char *) str_buf,0));
break;
-
+
case OCI_TYPECODE_DATE : /* fixed length string*/
str_len = 200;
OCIDateToText_log_stat(fbh->imp_sth->errhp, (CONST OCIDate *)
attr_value,&str_len,str_buf,status);
@@ -1457,7 +1458,7 @@
if (obj->obj_ind) {
obj_ind = obj->obj_ind;
} else {
-
+
status=OCIObjectGetInd(fbh->imp_sth->envhp,fbh->imp_sth->errhp,value,(dvoid**)&obj_ind);
if (status != OCI_SUCCESS) {
@@ -1465,7 +1466,7 @@
return 0;
}
}
-
+
for (pos = 0; pos < obj->field_count; pos++){
fld = &obj->fields[pos]; /*get the field */
@@ -1482,7 +1483,7 @@
The thing to remember is that OCI and C have no way of representing a DB NULLs
so we use the OCIInd find out
if the object or any of its properties are NULL, This is one little line in a
20 chapter book and even then
-id only shows you examples with the C struct built in and only a single
record. Nowhere does it say you can do it this way.
+id only shows you examples with the C struct built in and only a single
record. Nowhere does it say you can do it this way.
if (status != OCI_SUCCESS) {
oci_error(sth, fbh->imp_sth->errhp,
status, "OCIObjectGetInd");