Re: Constraining a Class

[prev] [thread] [next] [Date index for 2005/07/12]

From: Todd Lorenz
Subject: Re: Constraining a Class
Date: 17:14 on 12 Jul 2005
This is a multi-part message in MIME format.

------=_NextPart_000_0014_01C586CA.89168F40
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Couldn't you create views for each of the company types in your table, =
and point CDBI at those?
  ----- Original Message -----=20
  From: Aaron Trevena<mailto:aaron.trevena@xxxxx.xxx>=20
  To: cdbi-talk@xxxxxx.xxxxx.xxx<mailto:cdbi-talk@xxxxxx.xxxxx.xxx>=20
  Sent: Tuesday, July 12, 2005 9:56 AM
  Subject: Re: Constraining a Class


  On 7/12/05, Tony Bowden =
<tony-cdbitalk@xxxxx.xxx<mailto:tony-cdbitalk@xxxxx.xxx>>; wrote:
  > On Tue, Jul 12, 2005 at 11:08:03AM +1000, Rick Measham wrote:
  > > I have a table 'Company' in my database. This table holds all =
manner of
  > > companies: Customers, Potential Customers, Previous Customers, =
Suppliers
  > > etc. There's an enum field that tells me which sort of company =
each row
  > > represents.
  > > I'd like to be able to create My::Data::Customer,
  > > My::Data::PotentialCustomer etc., representing each of these types =
of
  > > record in the table.
  >=20
  > This isn't really how Class::DBI works. Each class represents a =
table.
  >=20
  > However, have a look at Class::DBI::Relationship::HasVariant (from
  > CPAN). I haven't used it, so I can't speak for it, but I believe it =
does
  > something along these lines.

  I'd say you could use the IsA Relationship with Company as the
  superclass and the variants as subclasses.

  This is probably closest to what you are looking for.

  A.

------=_NextPart_000_0014_01C586CA.89168F40
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type =
content=3Dtext/html;charset=3Diso-8859-1>
<STYLE></STYLE>

<META content=3D"MSHTML 6.00.2900.2668" name=3DGENERATOR></HEAD>
<BODY id=3DMailContainerBody=20
style=3D"PADDING-LEFT: 10px; FONT-WEIGHT: normal; FONT-SIZE: 10pt; =
COLOR: #000000; BORDER-TOP-STYLE: none; PADDING-TOP: 15px; FONT-STYLE: =
normal; FONT-FAMILY: Verdana; BORDER-RIGHT-STYLE: none; =
BORDER-LEFT-STYLE: none; TEXT-DECORATION: none; BORDER-BOTTOM-STYLE: =
none"=20
leftMargin=3D0 topMargin=3D0 acc_role=3D"text" CanvasTabStop=3D"true"=20
name=3D"Compose message area"><!--[gte IE 5]><?xml:namespace =
prefix=3D"v" /><?xml:namespace prefix=3D"o" /><![endif]-->
<DIV>
<DIV>Couldn't you create views for each of the company types in your =
table, and=20
point CDBI at those?</DIV>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
  <DIV style=3D"FONT: 10pt arial">----- Original Message ----- </DIV>
  <DIV style=3D"FONT: 10pt arial"><B>From:</B> <A=20
  title=3Dmailto:aaron.trevena@xxxxx.xxx=20
  href=3D"mailto:aaron.trevena@xxxxx.xxx">Aaron Trevena</A> </DIV>
  <DIV style=3D"FONT: 10pt arial"><B>To:</B> <A=20
  title=3Dmailto:cdbi-talk@xxxxxx.xxxxx.xxx=20
  =
href=3D"mailto:cdbi-talk@xxxxxx.xxxxx.xxx">cdbi-talk@xxxxxx.xxxxx.xxx</A>=
 </DIV>
  <DIV style=3D"FONT: 10pt arial"><B>Sent:</B> Tuesday, July 12, 2005 =
9:56=20
AM</DIV>
  <DIV style=3D"FONT: 10pt arial"><B>Subject:</B> Re: Constraining a =
Class</DIV>
  <DIV><BR></DIV>On 7/12/05, Tony Bowden &lt;<A=20
  title=3Dmailto:tony-cdbitalk@xxxxx.xxx=20
  =
href=3D"mailto:tony-cdbitalk@xxxxx.xxx">tony-cdbitalk@xxxxx.xxx</A>&gt;=20
  wrote:<BR>&gt; On Tue, Jul 12, 2005 at 11:08:03AM +1000, Rick Measham=20
  wrote:<BR>&gt; &gt; I have a table 'Company' in my database. This =
table holds=20
  all manner of<BR>&gt; &gt; companies: Customers, Potential Customers, =
Previous=20
  Customers, Suppliers<BR>&gt; &gt; etc. There's an enum field that =
tells me=20
  which sort of company each row<BR>&gt; &gt; represents.<BR>&gt; &gt; =
I'd like=20
  to be able to create My::Data::Customer,<BR>&gt; &gt;=20
  My::Data::PotentialCustomer etc., representing each of these types =
of<BR>&gt;=20
  &gt; record in the table.<BR>&gt; <BR>&gt; This isn't really how =
Class::DBI=20
  works. Each class represents a table.<BR>&gt; <BR>&gt; However, have a =
look at=20
  Class::DBI::Relationship::HasVariant (from<BR>&gt; CPAN). I haven't =
used it,=20
  so I can't speak for it, but I believe it does<BR>&gt; something along =
these=20
  lines.<BR><BR>I'd say you could use the IsA Relationship with Company =
as=20
  the<BR>superclass and the variants as subclasses.<BR><BR>This is =
probably=20
  closest to what you are looking=20
for.<BR><BR>A.<BR></BLOCKQUOTE></DIV></BODY></HTML>

------=_NextPart_000_0014_01C586CA.89168F40--

Constraining a Class
Rick Measham 01:08 on 12 Jul 2005

Re: Constraining a Class
Tony Bowden 07:42 on 12 Jul 2005

Re: Constraining a Class
Aaron Trevena 16:56 on 12 Jul 2005

Re: Constraining a Class
Todd Lorenz 17:14 on 12 Jul 2005

Generated at 16:35 on 28 Jul 2005 by mariachi v0.52