I was hoping to use the acs_objects use of tree_sortkey to create a hierarchy. I just use the context_id to point to the parent object, and the tree_sortkey gets updated like magic.
Here is some example data from acs_objects:
object_id | tree_sortkey
-----------+--------------------------------------------------
370 | 00000100000000000000001100000000
371 | 0000010000000000000000110000000000000000
372 | 000001000000000000000011000000000000000000000000
374 | 000001000000000000000011000000000000000000000001
373 | 0000010000000000000000110000000000000001
375 | 00000100000000000000001100000001
376 | 0000010000000000000000110000000100000000
I used the following db_multirow to create a visual representation of the hierarchy:
db_multirow -extend {
indent
} categories blog_categories "
select
c.*,
o.context_id,
o.tree_sortkey
from
blog_categories c,
acs_objects o
where
c.category_id = o.object_id
order by
o.tree_sortkey" {
set varbit_length [string length $tree_sortkey]
set indent_amount [expr ($varbit_length -32) / 4]
set indent [string repeat "." $indent_amount]
}
Each varbit is at least 32 chars long, and each child varbit is an additional 8 chars, so the above code adds two indent chars per child.
Now the question: it looks like this implimentation only allows for 256 children, or 8 bits. It this true, or is there more magic hidden in the pl code which maintains this?