You can:

  select => [ 'myrel.othercol', ..
  as => ['somename' , ..

or even:
  as => ['myrel.somecol', .. which work like prefetch

Jess


On Tue, 06 Jan 2009 09:20:25 -0000, Martinc <[email protected]> wrote:


Thanks.  I think I tried that (of course I don't have any notes...)

There didn't appear to be a way to get fields from joined tables referred to
using select/as to inflate.


Hu Hailin wrote:

Hi, Martin

2) select/as could help, but not convenient. and also i think you knew
it already.

On Tue, Dec 23, 2008 at 8:10 PM, Martinc <[email protected]>
wrote:

First post ... be gentle.

I've resorted to using DBIx::Class::ResultSet 'from' in a search.
There's an outer join with an IN list in an ON clause.
Being greedy, I want to prefetch too.

The only way I've got it to 'work' is to violate encapsulation and not
respect the privacy of the module as follows:

 my $rs = $result_set->search(
   {
     ... criteria ...
   },
   {
     prefetch => ... entities to prefetch ...
   }
 );
 $rs->_resolved_attrs();
 $rs->{_attrs}->{from} = ... manual FROM clause ...

 while ( $rs->next )
 {
   ...
 }

The manual 'from' clause ensures all the prefetched tables are included
as
specified in prefetch.

Questions:

1) Is there a way to mix prefetch and manual 'from' that does not require
the hack above.
2) I don't need all the columns in the underlying (nested) tables, can I
prefetch a subset of columns?

Version is 0.08009.

Regards,

Martin.
--
View this message in context:
http://n2.nabble.com/Prefetch-and-From-tp1693458p1693458.html
Sent from the DBIx-Class mailing list archive at Nabble.com.


_______________________________________________
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]




--
islue

_______________________________________________
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]






--
Using Opera's revolutionary e-mail client: http://www.opera.com/m2/

_______________________________________________
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]

Reply via email to