in reply to How to display all the content of the database?
Just a wild thought: why would one like/need to have so many different tables (one for each level)? I would rather have one table which in each record would hold its own ID, its level number (say: section = 1; department = 2; ...), its name and the ID-number of its parent (and any other info you need to store for this entity.
Traversing such a structure or selecting would be rather simple with the help of some well chosen SQL-queries:
SELECT name FROM organization WHERE level = 3 and parent = 10
would give you all level 3 entities which are overseen by entity 10.
Finding out how deep your organization is, is as simple as finding the maximum of the level numbers.
You could store meta-data about the levels (not the individual entities) in a separate table, the ID of which is of course the level number, ... etc. etc.
No need to access the meta-data of the database and you can implement it in any type of database and use DBI::DBD in a portable way.
Of course if the structure of your organization is much more complex, you can always try to catch it in an XML-structure, which is more flexible but more difficult to use.
CountZero
"If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: How to display all the content of the database?
by osama (Scribe) on Jan 09, 2003 at 22:22 UTC |