Not sure how many, if any, DB's support variable length data-arrays but you could always use a blob and pack it yourself. A little more work, but not as much as an exhaustive search of the DB for every node with a parent ID of xx.
The two things I've learned about relational databases are :
- Don't create artificial data structures within blobs, the DB is better at handling them than you are.
- If you have a many-to-many relationship (== variable length array in Perl), use another table with the relations in it.
In this case, this would mean having a relation table,
isChild, which would consist of two columns,
parentID and
childID. If you have a database with triggers, you can maintain the integrity with stored procedures, if not, you can at least handle node deletions gracefully with a small SQL script.