नीचे इस उदाहरण में:DBIx :: कक्षा उदाहरण
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 का कहना है कि इस एसक्यूएल कि उत्पन्न हो जाएगा है:
# 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
लेकिन रसोई की किताब के बाकी हिस्सों से, मैं यह मानने के लिए नेतृत्व किया गया है कि क्वेरी केवल सीडी। * का चयन करेगी, जब तक कि निश्चित रूप से प्रीफ़ेच का उपयोग नहीं किया जाता था:
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
किसी को भी या तो मैं यहाँ क्या याद कर रहा हूँ मुझे समझा सकता है:के नीचे बयान की ओर जाता है कि मुझे इस पर विश्वास करना है? या नहीं? आपका बहुत बहुत धन्यवाद!
तो एसक्यूएल के ऊपर उदाहरण में केवल "चयन सीडी। *" में बदला जाएगा? समकक्ष एसक्यूएल के लिए – srchulo
- यह सही है – stevenl