[Catalyst] CDBI::Sweet wishlist

James Tolley james at bitperfect.com
Fri Jul 8 12:42:44 CEST 2005


> If there's anything you would like to be able to do with cdbi/sweet but
> currently can't I'd be extremely interested in use cases and for
preference
> samples of "it would be nice if I can write this code and have it work".

You asked for it! :-) This is similar to my understanding of what
Rob::Database (posted recently) does:

I'd like to be able to provide a minimal query, and have all of the joins
happen automatically, based upon the relationships defined through CDBI.
Based upon the CDBI perldoc examples:

my @artists = MyApp::Artist->select({
  year => '2001',  # unambiguous fieldname
  style => 'Blues', # arbitrary number of joins (artist -> cd ->
style_ref -> style)
},     { order_by => 'artistid DESC' });

The style field might be a little over the top, since there are two style
fields in the db: style_ref.style and style.style, but you get the idea...
of course, we _could_ say that the arg to style ('Blues') isn't numeric, so
it must be referring to style.style, which holds chars...?

Of course, the icing on the cake would be if then:

my @cds = $artists[0]->cds; # only matching cds returned.

But I can't quite work out whether or not that would mean that only certain
styles would be returned from $cd->styles. That wouldn't be DWIMmish...

James




More information about the Catalyst mailing list