[Dbix-class] DBIC hits DB thoguh using prefetch (repost)
Moritz Onken
onken at houseofdesign.de
Sun Jul 20 10:58:16 BST 2008
Am 20.07.2008 um 02:53 schrieb Matt S Trout:
> On Tue, Jul 08, 2008 at 09:47:50AM +0200, Moritz Onken wrote:
>> Hi,
>>
>> sorry for the repost, but there was no answer to my previous post.
>
> And yet you provided no new information to help us diagnose the
> problem.
>
> Hint: If you get no answer it usually means nobody could work out what
> answer you were expecting. -Always- include more info with a repost.
>
> Though as I said in reply to the previous post, try trunk. If that
> doesn't
> work, I'm sure there's a test somewhere - see why it's passing and
> your
> code isn't working ...
I've put together a test case. I tried trunk (0.08) but had no luck.
Unpack the attachment and run "perl complex01.t".
If you have DBIC_TRACE enabled you'll see something like this:
[lots of inserts and creates and sql stuff]
SELECT me.title, me.id, parents.child, parents.parent, parent.title,
parent.id FROM complex me LEFT JOIN complex_map parents ON
( parents.child = me.id ) LEFT JOIN complex parent ON ( parent.id =
parents.parent ) WHERE ( ( me.id = ? ) ) ORDER BY parents.child: '3'
# which is fine because it prefetches all data it should need
SELECT me.child, me.parent FROM complex_map me WHERE ( me.child = ? ):
'3'
# this data is already loaded!
SELECT me.title, me.id FROM complex me WHERE ( ( ( me.id = ? ) ) ): '1'
# this one too
ok 1
Thanks for any advice.
cheers,
moritz
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test4list.tgz
Type: application/octet-stream
Size: 1805 bytes
Desc: not available
Url : http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20080720/754d29c5/test4list.obj
More information about the DBIx-Class
mailing list