Author: byterock
Date: Sun Dec 23 08:16:22 2007
New Revision: 10454
Modified:
dbd-oracle/trunk/Makefile.PL
dbd-oracle/trunk/oci8.c
dbd-oracle/trunk/ocitrace.h
Log:
results from RC6 patches
Modified: dbd-oracle/trunk/Makefile.PL
==============================================================================
--- dbd-oracle/trunk/Makefile.PL (original)
+++ dbd-oracle/trunk/Makefile.PL Sun Dec 23 08:16:22 2007
@@ -670,6 +670,9 @@
$opts{DEFINE} .= " -DORA_OCI_8" if ($::opt_V && $client_version == 8.0)
or ($^O eq 'VMS' && $client_version < 9.0); #
OCILobIsTemporary
+# OCIStmntFetch2() is a feature of OCI 9.0.0
+$opts{DEFINE} .= " -DUSE_ORA_OCI_STMNT_FETCH " if ( $client_version < 9.0 );
+
# Set some private WriteMakefile options if this is 'me' :-)
if ($is_developer){ # a reasonable guess
Modified: dbd-oracle/trunk/oci8.c
==============================================================================
--- dbd-oracle/trunk/oci8.c (original)
+++ dbd-oracle/trunk/oci8.c Sun Dec 23 08:16:22 2007
@@ -226,7 +226,7 @@
case OCI_HTYPE_SESSION: return imp_dbh->authp;
}
croak("Can't get OCI handle type %d from DBI database handle",
handle_type);
- if( flags ) {/* For GCC not to warn on unused parameter */}
+ if( flags ) {/* For GCC not to warn on unused parameter */}
/* satisfy compiler warning, even though croak will never return */
return 0;
}
@@ -375,7 +375,7 @@
AV *av;
SV **sv_p;
if( bindp ) { /* For GCC not to warn on unused parameter*/ }
-
+
/* Check for bind values supplied by tuple array. */
tuples_av = phs->imp_sth->bind_tuples;
if(tuples_av) {
@@ -478,9 +478,9 @@
dTHX;
phs_t *phs = (phs_t*)octxp; /* context */
/*imp_sth_t *imp_sth = phs->imp_sth;*/
-
+
if( bindp ) { /* For GCC not to warn on unused parameter */ }
-
+
if (phs->desc_h) {
*bufpp = phs->desc_h;
phs->alen = 0;
@@ -673,7 +673,7 @@
croak("panic: DBI::_new_sth returned %d values instead of 2", count);
if(POPs){} /* For GCC not to warn on unused result */
-
+
sv_setsv(dest_sv, POPs);
SvREFCNT_dec(init_attr);
PUTBACK; FREETMPS; LEAVE;
@@ -1400,7 +1400,7 @@
fld = &obj->fields[pos]; /*get the field */
status=OCIObjectGetInd(fbh->imp_sth->envhp,fbh->imp_sth->errhp,value,(dvoid**)&obj->obj_ind);
-
+
/*the little bastard above took me ages to find out
seems Oracle does not like people to know that it can do this
the concept is simple really
@@ -1541,7 +1541,8 @@
empty_oci_object(fbh_obj_t *obj){
dTHX;
int pos = 0;
- fbh_obj_t *fld;
+ fbh_obj_t *fld=NULL;
+
switch (obj->element_typecode) {
@@ -1578,7 +1579,7 @@
default:
break;
}
- if (fld->value && SvTYPE(fld->value) == SVt_PVAV){
+ if ( fld && fld->value && (SvTYPE(fld->value) == SVt_PVAV) ){
av_clear(obj->value);
av_undef(obj->value);
}
@@ -1596,15 +1597,15 @@
static void
fetch_cleanup_oci_object(SV *sth, imp_fbh_t *fbh){
dTHX;
-
- if( sth ) { /* For GCC not to warn on unused parameter*/ }
-
+
+ if( sth ) { /* For GCC not to warn on unused parameter*/ }
+
if (fbh->obj){
if(fbh->obj->value){
empty_oci_object(fbh->obj);
}
}
-
+
if (DBIS->debug >= 3)
PerlIO_printf(DBILOGFP," fetch_cleanup_oci_object \n");
return;
@@ -1873,7 +1874,7 @@
PerlIO_printf(DBILOGFP, " obj_type = %p\n",obj->obj_type);
PerlIO_printf(DBILOGFP, " field_count = %d\n",obj->field_count);
PerlIO_printf(DBILOGFP, " fields = %p\n",obj->fields);
-
+
for (i = 0; i < obj->field_count;i++){
fbh_obj_t *fld = &obj->fields[i];
PerlIO_printf(DBILOGFP, " \n--->sub objects\n ");
@@ -2215,7 +2216,7 @@
}
OCIDefineObject_log_stat(fbh->defnp,imp_sth->errhp,fbh->obj->tdo,(dvoid**)&fbh->obj->obj_value,status);
-
+
if (status != OCI_SUCCESS) {
oci_error(h,imp_sth->errhp, status,
"OCIDefineObject");
++num_errors;
@@ -2837,7 +2838,7 @@
int
post_execute_lobs(SV *sth, imp_sth_t *imp_sth, ub4 row_count) /* XXX leaks
handles on error */
{
-
+
/* To insert a new LOB transparently (without using 'INSERT . RETURNING
.') */
/* we have to insert an empty LobLocator and then fetch it back from the
*/
/* server before we can call OCILobWrite on it! This function handles
that. */
@@ -2885,7 +2886,7 @@
ub4 amtp;
if(SvUPGRADE(phs->sv, SVt_PV)){/* For GCC not to warn on unused result
*/ }; /* just in case */
-
+
amtp = SvCUR(phs->sv); /* XXX UTF8? */
if (rc == 1405) { /* NULL - return undef */
sv_set_undef(phs->sv);
@@ -2912,11 +2913,11 @@
if (DBIS->debug >= 3)
PerlIO_printf(DBILOGFP, " calling OCILobWrite
fbh->csid=%d fbh->csform=%d amtp=%d\n",
fbh->csid, fbh->csform, amtp );
-
+
OCILobWrite_log_stat(imp_sth->svchp, errhp,
(OCILobLocator*)fbh->desc_h, &amtp, 1,
SvPVX(phs->sv), amtp, OCI_ONE_PIECE,
0,0, fbh->csid ,fbh->csform, status);
-
+
if (status != OCI_SUCCESS) {
return oci_error(sth, errhp, status, "OCILobWrite in
post_execute_lobs");
}
Modified: dbd-oracle/trunk/ocitrace.h
==============================================================================
--- dbd-oracle/trunk/ocitrace.h (original)
+++ dbd-oracle/trunk/ocitrace.h Sun Dec 23 08:16:22 2007
@@ -404,13 +404,22 @@
OciTp, (void*)sv,(void*)st,(void*)eh,ul_t((i)), \
ul_t((ro)),(void*)(si),(void*)(so),ul_t((md)), \
oci_status_name(stat)),stat : stat
-
+#if !defined(USE_ORA_OCI_STMNT_FETCH)
+ #define OCIStmtFetch_log_stat(sh,eh,nr,or,md,stat) \
+ stat=OCIStmtFetch2(sh,eh,nr,or,0,md); \
+ (DBD_OCI_TRACEON) ? PerlIO_printf(DBD_OCI_TRACEFP,
\
+ "%sStmtFetch(%p,%p,%lu,%u,%lu)=%s\n",
\
+ OciTp, (void*)sh,(void*)eh,ul_t(nr),(ub2)or,ul_t(md),
\
+ oci_status_name(stat)),stat : stat
+#else
#define OCIStmtFetch_log_stat(sh,eh,nr,or,md,stat) \
- stat=OCIStmtFetch2(sh,eh,nr,or,0,md); \
- (DBD_OCI_TRACEON) ? PerlIO_printf(DBD_OCI_TRACEFP,
\
- "%sStmtFetch(%p,%p,%lu,%u,%lu)=%s\n", \
- OciTp, (void*)sh,(void*)eh,ul_t(nr),(ub2)or,ul_t(md), \
- oci_status_name(stat)),stat : stat
+ stat=OCIStmtFetch(sh,eh,nr,or,md); \
+ (DBD_OCI_TRACEON) ? PerlIO_printf(DBD_OCI_TRACEFP,
\
+ "%sStmtFetch(%p,%p,%lu,%u,%lu)=%s\n",
\
+ OciTp, (void*)sh,(void*)eh,ul_t(nr),(ub2)or,ul_t(md),
\
+ oci_status_name(stat)),stat : stat
+#endif
+
#define OCIStmtPrepare_log_stat(sh,eh,s1,sl,l,m,stat) \
stat=OCIStmtPrepare(sh,eh,s1,sl,l,m); \
(DBD_OCI_TRACEON) ? PerlIO_printf(DBD_OCI_TRACEFP,
\