my $rs = $schema->resultset('CD')->search(
{
'artist.name' => 'Bob Marley'
'liner_notes.notes' => { 'like', '%some text%' },
},
{
join => [qw/ artist liner_notes /],
order_by => [qw/ artist.name /],
}
);
DBIx cookbook이 생성 될 SQL은 말한다 :
# Equivalent SQL:
# SELECT cd.*, artist.*, liner_notes.* FROM cd
# JOIN artist ON cd.artist = artist.id
# JOIN liner_notes ON cd.id = liner_notes.cd
# WHERE artist.name = 'Bob Marley'
# ORDER BY artist.name
그러나 요리 책의 나머지
, I '쿼리가 CD를 선택할 것이라고 믿고 리드하고했습니다 * 물론 프리 페치의과 같이 사용하지 않는 :.my $rs = $schema->resultset('CD')->search(
{
'artist.name' => 'Bob Marley'
'liner_notes.notes' => { 'like', '%some text%' },
},
{
join => [qw/ artist liner_notes /],
order_by => [qw/ artist.name /],
prefetch => [qw/ artist liner_notes/],
}
);
다음은 저를 믿게하는 성명서입니다 :
[Prefetch] allows you to fetch results from related tables in advance
아무도 나에게 여기에 실종 된 내용을 설명해 줄 수 있습니까? 안 그래요? 고마워요!
위 예제에서 sql은 "SELECT cd. *"로 변경됩니다. 동등한 sql에 대해 – srchulo
- 맞습니다. – stevenl