APM: DBI helper packages
Wayne Walker
wwalker at broadq.com
Thu Sep 11 09:02:42 CDT 2003
Until this week I was sold on Class::DBI. It creates a nice clean
object wrapper around a database table for you in 3 lines of code.
I've found a few things in it that I don't like about Class::DBI.
SELECT return data is an array of objects rather than an array
of hashrefs. (used to be the latter)
Complex, multi-table SELECTs are near impossible to handle.
I'm leaning towards going back to DBIx::Broker which simply removesall
instances of this in your code:
# Now retrieve data from the table.
my $sth = $dbh->prepare("SELECT * FROM foo");
$sth->execute();
while (my $ref = $sth->fetchrow_hashref()) {
push @results, $ref;
}
$sth->finish();
(and all the missing checks for prepare or execute failure)
and replaces it with things like:
@query_results = $db->select_all( \@desired_tables, $WHERE_clause, $hash_or_not );
Does anyone have something else that they use that makes more sense?
Remember - big ugly multiple table SELECTs.
--
Wayne Walker
www.broadq.com :) Bringing digital video and audio to the living room
More information about the Austin
mailing list