Hi Monks!
I have this sub I am trying to implement that uses "fetchall_arrayref" I would like to use some other way to fetch the table, how could a use another method and still maintain the same code logic?
sub _get_users {
my $self = shift;
my $sql = "select * from my_table order by username";
$self->dbh->{PrintError} = 0;
$self->dbh->{RaiseError} = 1;
# fetchrow_hashref?
my $sth = $self->dbh->prepare($sql);
$sth->execute();
my $rs = $sth->fetchall_arrayref(
{
user_id => 1,
username => 1,
first_name => 1,
last_name => 1
}
);
return $rs;
}
Thanks for looking!