Re: Stored Procedure Array

2001-11-12 Thread Ronald J Kimball

On Mon, Nov 12, 2001 at 06:50:14PM +0100, Benoit Rey wrote:
 I have a stored procedure wich has an array of values as entry parameter.
 
 Is it possible with DBI to bind an array  @tab ?
 
 
 For example :
 
 $sti=$dbi-prepare(BEGIN .$PackageNameOracle..myProcedure (:1,:2,:3);
 END;);
 
 $sti-bind_param(1, $var1);
 $sti-bind_param(2, @tab);  ???
 $sti-bind_param_inout(3, \$var2, 4);
 
 $sti-execute;
 
 If it's possible how to do it?

It is not possible.  You have to bind each placeholder's value separately.

You could do something like this, to avoid repeated code:

$p = 0;
$sti-bind_param(++$p, $var1);
foreach (@tab) {
  $sti-bind_param(++$p, $_);
}

Of course, you'll have to make sure @tab holds the correct number of
values.


Ronald



Re: Stored Procedure Array

2001-11-12 Thread Dean Arnold

 On Mon, Nov 12, 2001 at 06:50:14PM +0100, Benoit Rey wrote:
  I have a stored procedure wich has an array of values as entry parameter.
  
  Is it possible with DBI to bind an array  @tab ?
  
  
  For example :
  
  $sti=$dbi-prepare(BEGIN .$PackageNameOracle..myProcedure (:1,:2,:3);
  END;);
  
  $sti-bind_param(1, $var1);
  $sti-bind_param(2, @tab);  ???
  $sti-bind_param_inout(3, \$var2, 4);
  
  $sti-execute;
  
  If it's possible how to do it?
 
 It is not possible.  You have to bind each placeholder's value separately.
 
 You could do something like this, to avoid repeated code:
 
 $p = 0;
 $sti-bind_param(++$p, $var1);
 foreach (@tab) {
   $sti-bind_param(++$p, $_);
 }
 
 Of course, you'll have to make sure @tab holds the correct number of
 values.
 
 
 Ronald

I'm not certain that addresses Mssr. Rey's issue. He only has 3 params,
the 2nd of which is an array. However, I'm afraid the response to his inquiry
remains the same: at present this is not possible.

Since I've recently seen this issue popping up here again, as well as having been
directly contacted by a few folks, I'll drag this dead horse out again:

Are we any closer to array binding support ? Is there anything else I can
do (aside from my DBD::ODBC hacks, and occasional lobbying) to
move this issue forward ? I wish I had resources to sponsor the activity,
but alas I'm bootstrapping my own efforts right now.

Would it be considered a gross violation of net ettiquette for me to repackage
my DBD::ODBC hack as, say, DBD::ODBCAry, and post it to CPAN ?
I'd rather not generate a fork unneccesarily, but it is approaching a year
since I first reported my results, and it would be a one-shot posting
(other than serious bug fixes), to be obsoleted once DBD::ODBC
provides this capability.
While I can't assure Benoit that my hack will address his particular
issue, it should address more general application issues I've seen
raised here over the past few months (for those using DBD::ODBC,
of course).

Regards,
Dean Arnold