Gossamer Forum
Home : Products : Gossamer Links : Discussions :

"Browse" doesn't work with Oracle also

Quote Reply
"Browse" doesn't work with Oracle also
Hello All.

I've got a trouble with Oracle again:
In the Browse menu, when i click on Category Name to browse it, i got the error in admin/Links/Browser.pm line 1414.

Oracle cannot execute following SQL operator:

SELECT * FROM wdChanges WHERE ( LinkID IN () )

because list is empty, it's a mistake, we shouldn't write
'IN ()'.

What can i do to replace the mistake?

Thank you,
Anton Permyakov



Quote Reply
Re: "Browse" doesn't work with Oracle also In reply to
Hi,

Sorry about that! Around line 1414, change:

Code:
my $ids = $sth->fetchall_arrayref;
my $str = '(' . join (',', map { $_->[0] } @$ids ) . ')';
my $sth2 = $change_db->select (GT::SQL::Condition->new ('LinkID', 'IN', \$str));
my %changed;
while (my ($id) = $sth2->fetchrow_array) {
$changed{$id} = 1;
}
to:

Code:
# Get list of links that have changes.
my $ids = $sth->fetchall_arrayref;
my %changed;
my $str = '(' . join (',', map { $_->[0] } @$ids ) . ')';
if ($str ne '()') {
my $sth2 = $change_db->select (GT::SQL::Condition->new ('LinkID', 'IN', \$str));
while (my ($id) = $sth2->fetchrow_array) {
$changed{$id} = 1;
}
}
Let me know how that works for you!

Cheers,

Alex

--
Gossamer Threads Inc.
Quote Reply
Doesn't work yet... In reply to
Hi Alex,
Now i get another mistake, slightly below, here (line 1420 with if() wich i've inserted):

# Now get the actual link information.
$sth = $link_db->select (GT::SQL::Condition->new ('ID', 'IN', \$str));

Here we also use \$str, i tried to include it also in if($str ne '()'), but i dunno what about code more below:

# Get list of links.
my %output;
while (my $link = $sth->fetchrow_hashref) {
$output{$link->{ID}} = $self->return_template ("browser_link_list.html",
{
category_id => $category_id,
hasChangeRequest => $changed{$link->{ID}}
linkowner_esc => GT::CGI->escape($link-
%$link,
%$perms
}
);
}

I tried to enclose this code in if() also, but after that it doesn't show my links in categories :( ...
So, i need your help again.

Anton