in reply to DBI prepare and function recursion

You don't specify which database you're using. Some database (like Oracle) have the CONNECT BY feature, which handles flattened parent-child relationships in the same table. If you can, you might want to look at that.

------
We are the carpenters and bricklayers of the Information Age.

The idea is a little like C++ templates, except not quite so brain-meltingly complicated. -- TheDamian, Exegesis 6

Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.

Replies are listed 'Best First'.
Re: Re: DBI prepare and function recursion
by simon.proctor (Vicar) on Oct 07, 2003 at 15:50 UTC
    I'm using MySQL. This is for Net::FTPServer so that when a directory is created/deleted I can recreate the nested set listings as well as the lineage.

    For serving the files, I'm using the lineage field so that I can do fast lookups to determine if a file exists on the server. In other words the path ends with a file, remove that and I have a lineage which I can do a lookup on. If I find that lineage then I get the directory ID and find all files in that folder that match my filename. If I don't find it - 404, if I do I continue processing.

    A little convoluted but its WIP atm. The concept is that dirs won't be created often but files will.

    If it moves to anything, it will be SQL Server.