No way to instantiate two related CDBI classes at once, is there?

[prev] [thread] [next] [Date index for 2004/08/09]

From: Ian McDonald-ONLINE
Subject: No way to instantiate two related CDBI classes at once, is there?
Date: 10:22 on 09 Aug 2004
This is a multi-part message in MIME format.

------_=_NextPart_001_01C47DFA.D13BD308
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

Hiya,

I'm trying to reduce the number of SQL calls.

To use the example from the Beginner's Guide:

Music::Artist->might_have(person=3D> Music::Person =3D> gw/gender haircol=
or
birthdate/)

Now I'd like to do something like:

select ARTIST.*, PERSON.*
	from ARTIST, PERSON
	where
		ARTIST.ARTISTID =3D PERSON.ARTISTID AND
		PERSON.HAIRCOLOR =3D 'BLACK';

And load both ARTIST and PERSON objects. I accept that this method would
only return Music::Artist objects, but hope I could get at the
Music::Person objects without triggering another database call.=20

Is this an option?

Thanks,

Ian

--
Dr Ian McDonald
Software Engineer, Interactive Drama & Entertainment
Conquer the Earth! - The Doctor Who monsters game
The Rome Game: Do as the Romans do. Lie, cheat, and steal.
A300, 56-58 Wood Lane (CH), London W12 7SB
020 822 56162
ian.mcdonald@xxx.xx.xx / "Ian McDonald-ONLINE" (not "Ian MacDonald")



http://www.bbc.co.uk/ - World Wide Wonderland

This e-mail (and any attachments) is confidential and may contain
personal views which are not the views of the BBC unless specifically
stated.
If you have received it in error, please delete it from your system.=20
Do not use, copy or disclose the information in any way nor act in
reliance on it and notify the sender immediately. Please note that the
BBC monitors e-mails sent or received.=20
Further communication will signify your consent to this.

------_=_NextPart_001_01C47DFA.D13BD308
Content-Type: text/html;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; charset=3Dus-asci=
i">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version 6.0.6503.0=
">
<TITLE>No way to instantiate two related CDBI classes at once, is there?<=
/TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->

<P><FONT SIZE=3D2 FACE=3D"Arial">Hiya,</FONT>
</P>

<P><FONT SIZE=3D2 FACE=3D"Arial">I'm trying to reduce the number of SQL c=
alls.</FONT>
</P>

<P><FONT SIZE=3D2 FACE=3D"Arial">To use the example from the Beginner's G=
uide:</FONT>
</P>

<P><FONT SIZE=3D2 FACE=3D"Arial">Music::Artist-&gt;might_have(person=3D&g=
t; Music::Person =3D&gt; gw/gender haircolor birthdate/)</FONT>
</P>

<P><FONT SIZE=3D2 FACE=3D"Arial">Now I'd like to do something like:</FONT=
>
</P>

<P><FONT SIZE=3D2 FACE=3D"Arial">select ARTIST.*, PERSON.*</FONT>

<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=3D2 FACE=3D"Ari=
al">from ARTIST, PERSON</FONT>

<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=3D2 FACE=3D"Ari=
al">where</FONT>

<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp; <FONT SIZE=3D2 FACE=3D"Arial">ARTIST.ARTISTID =3D PERSON=
=2EARTISTID AND</FONT>

<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp; <FONT SIZE=3D2 FACE=3D"Arial">PERSON.HAIRCOLOR =3D 'BLAC=
K';</FONT>
</P>

<P><FONT SIZE=3D2 FACE=3D"Arial">And load both ARTIST and PERSON objects.=
 I accept that this method would only return Music::Artist objects, but h=
ope I could get at the Music::Person objects without triggering another d=
atabase call. </FONT></P>

<P><FONT SIZE=3D2 FACE=3D"Arial">Is this an option?</FONT>
</P>

<P><FONT SIZE=3D2 FACE=3D"Arial">Thanks,</FONT>
</P>

<P><FONT SIZE=3D2 FACE=3D"Arial">Ian</FONT>
</P>

<P><FONT COLOR=3D"#808080" SIZE=3D1 FACE=3D"Arial">--</FONT>

<BR><FONT COLOR=3D"#808080" SIZE=3D1 FACE=3D"Arial">Dr Ian McDonald</FONT=
>

<BR><FONT COLOR=3D"#808080" SIZE=3D1 FACE=3D"Arial">Software Engineer, In=
teractive Drama &amp; Entertainment</FONT>

<BR><FONT COLOR=3D"#808080" SIZE=3D1 FACE=3D"Arial">Conquer the Earth! - =
The Doctor Who monsters game</FONT>

<BR><FONT COLOR=3D"#808080" SIZE=3D1 FACE=3D"Arial">The Rome Game: Do as =
the Romans do. Lie, cheat, and steal.</FONT>

<BR><FONT COLOR=3D"#808080" SIZE=3D1 FACE=3D"Arial">A300, 56-58 Wood Lane=
 (CH), London W12 7SB</FONT>

<BR><FONT COLOR=3D"#808080" SIZE=3D1 FACE=3D"Arial">020 822 56162</FONT>

<BR><FONT COLOR=3D"#808080" SIZE=3D1 FACE=3D"Arial">ian.mcdonald@xxx.xx.x=
k / &quot;Ian McDonald-ONLINE&quot; (not &quot;Ian MacDonald&quot;)</FONT=
>
</P>
<BR>

<br>http://www.bbc.co.uk/ - World Wide Wonderland<br><br>This e-mail (and=
 any attachments) is confidential and may contain<br>personal views which=
 are not the views of the BBC unless specifically<br>stated.<br>If you ha=
ve received it in error, please delete it from your system. <br>Do not us=
e, copy or disclose the information in any way nor act in<br>reliance on =
it and notify the sender immediately. Please note that the<br>BBC monitor=
s e-mails sent or received. <br>Further communication will signify your c=
onsent to this.</BODY>
</HTML>=

------_=_NextPart_001_01C47DFA.D13BD308--

No way to instantiate two related CDBI classes at once, is there?
Ian McDonald-ONLINE 10:22 on 09 Aug 2004

Generated at 11:34 on 01 Dec 2004 by mariachi v0.52