[CDBI] Re: Retrieve only one result from a has_many

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

From: Matt Adams
Subject: [CDBI] Re: Retrieve only one result from a has_many
Date: 23:51 on 17 Dec 2005
> Did you see this section in the documentation?
>
>    http://search.cpan.org/~tmtm/Class-DBI/lib/Class/DBI.pm#Limiting
>
> Assuming dset in the deadline table is unique for a given versioncode,
> maybe something like this:

Yes, dset in the deadline table is unique for a given versioncode.

>
>    ($specific_deadline) = $object->deadlines(dset => 5);

Ed,

Thank you for your suggestions and clarifications.  My apologies for the
poor examples I provided; I think I was half asleep when I typed the
e-mail.

What I am really looking for is to be able to issue something like:

MyApp::DB::Deadline->has_a( versioncode => 'MyApp::DB::Version' );
MyApp::DB::Version->has_many( deadlines => 'MyApp::DB::Deadline' );

And some other cool magic which I'm hoping someone can supply.

And when I retrieve a record via

$object = MyApp::DB::Version->retrieve( 23 );

Be able to get a specific value from the has_many relationship to
MyApp::DB::Deadline by simply issuing

my $specific_deadline = $object->deadlines;

In other words, is it possible to limit the results returned from
$object->deadlines based on information I supply when I create the CDBI
relationships?

Thanks for your help.  Its is entirely possible that I'm trying to be too
simple about what I'm doing and that I should just give up now and use the
existing CDBI functionality to get what I want.


Cheers

Matt


_______________________________________________
ClassDBI mailing list
ClassDBI@xxxxx.xxxxxxxxxxxxxxxx.xxx
http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi

[CDBI] Re: Retrieve only one result from a has_many
Edward J. Sabol 22:59 on 16 Dec 2005

[CDBI] Re: Retrieve only one result from a has_many
Matt Adams 23:51 on 17 Dec 2005

Generated at 09:31 on 23 Jan 2006 by mariachi v0.52