Re: [CDBI] Two has_a Relationships to the Same Table?
"Dave Mabe" <[email protected]> Wed, 23 Apr 2008 09:26:41 -0400
| Newsgroups | gmane.comp.lang.perl.modules.class-dbi |
|---|---|
| Message-ID | <[email protected]> |
--===============1209292714== Content-Type: multipart/alternative; boundary="----=_Part_11323_4238585.1208957201277" ------=_Part_11323_4238585.1208957201277 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline package StockTickr::Trade; ... __PACKAGE__->has_a(marketdata => 'StockTickr::MarketData'); # this relationship has worked fine __PACKAGE__->has_a(yesterday_marketdata => 'StockTickr::MarketData'); # new column, yesterday_marketdata is a new column in this table ... On Wed, Apr 23, 2008 at 9:13 AM, Mertel, Mark <[email protected]> wrote: > Did you use the mappings method? How about including your code snippet. > > > > --- > > Mark Mertel > > TEK systems > > Desk: 425.288.7214 > > Mobile: 206.353.2663 > > > ------------------------------ > > *From:* classdbi-bounces-uVLvtXkw1RPgjt3iqB9Uk5F3r5kRpbQ7rE5yTffgRl4@public.gmane.org [mailto: > classdbi-bounces-uVLvtXkw1RPgjt3iqB9Uk5F3r5kRpbQ7rE5yTffgRl4@public.gmane.org] *On Behalf Of *Dave Mabe > *Sent:* Wednesday, April 23, 2008 6:06 AM > *To:* ClassDBI-uVLvtXkw1RPgjt3iqB9Uk5F3r5kRpbQ7rE5yTffgRl4@public.gmane.org > *Subject:* [CDBI] Two has_a Relationships to the Same Table? > > > > I've got one table (A) with a has_a relationship to another table (B). > I'd like to add another column to table A that is the foreign key for a > record in table B. > > I tried to simply add the column and then put another has_a relationship > in the class for table A, but I get "Column does not exist" errors. I tried > adding the new column name as a TEMP column in the class for table B and > also adding it as a table_alias for table B both of which give the same > error. > > Any idea how to do this? Is it possible to set up another class for table > B for the second relationship (still pointing to the data in the same > table)? > > TIA > > -- > Dave Mabe > StockTickr - Trader Performance Analysis > We Make Traders More Profitable > http://www.stocktickr.com/ > > Every trade I make is blogged: > http://blog.stocktickr.com/ > -- Dave Mabe StockTickr - Trader Performance Analysis We Make Traders More Profitable http://www.stocktickr.com/ Every trade I make is blogged: http://blog.stocktickr.com/ ------=_Part_11323_4238585.1208957201277 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline package StockTickr::Trade;<br>...<br>__PACKAGE__->has_a(marketdata => 'StockTickr::MarketData'); # this relationship has worked fine<br>__PACKAGE__->has_a(yesterday_marketdata => 'StockTickr::MarketData'); # new column, yesterday_marketdata is a new column in this table<br> ...<br><br><div class="gmail_quote">On Wed, Apr 23, 2008 at 9:13 AM, Mertel, Mark <<a href="mailto:[email protected]">[email protected]</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> <div link="blue" vlink="blue" lang="EN-US"> <div> <p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">Did you use the mappings method? How about including your code snippet.</span></font></p> <p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;"> </span></font></p> <div> <p><font color="navy" face="Times New Roman" size="3"><span style="font-size: 12pt; color: navy;">---</span></font></p> <p><font color="navy" face="Times New Roman" size="3"><span style="font-size: 12pt; color: navy;">Mark Mertel</span></font></p> <p><font color="navy" face="Times New Roman" size="3"><span style="font-size: 12pt; color: navy;">TEK systems</span></font></p> <p><font color="navy" face="Times New Roman" size="3"><span style="font-size: 12pt; color: navy;">Desk: 425.288.7214</span></font></p> <p><font color="navy" face="Times New Roman" size="3"><span style="font-size: 12pt; color: navy;">Mobile</span></font><font color="navy"><span style="color: navy;">: 206.353.2663</span></font></p> </div> <p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;"> </span></font></p> <div> <div style="text-align: center;" align="center"><font face="Times New Roman" size="3"><span style="font-size: 12pt;"> <hr align="center" size="2" width="100%"> </span></font></div> <p><b><font face="Tahoma" size="2"><span style="font-size: 10pt; font-family: Tahoma; font-weight: bold;">From:</span></font></b><font face="Tahoma" size="2"><span style="font-size: 10pt; font-family: Tahoma;"> <a href="mailto:classdbi-bounces-uVLvtXkw1RPgjt3iqB9Uk5F3r5kRpbQ7rE5yTffgRl4@public.gmane.org" target="_blank">classdbi-bounces-uVLvtXkw1RPgjt3iqB9Uk5F3r5kRpbQ7rE5yTffgRl4@public.gmane.org</a> [mailto:<a href="mailto:classdbi-bounces-uVLvtXkw1RPgjt3iqB9Uk5F3r5kRpbQ7rE5yTffgRl4@public.gmane.org" target="_blank">classdbi-bounces-uVLvtXkw1RPgjt3iqB9Uk5F3r5kRpbQ7rE5yTffgRl4@public.gmane.org</a>] <b><span style="font-weight: bold;">On Behalf Of </span></b>Dave Mabe<br> <b><span style="font-weight: bold;">Sent:</span></b> Wednesday, April 23, 2008 6:06 AM<br> <b><span style="font-weight: bold;">To:</span></b> <a href="mailto:ClassDBI-uVLvtXkw1RPgjt3iqB9Uk5F3r5kRpbQ7rE5yTffgRl4@public.gmane.org" target="_blank">ClassDBI-uVLvtXkw1RPgjt3iqB9Uk5F3r5kRpbQ7rE5yTffgRl4@public.gmane.org</a><br> <b><span style="font-weight: bold;">Subject:</span></b> [CDBI] Two has_a Relationships to the Same Table?</span></font></p> </div><div><div></div><div class="Wj3C7c"> <p><font face="Times New Roman" size="3"><span style="font-size: 12pt;"> </span></font></p> <p><font face="Times New Roman" size="3"><span style="font-size: 12pt;">I've got one table (A) with a has_a relationship to another table (B). I'd like to add another column to table A that is the foreign key for a record in table B.<br> <br> I tried to simply add the column and then put another has_a relationship in the class for table A, but I get "Column does not exist" errors. I tried adding the new column name as a TEMP column in the class for table B and also adding it as a table_alias for table B both of which give the same error.<br> <br> Any idea how to do this? Is it possible to set up another class for table B for the second relationship (still pointing to the data in the same table)?<br> <br> TIA<br clear="all"> <br> -- <br> Dave Mabe<br> StockTickr - Trader Performance Analysis<br> We Make Traders More Profitable<br> <a href="http://www.stocktickr.com/" target="_blank">http://www.stocktickr.com/</a><br> <br> Every trade I make is blogged:<br> <a href="http://blog.stocktickr.com/" target="_blank">http://blog.stocktickr.com/</a> </span></font></p> </div></div></div> </div> </blockquote></div><br><br clear="all"><br>-- <br>Dave Mabe<br>StockTickr - Trader Performance Analysis<br>We Make Traders More Profitable<br><a href="http://www.stocktickr.com/">http://www.stocktickr.com/</a><br><br>Every trade I make is blogged:<br> <a href="http://blog.stocktickr.com/">http://blog.stocktickr.com/</a> ------=_Part_11323_4238585.1208957201277-- --===============1209292714== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ ClassDBI mailing list ClassDBI-Ra3b/[email protected] http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi --===============1209292714==--