Posted on 2006-10-29 19:34:10-08 by kez
Creating Dynamic Aarrays from SQL recordset

Will the DBIx::DataModel module work for creating the following data structure with the data returned from a database query.

Data returned by query:

id name parent_id
1 Apparel NULL
2 Adult Jerseys 1
3 Girl-Cheer 1
4 Infant Cheer 1
5 Men's Polo 1
6 Men's 2
7 Women's 2
21 Auto NULL
22 Bumper Sticker 21
23 Car Flag 21
24 Car Magnet 21
57 Trees NULL

Arrray's Created Dynamically:

Parents
@menu ( "Apparel" , "Auto", "Trees" )

Children
@apparel ( "Adult Jerseys", "Girl-Cheer", "Men's Polo")
@auto ("Bumper Sticker", "Car Flag", "Car Magnet")

Children of Children
@adult_jerseys ("Men's", "Women's")

etc...

Kevin
Direct Responses: 3400 | Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.