Re: internal struct for displayed outline?

From: Cannon Fodder <technews_at_invalid.sorry>
Date: Sat, 07 Oct 2000 05:17:48 GMT
Message-ID: <Pine.LNX.4.04.10010070121130.7079-100000_at_snoopy>


Thanks, I'll use this. It appears to be more flexible and efficient for adding and searching data. I think I should search for a crash course in SQL though, for problems in the future...I'll consult the faq for info sources.

Thanks again,
C.F.

On Sat, 30 Sep 2000, Steve Long wrote:

>since you require traversal in both directions, i suggest you need a
>different structure. the connect by clause in SQL provides the basic
>solution.
>
>NodeID ParentID Item
>001 null FolderA
>002 001 AFirstItem
>003 001 ASecondItem
>004 002 SubItem1ofAFirstItem
>005 002 SubItem2ofAFirstItem
>006 003 SubItem1ofASecondItem
>007 null FolderB
>
>etc...
>
>You may identify root nodes by checking where parentID is null.
>You may now traverse either direction.
>
>-- Find all root nodes (top level folders) [ level 1 ]
>SELECT item "Folder"
>FROM tree
>WHERE parentID is null;
>
>-- You may also use Oracle's pseudo column LEVEL
>
>-- Find all nodes immediately below root nodes [ level 2 ]
>SELECT item "SubFolder"
>FROM tree
>START WITH (select nodeID from tree where parentID is NULL)
>CONNECT BY PRIOR nodeID = parentID;
>
Received on Sat Oct 07 2000 - 07:17:48 CEST

Original text of this message