[Catalyst] Mason + DBI + Catalyst?

Matt S Trout dbix-class at trout.me.uk
Tue May 26 16:57:01 GMT 2009


On Tue, May 26, 2009 at 01:14:18AM +0200, Daniel Carrera wrote:
> I hesitate to make predictions like this. I don't know DBIC, and you 
> don't know my queries. I know that I find SQL no harder than Perl, and 
> that I appreciate being able to experiment with queries with phpMyAdmin. 
> So I can't help but wonder if it really makes sense to use a Perl module 
> to write the SQL for me rather than write the SQL directly. How would 
> you tell DBIC to use a sub query or to use a temporary table? Is it hard?

If you can't make DBIC produce the exact SQL you would have written by hand,
that's a missing feature in DBIC - at least so far as the development team
is concerned.

I often prototype queries by fiddling at the SQL level and then rewrite them
into DBIC syntax afterwards - though equally as often I fire up a Devel::REPL
re.pl and play around with resultsets with DBIC_TRACE on so it shows me the
queries as it runs them.

DBIx::Class -does- have a learning curve, but that's because it's an ORM
written by people who actually like SQL and the relational model - so once
you get to grips with it you should be able to write DBIC code and be able
to see the SQL that's going to eventually be executed in your head, except
be typing a lot less - and be able to use resultset chaining to put complex
queries together in a piecemeal, reusable fashion.

-- 
        Matt S Trout         Catalyst and DBIx::Class consultancy with a clue
     Technical Director      and a commit bit: http://shadowcat.co.uk/catalyst/
 Shadowcat Systems Limited
  mst (@) shadowcat.co.uk        http://shadowcat.co.uk/blog/matt-s-trout/



More information about the Catalyst mailing list