On Thu, Dec 01, 2005 at 07:31:11PM -0500, John Siracusa wrote:
> On 12/1/05 7:17 PM, Todd Hepler wrote:
> > Basically I'm looking for something like this snippet:
> > 
> >      @[EMAIL PROTECTED] = ();
> >      $sth->bind_columns(map { \$results{$_} } @fields);
> > 
> > wrapped in a nice little interface.
> 
> Just an unrelated tip: the above can be done a bit more idiomatically (and
> probably a teeny bit faster) like this:
> 
>     $sth->bind_columns([EMAIL PROTECTED]@fields});

Which is very like the example in the DBI docs for the bind_columns method:

  $sth->execute;
  my %row;
  $sth->bind_columns( \( @row{ @{$sth->{NAME_lc} } } ));
  while ($sth->fetch) {
      print "$row{region}: $row{sales}\n";
  }

I hope you'll agree, Todd, that there's no need for an extra module.
CPAN has more than enough DBI helper/wrapper modules already.

Tim.

Reply via email to