Re: Selecting (and accessing) from many tables

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

From: Perrin Harkins
Subject: Re: Selecting (and accessing) from many tables
Date: 19:29 on 20 Sep 2004
On Mon, 2004-09-20 at 08:05, Jesse Sheidlower wrote:
> When retrieving in such a manner, what is the syntax for
> acessing the elements of this from my Track object? 

Jesse,

Here are some options:

1) Create a whole bunch of Class::DBI objects from this data using 
construct() calls.  See the recent thread "loading many objects from one
query" for some sample code.

2) Don't worry about efficiency and use the initial query to just get a
set of track objects which you will use to get any other data you want. 
For example:

my @tracks = Music::Tracks->search_by_year(1992);
foreach my $track (@tracks) {
    my $cd          = $track->cd();
    my $title       = $cd->title();
    my $artist      = $cd->artist();
    my $artist_name = $artist->name();
    ... etc ...
}

In general, I don't think Class::DBI is the right tool for complex
report data.  However, if all you want is the relationships between
objects, and you are not having performance problems, the second option
is pretty easy and natural.

- Perrin

(message missing)

Selecting (and accessing) from many tables
Jesse Sheidlower 00:46 on 20 Sep 2004

Re: Selecting (and accessing) from many tables
Tony Bowden 07:18 on 20 Sep 2004

Re: Selecting (and accessing) from many tables
Jesse Sheidlower 12:05 on 20 Sep 2004

Re: Selecting (and accessing) from many tables
Tony Bowden 16:47 on 20 Sep 2004

Re: Selecting (and accessing) from many tables
Jesse Sheidlower 22:55 on 20 Sep 2004

Re: Selecting (and accessing) from many tables
Tony Bowden 07:04 on 21 Sep 2004

Re: Selecting (and accessing) from many tables
Perrin Harkins 19:29 on 20 Sep 2004

Re: Selecting (and accessing) from many tables
Jesse Sheidlower 13:28 on 21 Sep 2004

Re: Selecting (and accessing) from many tables
Tony Bowden 13:56 on 21 Sep 2004

Re: Selecting (and accessing) from many tables
Jesse Sheidlower 14:05 on 21 Sep 2004

Re: Selecting (and accessing) from many tables
Tony Bowden 15:08 on 21 Sep 2004

Re: Selecting (and accessing) from many tables
Jesse Sheidlower 15:22 on 21 Sep 2004

Re: Selecting (and accessing) from many tables
Tony Bowden 15:28 on 21 Sep 2004

RE: Selecting (and accessing) from many tables
Carl Johnstone 15:42 on 21 Sep 2004

Re: Selecting (and accessing) from many tables
Perrin Harkins 16:08 on 21 Sep 2004

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