in reply to Re: No Fear: decoupling your application from the database
in thread No Fear: decoupling your application from the database
I've used the join facility in Alzabo for only trivial things but so far it handles things ok.
I've just altered the node and added an example from my own code where I use Alzabo's join facility. You'll see it right inside the while() loop.
sub display_address { my $self = shift; my $tmpl = $self->load_tmpl( 'display_address.tmpl' ); my $schema = $self->param( 'schema' ); my $q = $self->query; # Retrieve the parameters my $street = $q->param( 'street' ); my $house = $q->param( 'house' ); my @people; { my $roster = $schema->Roster; my $history = $schema->History; my $roster_fk = $history->RosterFk; my $election = $schema->Election; my $election_date = $election->Date; my $election_desc = $election->Desc; my $people = $roster->rows_where( where => [ [ $roster->StreetFk, '=', $street ], [ $roster->HouseNumber, '=', $house ] ], order_by => [ $roster->Name ] ); # Retrieve the result set into an array while (my $person = $people->next) { my @votes = $schema->join( join => [ $history, $election ], select => [ $election ], where => [ $roster_fk, '=', $person->SosId ], order_by => [ $election_date, $election_desc ], )->all_rows; # Fetch the values from the selected data @votes = map $_->Date.': '.$_->Desc, @votes; push @people, { History => join("<br />",@votes), Name => $person->Name }; } } $tmpl->param('people', \ @people); return $tmpl->output; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: No Fear: decoupling your application from the database
by autarch (Hermit) on Mar 27, 2003 at 00:32 UTC |