Re: retrieving only specified fields ?

[prev] [thread] [next] [Date index for 2004/06/17]

From: Tony Bowden
Subject: Re: retrieving only specified fields ?
Date: 15:37 on 17 Jun 2004
On Thu, Jun 17, 2004 at 06:00:34PM +0300, raptor@xxxxxx.xxx wrote:
> if we have the setup u mentioned then i want to say :
> my @cd = CD->retrieve_all();
> to retrieve only fields "title, year" instead of all  "cdid, artist, title, year"

CD->columns(Primary => qw/cdid/);
CD->columns(Essential => qw/title year/);
CD->columns(Others => qw/artist/);

> And which column to retriewe should be dynamic f.e. pseudo code :
> my @cd = CD->retrieve_all(qw(title year));
> my @cd = CD->retrieve_all(qw(cdid artist));
> my @cd = CD->retrieve_all(qw(artist title));

I really can't see why you'd want that. But if you really do have a
compelling reason, then your best bet is to make a subclass for each
variation you'll want:

package CD::Weird;

use base 'CD';

CD::Weird->columns(Primary => qw/cdid/);
CD::Weird->columns(Essential => qw/title artist/);
CD::Weird->columns(Others => qw/year/);

You could conceivably mess with these in the one class at run time, but
in general that's a Very Bad Thing(tm).

Tony

retrieving only specified fields ?
"raptor 11:45 on 17 Jun 2004

Re: retrieving only specified fields ?
colm-cdbi 12:23 on 17 Jun 2004

Re: retrieving only specified fields ?
"raptor 15:00 on 17 Jun 2004

Re: retrieving only specified fields ?
colm-cdbi 15:21 on 17 Jun 2004

Re: retrieving only specified fields ?
Simon Cozens 15:24 on 17 Jun 2004

Re: retrieving only specified fields ?
Tony Bowden 15:37 on 17 Jun 2004

Re: retrieving only specified fields ?
Heiko Klein 15:26 on 18 Jun 2004

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