[Catalyst] catalyst
tutorial: MyAppDB/Book.pm vs. MyApp/Model/Book.pm
Daniel Hulme
st at istic.org
Tue May 15 21:00:28 GMT 2007
On Tue, May 15, 2007 at 12:37:57PM -0700, mla wrote:
> Daniel Hulme wrote:
> >On Tue, May 15, 2007 at 01:24:17PM +0100, Matt S Trout wrote:
> >>On Tue, May 15, 2007 at 03:47:57AM -0700, mla wrote:
> >>>I like how if you fetch columns that don't exist in the table
> >>>the object becomes read-only by default.
> >>That's neat, although I prefer tools that presume I know that I'm doing.
> >
> >Why would you want to fetch columns that don't exist in the table?
...
> In the read-only case it would be more like this:
>
> my @users = Try::User->find_by_sql(qq{
> SELECT first_name
> ,last_name
> ,num_posts
> FROM users
> LEFT JOIN (
> SELECT user_id
> ,count(*) AS num_posts
> FROM posts
> GROUP BY user_id
> ) USING (user_id)
> });
I see. I totally misunderstood what you meant by "columns that don't
exist in the table". I didn't realise you meant columns computed by the
RDBMS.
Thanks for clueing me in.
--
Pray remember that Bacchus was a warrior, and that his armies had little
fighting to do, because wherever he appeared he taught the cultivation
of the vine to the grateful and submissive natives. -- J.B. Morton
http://surreal.istic.org/ There is no need to shout.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.scsys.co.uk/pipermail/catalyst/attachments/20070515/7d74535a/attachment.pgp
More information about the Catalyst
mailing list