in reply to (OT?) Recursive sql queries?
Note that there are several ways of representing a tree structure inside a relational database:package TreeNode; use base 'Class::DBI'; __PACKAGE__->table('forrest'); __PACKAGE__->has_a(parent=>TreeNode); __PACKAGE__->has_many(children=>TreeNode);
Each of those representations has it's advantages and it's disadvantages, depending on what you intend to do with the tree once you have it in the database.
Whichever method you choose to implement, I am willing to bet the code will be much cleaner (more readable and easier to debug) if you use Class::DBI than if you use straight SQL in the code.
|
---|