X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=cmd%2Fdbshow.pl;h=e6e138c2b414ab75f05e3443a9976091b26f30ff;hb=refs%2Fheads%2Fspider;hp=f48def42d40e7c757f64f92ac0fa1670be2f80f2;hpb=1fcf24aae37e929a6b9c2dab9ca5afff00d8db57;p=spider.git diff --git a/cmd/dbshow.pl b/cmd/dbshow.pl index f48def42..e6e138c2 100644 --- a/cmd/dbshow.pl +++ b/cmd/dbshow.pl @@ -1,6 +1,6 @@ #!/usr/bin/perl # -# Database update routine +# Database enquiry routine # # Copyright (c) 1999 Dirk Koopman G1TLH # @@ -12,18 +12,52 @@ my $name = shift @f if @f; my $db = DXDb::getdesc($name); return (1, $self->msg('db3', $name)) unless $db; -if ($db->remote) { - for (@f) { - my $n = DXDb::newstream($self->call); - DXProt::route(undef, $db->remote, DXProt::pc44($main::mycall, $db->remote, $n, uc $db->name,uc $_, $self->call)); - } -} else { - for (@f) { - my $value = $db->getkey($_); - if ($value) { - push @out, split /\n/, $value; - } else { - push @out, $self->msg('db2', $_, $db->{name}); +my @db; +push @db, $name; +push @db, @{$db->chain} if $db->chain; + +my $n; +foreach $n (@db) { + $db = DXDb::getdesc($n); + return (1, $self->msg('db3', $n)) unless $db; + + if ($db->remote) { + + # remote databases + unless (Route::Node::get($db->remote) || DXChannel::get($db->remote)) { + push @out, $self->msg('db4', uc $name, $db->remote); + last; + } + + push @out, $self->msg('db11', $db->remote); + push @f, " " unless @f; + for (@f) { + my $n = DXDb::newstream($self->call); + DXProt::route(undef, $db->remote, DXProt::pc44($main::mycall, $db->remote, $n, uc $db->name,uc $_, $self->call)); + } +# last; + } else { + + # local databases can chain to remote ones + my $count; + my $pre = $db->print('pre'); + push @out, $pre if defined $pre; +# push @out, "@f"; + for (@f) { + push @out, $db->name . " $_"; + my $value = $db->getkey($_) || ""; +# push @out, $db->name . ": $_ :"; + if ($value) { + push @out, split /\n/, $value; + $count++; + } else { + push @out, $self->msg('db2', uc $_, uc $db->{name}); + } + } + if ($count) { + my $post = $db->print('post'); + push @out, $post if $post; +# last; } } }