Class::DBI has_a() relationships with multi-value keysby MrCromeDome (Deacon)
|on Oct 29, 2004 at 15:29 UTC||Need Help??|
MrCromeDome has asked for the wisdom of the Perl Monks concerning the following question:
I've been working in my spare time on an e-commerce site. I always try to dabble with something completely new in each project, and in this one, it was Class::DBI. And it has been pretty cool and useful :) I've had significant enough success with it that I decided to start using Class::DBI for my projects at my Real Job. And that is where the "fun" started.
In my side-project, every one of my child tables is connected to its parent table by a single ID value. Unfortunately, I am not so lucky with my projects at work. To elaborate, our database tracks information about taxable property, and it tracks it by year. So our master table looks something like this:
parcel_number and parcel_year makes up the primary key for this table.
Our child tables then look like this:
where parcel_number and parcel_year is a foreign key to our parcel_year table.
I've been over the POD for Class::DBI, super-searched the archives, and Googled for a while, but I haven't been able to find (or extrapolate what I need from what I've read) how to make Class::DBI's has_a() function inflate two columns to a single object. Has anyone done this? Is it possible? If so, how is it done?
Before someone offers the suggestion, it is not at all feasible to change the structure of the tables. It's been a consideration for future versions of our product, but it is simply not feasible or an option at this time.
Thanks for whatever help you can offer! :)