1. I can't find the explicit reference in the ODBC docs, but
I'm pretty certain array binding requires 3.0 or higher.
2. Again, what of SQL ARRAY types ? How does one
bind a SQL ARRAY type via bind_param() or execute()
if arrayrefs already map to parameter arrays ?
I appreciate the desire for code brevity, but we need to be
careful not to paint ourselves into a corner by overloading
too much...
Regards,
Dean Arnold
----- Original Message -----
From: "Neil Lunn" <[EMAIL PROTECTED]>
To: "'Jeff Urlwin'" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Thursday, August 09, 2001 6:32 PM
Subject: RE: array binding (was: RE: Call for testers: Array binding via DBD::ODBC)
>
> >-----Original Message-----
> >From: Jeff Urlwin [mailto:[EMAIL PROTECTED]]
> >Sent: Friday, August 10, 2001 3:13 AM
> >To: Neil Lunn; [EMAIL PROTECTED]
> >Cc: Dean Arnold; 'Tim Bunce'
> >Subject: RE: array binding (was: RE: Call for testers: Array
> >binding via
> >DBD::ODBC)
> >
> >
> >I think you are missing the point, or of course, I could be <G>.
>
> No actually I was talking about other users interpretations of an array
> being bound to a single placeholder, and that they could presume a
> horizontal rather than vertical expansion. A horizontal expansion isn't what
> is being talked about but with the number of times that's been posted to
> dbi-users, count on it being interpreted that way.
>
> >
> >I believed that array binding would be for a case to batch
> >multiple updates,
> >so instead of:
> >
> >@ary = (1,2,3)
> >$sql = qq{insert into foo (bar1) values (?)};
> >$sth = $dbh->prepare($sql);
> >foreach $el @ary {
> > $sth->bind_param(1, $el);
> > $sth->execute;
> >}
> >
> >you would have:
> >
> >@ary = (1,2,3)
> >$sql = qq{insert into foo (bar1) values (?)};
> >$sth = $dbh->prepare($sql);
> >$sth->bind_param(1, @ary); # insert 3 values...
> >$sth->execute;
>
> I think that:
>
> $sth->bind_param(1, \@ary);
>
> Would be more appropriate to make the distinction, as it would then be a
> list element and not a list within the function call.
>
> Now to the real point. So really, are bind_col_array and bind_param_array a
> requirement as per Dean's orginal discussion point or should this be
> generally expected in the DBI spec for bind_column and bind_param.
>
> Certainly even a statement like:
>
> $sth->prepare(qq{insert into foo values(?,?,?)});
> $sth->execute(\@a,\@b,\@c);
>
> could be just as acceptable as it would be a single row insert, not
> requiring an explicit call to bind_param but rather the binding of paramters
> is checked by the call to execute. The distinction here is that the paramter
> bound is an array ref.
>
> As stated before, I think I begin to sway towards the all or nothing
> approach. Rather than implementing functions to the DBI, it would be better
> to use bind_columns and bind_params accepting that an array ref means
> binding for mutltiple rows. Of course, this means changing code for drivers
> to accomodate this.
>
> I guess the main point for discussion is how many drivers (DBI, or ODBC) can
> provide many rows of fetch or insert at the CLI. After this, how do you
> determine if the driver being used can do this or not?
>
> --Neil
>
> __________________________________________________________________________
> Please Note :
> Only the intended recipient is authorised to access or use this e-mail.
> If you are not the intended recipient, please delete this e-mail and notify
> the sender immediately. The contents of this e-mail are the writer's
> opinion and are not necessarily endorsed by the Gunz Companies
> unless expressly stated.
>
> We use virus scanning software but exclude all liability for viruses or
> similar in any attachment.
>
>