On Sat, Oct 24, 2009 at 5:59 AM, Peter Rabbitson <[email protected]<rabbit%[email protected]> > wrote:
> > > select u.* <http://p.id/>, count(o.id) > > from user u > > left outer join job j on j.user = u.id AND J.JOB_TYPE = 6 > > where u.location = ? > > group by u.* > (nice how Gmail turned those columns into links...) > > You can not do this natively yet. Your only option is a virtual view > resultset as described here: > > http://search.cpan.org/~ribasushi/DBIx-Class-0.08112/lib/DBIx/Class/ResultSource/View.pm<http://search.cpan.org/%7Eribasushi/DBIx-Class-0.08112/lib/DBIx/Class/ResultSource/View.pm> > Ok, thanks. Can the virtual view inherit from the user? That is, can I convince DBIC that the object returned is a real user object so I can update the object and have it written to storage? The cookbook just says that the view cannot be operated on. Obviously, it would be much more useful to have a real user object. This is not a very complex query -- I have many queries that I suspect may require custom SQL. Was there any discussion of being able to add custom SQL to a custom ResultSet class, for example? That way I could get back my user object plus any additional columns from the custom SQL. A different beast, or course, but this is something that was quite trivial to do with Class::DBI. Thanks for the help, Peter. -- Bill Moseley [email protected]
_______________________________________________ List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class IRC: irc.perl.org#dbix-class SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/ Searchable Archive: http://www.grokbase.com/group/[email protected]
