[Catalyst] More complex Class::DBI::Sweet usage?
tjc at wintrmute.net
Fri Jul 1 11:36:41 CEST 2005
On Thu, Jun 30, 2005 at 11:32:51PM -0400, Perrin Harkins wrote:
> On Thu, 2005-06-30 at 16:44 -0700, Jules Agee wrote:
> > Would it make sense to use Class::DBI::Sweet in this example? If not,
> > what approach would you use? I've got five tables, and the ipaddr and
> > login tables are populated automatically from log files. I want to be
> > able to see what systems a particular user logs in from, and which users
> > are logging in from a particular system, either way.
> What problem are you trying to solve? How to write a report with
> Class::DBI? Ideally, don't use Class::DBI for it -- just write the SQL.
> If you really want to use Class::DBI, and the end result can be a list
> of objects of one type, add a custom query using set_sql to the class of
> the object you want to get back. For example, add a search_by_system()
> query to your User class. It should do the joins across the tables in
In Catalyst, where is the preferred place to setup custom queries for
autogenerated (via C::M::CDBI) classes?
In a package named exactly the same, so you can do __PACKAGE__->set_sql(), or
in a different package (ie. via C::M::CDBI::Foo->set_sql()) which must be
run after the setup stage of C::M::CDBI)?
(Porting from Maypole)
Turning and turning in the widening gyre/The falcon cannot hear the falconer;
Things fall apart, the centre cannot hold/Mere anarchy is loosed upon the world
(gpg --keyserver www.co.uk.pgp.net --recv-key 897E5FF3)
More information about the Catalyst