Author: byterock
Date: Fri Oct 24 13:19:53 2008
New Revision: 12000

Modified:
   dbd-oracle/trunk/Changes
   dbd-oracle/trunk/Oracle.pm
   dbd-oracle/trunk/dbdimp.c
   dbd-oracle/trunk/dbdimp.h
   dbd-oracle/trunk/oci8.c

Log:
final fix up for 38749 also added ora_oci_success_warn to let us see silent 
warnings

Modified: dbd-oracle/trunk/Changes
==============================================================================
--- dbd-oracle/trunk/Changes    (original)
+++ dbd-oracle/trunk/Changes    Fri Oct 24 13:19:53 2008
@@ -1,4 +1,5 @@
 =head1 Changes in DBD-Oracle 1.23(svn rev #####)  
+  Fix for rt.cpan.org Ticket #=38749 and added ora_oci_success_warn to display 
silent OCI warnings from John Scoles
   Patch for UTF8 check on execute_array from David Mansfield and a little by 
John Scoles
   
   

Modified: dbd-oracle/trunk/Oracle.pm
==============================================================================
--- dbd-oracle/trunk/Oracle.pm  (original)
+++ dbd-oracle/trunk/Oracle.pm  Fri Oct 24 13:19:53 2008
@@ -317,6 +317,7 @@
                  ora_ncharset          => undef,
                  ora_session_mode      => undef,
                  ora_verbose           => undef,
+                 ora_oci_success_warn  => undef
                  };
     }
    
@@ -1505,11 +1506,16 @@
 
 or set it directly on the DB handle like this;
 
-  $dbh->{ora_verbose} =6';
+  $dbh->{ora_verbose} =6;
 
 In both cases the DBD::Oracle trace level to 6, which is this level that will 
trace most of the calls to OCI. 
 
-=head2 Database Handle Attributes
+
+=item ora_oci_success_warn
+
+Use this value to print silent OCI warnings that may happen when an execute or 
fetch returns "Success With Info".
+
+  $dbh->{ora_oci_success_warn} =1;
 
 =item ora_ph_type
 
@@ -1660,6 +1666,10 @@
 
 Use this value to enable DBD::Oracle only tracing.  Simply set the attribute 
to the trace level you desire.
 
+=item ora_oci_success_warn
+
+Use this value to print silent OCI warnings that may happen when a fetch 
returns "Success With Info".
+
 =back
 
 =head2 Placeholder Binding Attributes

Modified: dbd-oracle/trunk/dbdimp.c
==============================================================================
--- dbd-oracle/trunk/dbdimp.c   (original)
+++ dbd-oracle/trunk/dbdimp.c   Fri Oct 24 13:19:53 2008
@@ -40,9 +40,9 @@
 DBISTATE_DECLARE;
 
 int ora_fetchtest;     /* intrnal test only, not thread safe */
-int is_extproc = 0;
+int is_extproc  = 0;
 int dbd_verbose = 0; /* DBD only debugging*/
-
+int oci_warn    = 0; /* show oci warnings */
 /* bitflag constants for figuring out how to handle utf8 for array binds */
 #define ARRAY_BIND_NATIVE 0x01
 #define ARRAY_BIND_UTF8   0x02
@@ -376,6 +376,8 @@
        DBD_ATTRIB_GET_IV(  attr, "dbd_verbose",  11, svp, dbd_verbose);
        if (DBD_ATTRIB_TRUE(attr,"ora_verbose",11,svp))
        DBD_ATTRIB_GET_IV(  attr, "ora_verbose",  11, svp, dbd_verbose);
+       if (DBD_ATTRIB_TRUE(attr,"ora_oci_success_warn",20,svp))
+       DBD_ATTRIB_GET_IV(  attr, "ora_oci_success_warn",  20, svp, oci_warn);
 
 
     /* dbi_imp_data code adapted from DBD::mysql */
@@ -946,7 +948,12 @@
     int on = SvTRUE(valuesv);
     int cacheit = 1;
 
