I thought this nntp gateway worked in both directions, but apparently it is
read only. I guess that
explains I no one ever responds to my posts (or maybe I just never say
anything worth responding to...)
So I'm copying and pasting below what I tried to post on perl.dbi.dev.
Martin J. Evans wrote:
On Wed, 2006-09-06 at 13:16 -0400, John Scoles wrote:
> Hi Martin.
> I have been following it closely but I have no cycles this week to work
on
> it.
> >This rendered execute_array with DBD::Oracle useless to me. However,
> >looking at
> > DBD::Oracle and OCI I've discovered OCI can return the total rows
affected
> > (which I want) and in fact due to a bug in DBD::Oracle
execute_for_fetch
> > currently returns the total rows affected instead of the number of
rows
> > affected.
Sorry, I meant, returns the total rows affected instead of the total
number of tuples executed.
Hi Martin,
I'm a little skeptical about what you are using this number for (if a bulk
update can go wrong
without throwing a database error, surely it can go wrong while accidentally
returning the right
number of rows too, no?). But anyway, I think it will be fairly easy to
implement, but I am a little
unclear on what should happen in case of an error. This replacement for
Oracle.pm's execute_for_fetch
is my best guess:
sub execute_for_fetch {
my ($sth, $fetch_tuple_sub, $tuple_status) = @_;
my $row_count = 0;
my $tuple_count=0; ###NEW
my $batch_size = ($sth->{ora_array_chunk_size} ||= 1000);
my $tuple_batch_status;
if(defined($tuple_status)) {
@$tuple_status = ();
$tuple_batch_status = [ ];
}
while (1) {
my @tuple_batch;
for (my $i = 0; $i < $batch_size; $i++) {
push @tuple_batch, [ @{$fetch_tuple_sub->() || last} ];
}
last unless @tuple_batch;
my $res = ora_execute_array($sth,
[EMAIL PROTECTED],
scalar(@tuple_batch),
$tuple_batch_status);
if(defined($res) && defined($row_count)) {
$row_count += $res;
} else {
$row_count = undef;
}
[EMAIL PROTECTED]; ###NEW
push @$tuple_status, @$tuple_batch_status
if defined($tuple_status);
}
return () unless defined $row_count; ##NEW
return $tuple_count unless wantarray; ##NEW
return $tuple_count, $row_count; ##NEW
}
Xho