I strongly suggest using DBIx::Class.
It learned a lot from the mistakes Class::DBI made and also has a vast amount of features Class::DBI doesn't have.
My favourite is the concept of ResultSets. For example can put together your queries piece by piece:
my $persons = $schema->resultset('Person'); my $active_persons = $person->search({ active => 1 });
Now you can either iterate over the results of those two resultset..
while (my $person = $person->next) { ...; }
.. or get a list of objects, representing rows, back..
my @person_objs = $person->all;
.. or do further searches..
$active_persons->search({ writeup_comment.title => 'Foo', }, { join => { writeup => 'writeup_comment' }, prefetch => 'writeup', }); # gets you all persons with have recieved a comment with the title 'Fo +o' for one of their writeups, for example
.. or do a related_searche to get a resultset associated with another table or view, which are somehow connected to the current resultset:
my $writeups = $active_persons->search_related('Writeup');
Note that SQL statements are only executed when it's actually needed, which makes DBIx::Class quite performant.
Even if DBIx::Class still misses some features one might expect (subqueries, triggers, ...) I think it's already quite stable and I use it for production in several places.
Cheers, Flo
In reply to Re: Class::DBI vs. DBIx::Class
by rafl
in thread Class::DBI vs. DBIx::Class
by hrr
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |