[ale] Organizing data

Chris Fowler cfowler at outpostsentinel.com
Tue Apr 27 20:09:57 EDT 2004


I've created a huge SQL statement to get everything out of my database
that I need in one query.  I need to figure out what kind of structure
to user to store the data in perl.

Here is the output:

http://www.linxdev.com/out.html


The structure looks like this.

alarm->location->notify_group->esc_group->user

Everything is 1 to 1 up to esc_group.  A notify_group could
have (n) esc_groups and an esc_group could have (n) users.  In the
out.html file you'll see that.

I thought about going through the database creating object like
AC::User, AC::Esc_Gropup, etc for each piece of data.  I would then
walk through my list of groups doing selects to get the proper data.

The select statement that generated that out.html actually gets me the
data I need not all of it.  So it is possible there are esc_groups and
users in the database that do not show up in the report.  So I do not
have to create user objects for all users in the database.  To keep from
doing a AC::User->new($user_user_id) for each user in that list I
thought about creating a hash of objects.

$users{$user_user_id} = AC::User->new($user_user_id, $user_email) if not
$users($user_user_id);

This way I will not create any unecessary objects.  

Would this be the best way to group that data?  I'm trying to do it in
as few cycles as possible because I have no idea how big that report can
get.

Thanks,
Chris




More information about the Ale mailing list