-    if (kl==11 && (strEQ(key, "ora_verbose") || strEQ(key, "dbd_verbose"))) {
+
+
+       if (kl==20 && strEQ(key, "ora_oci_success_warn") ) {
+               oci_warn = SvIV (valuesv);
+    }
+    else if (kl==11 && (strEQ(key, "ora_verbose") || strEQ(key, 
"dbd_verbose"))) {
                dbd_verbose = SvIV (valuesv);
     }
     else if (kl==10 && strEQ(key, "AutoCommit")) {
@@ -997,7 +1004,10 @@
 
     /* AutoCommit FETCH via DBI */
 
-    if (kl==11 && (strEQ(key, "ora_verbose") || strEQ(key, "dbd_verbose"))) {
+    if (kl==20 && strEQ(key, "ora_oci_success_warn")) {
+               retsv = newSViv (oci_warn);
+       }
+    else if (kl==11 && (strEQ(key, "ora_verbose") || strEQ(key, 
"dbd_verbose"))) {
                retsv = newSViv (dbd_verbose);
        }
     else if (kl==10 && strEQ(key, "AutoCommit")) {

Modified: dbd-oracle/trunk/dbdimp.h
==============================================================================
--- dbd-oracle/trunk/dbdimp.h   (original)
+++ dbd-oracle/trunk/dbdimp.h   Fri Oct 24 13:19:53 2008
@@ -251,6 +251,7 @@
 
 extern int ora_fetchtest;
 extern int dbd_verbose;
+extern int oci_warn;
 
 extern ub2 charsetid;
 extern ub2 ncharsetid;

Modified: dbd-oracle/trunk/oci8.c
==============================================================================
--- dbd-oracle/trunk/oci8.c     (original)
+++ dbd-oracle/trunk/oci8.c     Fri Oct 24 13:19:53 2008
@@ -566,6 +566,7 @@
                DBD_ATTRIB_GET_IV(  attribs, "ora_exe_mode", 12, svp, 
imp_sth->exe_mode);
                DBD_ATTRIB_GET_IV(  attribs, "ora_prefetch_memory",  19, svp, 
imp_sth->prefetch_memory);
            DBD_ATTRIB_GET_IV(  attribs, "ora_verbose",  11, svp, dbd_verbose);
+           DBD_ATTRIB_GET_IV(  attribs, "ora_oci_success_warn",  20, svp, 
oci_warn);
 
                if (!dbd_verbose)
                        DBD_ATTRIB_GET_IV(  attribs, "dbd_verbose",  11, svp, 
dbd_verbose);
@@ -3062,6 +3063,9 @@
                                if 
(imp_sth->rs_array_num_rows<=imp_sth->rs_array_idx && 
(imp_sth->rs_array_status==OCI_SUCCESS || 
imp_sth->rs_array_status==OCI_SUCCESS_WITH_INFO)) {
                                
OCIStmtFetch_log_stat(imp_sth->stmhp,imp_sth->errhp,imp_sth->rs_array_size,(ub2)OCI_FETCH_NEXT,OCI_DEFAULT,status);
                                        imp_sth->rs_array_status=status;
+                                       if (oci_warn &&  
(imp_sth->rs_array_status == OCI_SUCCESS_WITH_INFO)) {
+                                               oci_error(sth, imp_sth->errhp, 
status, "OCIStmtFetch");
+                               }
                                        OCIAttrGet_stmhp_stat(imp_sth, 
&imp_sth->rs_array_num_rows,0,OCI_ATTR_ROWS_FETCHED, status);
                                        imp_sth->rs_array_idx=0;
                                }
@@ -3093,6 +3097,11 @@
                    oci_error(sth, imp_sth->errhp, status, "OCIStmtFetch");
                    return Nullav;
                }
+               if (oci_warn && (status == OCI_SUCCESS_WITH_INFO)) {
+                   oci_error(sth, imp_sth->errhp, status, "OCIStmtFetch");
+               }
+
+
        /* for OCI_SUCCESS_WITH_INFO we fall through and let the        */
        /* per-field rcode value be dealt with as we fetch the data     */
     }

Reply via email to