[svn:dbd-oracle] r15449 - in dbd-oracle/trunk: . lib/DBD

[email protected] Tue, 23 Oct 2012 05:32:21 -0700 (PDT)
Newsgroups perl.dbd.oracle.changes
Message-ID <[email protected]>
Author: mjevans
Date: Tue Oct 23 05:32:20 2012
New Revision: 15449

Modified:
   dbd-oracle/trunk/Changes
   dbd-oracle/trunk/lib/DBD/Oracle.pm

Log:
Apply patch for RT80349 from Steffen.


Modified: dbd-oracle/trunk/Changes
==============================================================================
--- dbd-oracle/trunk/Changes	(original)
+++ dbd-oracle/trunk/Changes	Tue Oct 23 05:32:20 2012
@@ -1,5 +1,13 @@
 Revision history for DBD::Oracle
 
+NEXT_VERSION
+
+  [BUG FIXES]
+
+  - Fix RT80349 - The error message in execute_for_fetch when a row fails
+    can contain the wrong error count. Thanks to Steffen Goeldner for
+    RT and patch.
+
 1.52      2012-10-19
 
  - promote 1.51_00 to official release

Modified: dbd-oracle/trunk/lib/DBD/Oracle.pm
==============================================================================
--- dbd-oracle/trunk/lib/DBD/Oracle.pm	(original)
+++ dbd-oracle/trunk/lib/DBD/Oracle.pm	Tue Oct 23 05:32:20 2012
@@ -1076,7 +1076,7 @@
     sub execute_for_fetch {
        my ($sth, $fetch_tuple_sub, $tuple_status) = @_;
        my $row_count = 0;
-       my $err_count = 0;
+       my $err_total = 0;
        my $tuple_count="0E0";
        my $tuple_batch_status;
        my $dbh = $sth->{Database};
@@ -1096,6 +1096,7 @@
            }
            last unless @tuple_batch;
 
+           my $err_count = 0;
            my $res = ora_execute_array($sth,
                                            \@tuple_batch,
                                            scalar(@tuple_batch),
@@ -1108,6 +1109,7 @@
                 $row_count = undef;
            }
 
+           $err_total += $err_count;
            $tuple_count+=@$tuple_batch_status;
            push @$tuple_status, @$tuple_batch_status
                 if defined($tuple_status);
@@ -1116,8 +1118,8 @@
 
        }
        #error check here
-       return $sth->set_err($DBI::stderr, "executing $tuple_count generated $err_count errors")
-       	   if $err_count;
+       return $sth->set_err($DBI::stderr, "executing $tuple_count generated $err_total errors")
+       	   if $err_total;
 
        return wantarray
                 ? ($tuple_count, defined $row_count ? $row_count : undef)