Question on how to implement Class::DBI with crossover tables..

[prev] [thread] [next] [Date index for 2005/03/02]

From: d. Taylor Singletary
Subject: Question on how to implement Class::DBI with crossover tables..
Date: 17:37 on 02 Mar 2005
--=-y7U6DqOtYjjP/VfaFq6Z
Content-Type: text/plain
Content-Transfer-Encoding: 7bit


Hi there,

New to the list and new to Class::DBI. I've read through the
documentation and tutorials and they all seem to assume that related
tables/objects would have the related fields within the tables...

that doesn't make much sense. Here's the way we do relationships around
here:

We'll have a table called CONTACT with a primary key of CTCTID.
We'll have a table called CUSTOMER with a primary key of CSTMRID.
We'll have a table called VENDOR with a primary key of VNDRID.

Then we'll have two crossover tables:
XCONCUST with a primary of XCONCUSTID, with the fields CTCTID & CSTMRID
tying the records together. 
XCONVEN with a primary key of XCONVENID, with the fields CTCTID & VNDRID
tying the records together.

Is it possible with Class::DBI to semi-transparently manage the
crossover tables and still assert relationships like Vendor::Contact,
Customer::Contact? How is that done? When accessing these objects I
don't want to have to think about maintaining the relationships in the
crossover tables at all. Customers can have many contacts, Vendors can
have many contacts. 

Thanks for a push in the right direction on this. 

d. Taylor Singletary

--=-y7U6DqOtYjjP/VfaFq6Z
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 7bit

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
  <META NAME="GENERATOR" CONTENT="GtkHTML/3.5.6">
</HEAD>
<BODY>
<BR>
Hi there,<BR>
<BR>
New to the list and new to Class::DBI. I've read through the documentation and tutorials and they all seem to assume that related tables/objects would have the related fields within the tables...<BR>
<BR>
that doesn't make much sense. Here's the way we do relationships around here:<BR>
<BR>
We'll have a table called CONTACT with a primary key of CTCTID.<BR>
We'll have a table called CUSTOMER with a primary key of CSTMRID.<BR>
We'll have a table called VENDOR with a primary key of VNDRID.<BR>
<BR>
Then we'll have two crossover tables:<BR>
XCONCUST with a primary of XCONCUSTID, with the fields CTCTID &amp; CSTMRID tying the records together. <BR>
XCONVEN with a primary key of XCONVENID, with the fields CTCTID &amp; VNDRID tying the records together.<BR>
<BR>
Is it possible with Class::DBI to semi-transparently manage the crossover tables and still assert relationships like Vendor::Contact, Customer::Contact? How is that done? When accessing these objects I don't want to have to think about maintaining the relationships in the crossover tables at all. Customers can have many contacts, Vendors can have many contacts. <BR>
<BR>
Thanks for a push in the right direction on this. <BR>
<BR>
d. Taylor Singletary
</BODY>
</HTML>

--=-y7U6DqOtYjjP/VfaFq6Z--

Question on how to implement Class::DBI with crossover tables..
d. Taylor Singletary 17:37 on 02 Mar 2005

Creation of composite objects automatically
Peter Speltz 22:32 on 02 Mar 2005

Generated at 00:32 on 04 Mar 2005 by mariachi v0.52