3 # Database export routine
5 # Copyright (c) 2010 Dirk Koopman G1TLH
7 my ($self, $line) = @_;
8 my ($name, $fn) = split /\s+/, $line;
9 return (1, $self->msg('e5')) if $self->priv < 9;
10 return (1, "dbexport: <database name> <pathname to export to>") unless $name && $fn;
14 my $db = DXDb::getdesc($name);
15 return (1, $self->msg('db3', $name)) unless $db;
16 return (1, $self->msg('db1', $db->remote )) if $db->remote;
17 my $of = IO::File->new(">$fn") or return(1, $self->msg('e30', $fn));
19 $db->open; # make sure we are open
20 my ($r, $k, $v, $flg, $count);
21 for ($flg = R_FIRST; !$db->{db}->seq($k, $v, $flg); $flg = R_NEXT) {
22 $of->print("$k\n$v\&\&\n");
26 return(0, $self->msg("db13", $count, $name, $fn));