Re: [CDBI] Aggregate functions in Sweet?
[prev]
[thread]
[next]
[Date index for 2005/09/19]
Bill Moseley wrote:
> I've become dependent (read lazy) on CDBI::Sweet. But, now I need to
> use an aggregate function.
I don't know specifically about ::Sweet, but CDBI has always been about
mapping an object to a specific row. When using aggregate functions
there is no corresponding row in the result set.
> For example, I have a table "class" which is a class taught at some
> "location", and locations have_a "region" like "North" or "South".
>
> my $region = $class->location->region;
> print $region->name;
>
> So, now I want to have a list of regions, and show how many classes
> are available in each region. A reasonable need.
Completely reasonable, but not CDBI is not the right tool for that kind
of job. Any kind of reporting or aggregation is best done with straight
SQL/DBI. I sometimes like to include this methods in my data classes
that are CDBI based, but you might want to separate them.
--
Michael Peters
Developer
Plus Three, LP
_______________________________________________
ClassDBI mailing list
ClassDBI@xxxxx.xxxxxxxxxxxxxxxx.xxx
http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi
|
|
Re: [CDBI] Aggregate functions in Sweet?
Michael Peters 14:09 on 19 Sep 2005
|