2009/5/2 Matt S Trout <dbix-cl...@trout.me.uk>

> On Fri, May 01, 2009 at 04:19:32PM -0700, Morgon Hed wrote:
> > What I want is a way to "lazily" only load those objects from the
> database that are actually needed to process a message and so ideally I
> would like each object to be able to get a ref to another in a uniform way
> without having to know wether or not the object has already been loaded...
>
If you always traverse the graph in the same direction you can generally
> avoid
> loading things more than once anyway - but the other thing is to keep a
> hash of objects yourself, and just forcibly destroy them on end of request
> -
>

I've had success using Graph to build directed graphs of unique objects from
DBIC
http://search.cpan.org/perldoc?Graph
I used it for authorisation role inheritance trees as I wanted the SQL to be
portable beyond Oracle's SQL tree extensions.
I got the idea from some "incomplete XML" path matching code but the same
technique should work.

Regards, Peter
http://perl.dragonstaff.co.uk
_______________________________________________
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/dbix-class@lists.scsys.co.uk

Reply via email to