in reply to Class::DBI vs. DBIx::Class
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
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Class::DBI vs. DBIx::Class
by hrr (Monk) on Jun 25, 2006 at 14:46 UTC | |
by rafl (Friar) on Jun 25, 2006 at 15:20 UTC | |
by hrr (Monk) on Jun 25, 2006 at 16:08 UTC | |
by rafl (Friar) on Jun 25, 2006 at 20:58 UTC | |
by hrr (Monk) on Jun 25, 2006 at 21:51 UTC | |
|