Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Mimic data content question

Quote Reply
Mimic data content question
I need to duplicate the content of the variables in red from 1st code snippet into
the same named variables in the 2nd code snippet. Gray code is probably not needed (no grouping by).

The original GT code did this:
Code:
my $link_sth = $links->query_sth($args);

# And format the link results.
my (@link_results_loop, $link_results, %link_output);
if ($link_count) {
my $results = $link_sth->fetchall_hashref;
$links->add_reviews($results);
@link_results_loop = map Links::SiteHTML::tags('link', $_) => @$results unless $CFG->{build_search_gb};
if ($CFG->{build_search_gb}) {
my @ids = map { $_->{ID} } @$results;
my $catlink = $DB->table('CatLinks','Category');
my %names = $catlink->select('LinkID', 'Full_Name', { LinkID => \@ids })->fetchall_list;
foreach my $link (@$results) {
push @{$link_output{$names{$link->{ID}}}}, Links::SiteHTML::tags('link', $link);
}
}

}

I am doing this:
Code:
my $lcl = $DB->table('Links', 'CatLinks', 'Category') || return $GT::SQL::error;

my $sth = $lcl->select({ FatherID => $catid },
GT::SQL::Condition->new(
isValidated => '=' => 'Yes',
ExpiryDate => '>=' => time
) );

my @output;
my $link_count = '0';
my $results;

while (my $link = $sth->fetchrow_hashref)
{
$link->{distance} = distance($olat, $olon, $link->{Latitude}, $link->{Longitude}, $unit);

if($link->{distance} <= $dist)
{
$link_count++;
push (@output, $link);
$results .= $link;
}
}
@link_results_loop = map Links::SiteHTML::tags('link', $_) => @$results unless $CFG->{build_search_gb};


Thanks
Chris
RGB World, Inc. - Software &amp; Web Development.
rgbworld.com

Last edited by:

rgbworld: May 24, 2005, 1:55 AM