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.
signature.asc
Description: Digital signature
_______________________________________________ List: [email protected] Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[email protected]/ Dev site: http://dev.catalyst.perl.org/
