Tim Bunce <[EMAIL PROTECTED]> writes:
> sub execute_for_fetch {
> my ($fetch_tuple_sub, $tuple_status) = @_;
> while (1) {
> my @tuple_batch;
> for (my $batch_size = 10000; $batch_size-- > 0; ) {
> push @tuple_batch, $fetch_tuple_sub->() || last;
> }
> last unless @tuple_batch;
> $sth->ora_execute_array([EMAIL PROTECTED], \my @tuple_batch_status);
> push @$tuple_status, @tuple_batch_status;
> }
> }
Maybe that should be
push @tuple_batch, [ @{$fetch_tuple_sub->() || last} ];
in case $fetch_tuple_sub wants to return the same reference every time
(or document that it should not do that).
> Taking a step back for a moment... The switch from column-wise
> arrays in execute_array() to row-wise arrays in ora_execute_array()
> is interesting.
>
> Perhaps there's scope for the DBI to add a new execute_* method to
> do what ora_execute_array is doing here. Take a simple set of tuples
> (as array of tuple arrays) plus a status array.
>
> Then I could change the default execute_for_fetch method in the DBI
> to call that one. Driver authors would then have more options in
> what they override.
I was wondering... how will ora_execute_array() work with bind
attributes (ie. TYPE => xxx, ora_type => xxx, ...)?
Will there be calls to bind_param() with dummy values, like
$sth->bind_param(1, undef, { ora_type => 97 });
$sth->ora_execute_array([ ['a'], ['b'], ['c'] ], \ my @statuses);
with the OCIBindDynamic callback somehow accessing the type information?
I haven't yet the overview of the whole bind/execute implementation in
DBD::Oracle to have a firm opinion on this issues yet, really. It seems
that for ora_execute_array(), the logic in bind_param() must be split,
with the type-related part (OCIBindByName(), ...) going in
ora_execute_array(), and the value-related part (SV conversions ...) in
the OCIBindDynamic callback.
In terms of bind semantics, column-wise (using bind_param_array() and
execute_array()) seems kind of simpler than row-wise, because of the
explicit bind.
Any thoughts?
- Kristian.
--
Kristian Nielsen [EMAIL PROTECTED]
Development Manager, Sifira A/S