my $dbh = dbh( $table );
my $sql = 'SELECT ' . join(', ', @fields) . " FROM $table";
my $sth = $dbh->prepare($sql);
$sth->execute();
my %results;
@results{@fields} = ();
$sth->bind_columns(map { \$results{$_} } @fields);
return (\%results, sub { $sth->fetch() });
#
# TODO: Use this calling code: it's very good.
#
#my ($res, $fetch) = bind_hash('users', qw( name email ));
#while ($fetch->()) {
# print "$res->{name} >$res->{email}>\n";
#}
}
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 127:
=pod directives shouldn't be over one line long! Ignoring all 3 lines of content