dbTalk Databases Forums  

nested set: algorithm for testing the integrity

comp.databases comp.databases


Discuss nested set: algorithm for testing the integrity in the comp.databases forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
alexander.buze@googlemail.com
 
Posts: n/a

Default nested set: algorithm for testing the integrity - 05-23-2007 , 03:32 AM






I'm looking for a algorithm which checks if a nested set with many
nodes and levels is correct.

I know the pear class and I have read a few tutorials, maybe there is
a mathematical solution for this test?

thx.


Reply With Quote
  #2  
Old   
lark
 
Posts: n/a

Default Re: nested set: algorithm for testing the integrity - 05-23-2007 , 08:28 AM






alexander.buze (AT) googlemail (DOT) com wrote:
Quote:
I'm looking for a algorithm which checks if a nested set with many
nodes and levels is correct.

I know the pear class and I have read a few tutorials, maybe there is
a mathematical solution for this test?

thx.

i think you're talking php.
check http://www.phpclasses.org


--
lark -- hamzee (AT) sbcdeglobalspam (DOT) net
To reply to me directly, delete "despam".


Reply With Quote
  #3  
Old   
--CELKO--
 
Posts: n/a

Default Re: nested set: algorithm for testing the integrity - 05-25-2007 , 08:01 AM



Quote:
algorithm which checks if a nested set with many nodes and levels is correct.
1) Buy a copy of TREES & HIERARCHIES IN SQL
2) Create a view called LftRgt which has all the lft and rgt values
unioned in it
3) No gaps in the numbering: (SELECT MAX(rgt) FROM Tree) = (SELECT
COUNT(*) FROM LftRgt)
4) No duplicated values: NOT EXISTS (SELECT seq FROM LftRgt GROUP BY
seq HAVING COUNT(*) > 1)
5) No overlapping (lft, rgt) pairs: an exercise for the reader




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.