[CDBI] Normalization
[prev]
[thread]
[next]
[Date index for 2005/11/14]
Okay, so now I'm a touch confused. Suppose I have a table
"foo" with columns "foo_id" (the PK) and "bar_id". Table
"bar" contains columns "bar_id" (the PK) and "bar". How do I
define the relationship between the tables so that these
both work:
my $bar_id = My::Foo->bar_id # id
my $bar_value = My::Foo->bar # value
This gets me halfway there:
package My::Bar;
__PACKAGE__->set_up_table('bar');
package My::Foo;
__PACKAGE__->set_up_table('foo');
__PACKAGE__->has_a(bar_id, 'My::Bar');
and elsewhere:
my $bar_id = My::Foo->bar_id # id
my $bar_value = My::Foo->bar_id->bar # value
but like I said, I'd really prefer to just say My::Foo->bar.
I'm sure it's trivial, but I just can't find the right
technique.
____________________________________________________________
Eamon Daly
_______________________________________________
ClassDBI mailing list
ClassDBI@xxxxx.xxxxxxxxxxxxxxxx.xxx
http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi
|
[CDBI] Normalization
Eamon Daly 23:38 on 14 Nov 2005
|