+23Oct10=======================================================================
+1. add dbexport command to allow the export of ak1a style databases to a
+file.
+2. add dxqsl_import and dxqsl_export commands to allow the import and export
+of sh/dxsql qsl manager data extracted from spots as they pass through.
04Oct10=======================================================================
1. add CTY-2007 prefix list
04Oct10=======================================================================
locally.
See DBIMPORT for the importing of existing AK1A format data to databases.
+See DXEXPORT for how to export an AK1A data in a form able to be imported.
See DBSHOW for generic database enquiry
-
+
+
+=== 9^DBEXPORT <dbname> <filename>^Export an AK1A data to a file
+Sometimes one needs to export the data from an existing database file,
+maybe for a backup or to send to another node.
+
+ DBEXPORT oblast /tmp/OBLAST.FUL
+
+will export the OBLAST database to /tmp/OBLAST.FUL
+
+There is no protection, it is up to you not to overwrite a file that
+is important to you.
+
+See DBIMPORT for the importing of existing AK1A format data to databases.
+
=== 9^DBIMPORT <dbname> <filename>^Import AK1A data into a database
If you want to import or update data in bulk to a database you can use
this command. It will either create or update entries into an existing
will import the standard OBLAST database that comes with AK1A into the
oblast database held locally.
+See DBEXPORT for how to export an AK1A database
+
=== 9^DBREMOVE <dbname>^Delete a database
DBREMOVE will completely remove a database entry and also delete any data
file that is associated with it.
The <freq> is compared against the available bands set up in the
cluster. See SHOW/BANDS for more information.
+=== 9^DXQSL_IMPORT <filename>^Import SH/DXSQL information from a file
+The SHOW/DXQSL command shows any QSL managers that have been extracted
+from comments on a DX spot.
+
+Use this command to export the current state of the information to
+a CSV style text file. For example:
+
+ DXQSL_EXPORT /tmp/qsl.csv
+
+NOTE: this command will overwrite any file that you have write
+permission for.
+
+See also DXQSL_IMPORT to import one of these files.
+
+=== 9^DXQSL_IMPORT <filename>^Import SH/DXSQL information from a file
+The SHOW/DXQSL command shows any QSL managers that have been extracted
+from comments on a DX spot.
+
+Use this command to restore a file created by the DXSQL_EXPORT command.
+For example:
+
+ DXQSL_IMPORT /tmp/qsl.csv
+
+The data in this file will UPDATE any information that may already be
+present. This may not be what you want. To make the data the same as
+the import file then you must:
+
+* stop the node
+* remove /spider/data/qsl.v1
+* restart the node
+* login as sysop
+* do the import
+
+Preferably before too many DX spots with qsl manager info come in.
+
=== 0^ECHO <line>^Echo the line to the output
This command is useful in scripts and so forth for printing the
line that you give to the command to the output. You can use this
--- /dev/null
+#!/usr/bin/perl
+#
+# Database export routine
+#
+# Copyright (c) 2010 Dirk Koopman G1TLH
+#
+my ($self, $line) = @_;
+my ($name, $fn) = split /\s+/, $line;
+return (1, $self->msg('e5')) if $self->priv < 9;
+return (1, "dbexport: <database name> <pathname to export to>") unless $name && $fn;
+
+my @out;
+
+my $db = DXDb::getdesc($name);
+return (1, $self->msg('db3', $name)) unless $db;
+return (1, $self->msg('db1', $db->remote )) if $db->remote;
+my $of = IO::File->new(">$fn") or return(1, $self->msg('e30', $fn));
+
+$db->open; # make sure we are open
+my ($r, $k, $v, $flg, $count);
+for ($flg = R_FIRST; !$db->{db}->seq($k, $v, $flg); $flg = R_NEXT) {
+ $of->print("$k\n$v\&\&\n");
+ ++$count;
+}
+$of->close;
+return(0, $self->msg("db13", $count, $name, $fn));
+
+
+
open(IMP, $fn) or return (1, "Cannot open $fn $!");
while (<IMP>) {
- chomp;
- s/\r//g;
+ s/[\r\n]+$//g;
if ($state == 0) {
if (/^\&\&/) {
$state = 0;
}
close (IMP);
-push @out, $self->msg('db10', $count, $db->name);
+push @out, $self->msg('db10', $count, $fn, $db->name);
return (1, @out);
#!/usr/bin/perl
#
-# Database update routine
+# Database enquiry routine
#
# Copyright (c) 1999 Dirk Koopman G1TLH
#
--- /dev/null
+#
+# Export QSL information from the local database
+#
+# Copyright (c) 2010 Dirk Koopman G1TLH
+#
+
+my ($self, $line) = @_;
+my ($fn) = $line;
+return (1, $self->msg('e5')) if $self->priv < 9;
+return (1, "export_dxqsl: <pathname to export to>") unless $fn;
+
+#$DB::single=1;
+
+return (1, $self->msg('db3', 'QSL')) unless $QSL::dbm;
+
+my $of = IO::File->new(">$fn") or return(1, $self->msg('e30', $fn));
+$of->print(q{"call","manager","spots","unix timet","last spotter"}."\n");
+
+my ($r, $k, $v, $flg, $count, $q);
+for ($flg = R_FIRST; !$QSL::dbm->seq($k, $v, $flg); $flg = R_NEXT) {
+ next unless $k;
+
+ $q = QSL::get($k);
+ if ($q) {
+ for (@{$q->[1]}) {
+ $of->print(join(',', $k, $_->[0], $_->[1], $_->[2], $_->[3]). "\n");
+ ++$count;
+ }
+ }
+}
+$of->close;
+return(0, $self->msg("db13", $count, 'dxqsl', $fn));
--- /dev/null
+#
+# Import QSL information to the local database
+#
+# Copyright (c) 2010 Dirk Koopman G1TLH
+#
+
+my ($self, $line) = @_;
+my ($fn) = $line;
+return (1, $self->msg('e5')) if $self->priv < 9;
+return (1, "import_dxqsl: <pathname to import from>") unless $fn;
+
+#$DB::single=1;
+
+return (1, $self->msg('db3', 'QSL')) unless $QSL::dbm;
+
+my $if = IO::File->new("$fn") or return(1, $self->msg('e30', $fn));
+my $count;
+while (<$if>) {
+ next if /^\s+"/;
+ chomp;
+ my ($call, $manager, $c, $t, $by) = split /\s*,\s*/;
+ if ($call && $by) {
+ my $q = QSL::get($call) || QSL->new($call);
+ my ($r) = grep {$_->[0] eq $manager} @{$q->[1]};
+ if ($r) {
+ $r->[1] += $c;
+ if ($t > $r->[2]) {
+ $r->[2] = $t;
+ $r->[3] = $by;
+ }
+ } else {
+ $r = [$manager, $by, $t, $by];
+ unshift @{$q->[1]}, $r;
+ }
+ $q->put;
+ ++$count;
+ }
+}
+
+$if->close;
+
+return(0, $self->msg("db10", $count, $fn, 'dxqsl'));
db7 => 'Database $_[0] created for remote node $_[1]',
db8 => 'Database $_[0] created locally',
db9 => 'Database $_[0] removed',
- db10 => '$_[0] records imported into $_[1]',
+ db10 => '$_[0] records imported from $_[1] to $_[2]',
db11 => 'Sending your request(s) to $_[0], please stand by...',
db12 => 'DB Name Location Cmd Chain',
+ db13 => '$_[0] records exported from $_[1] to $_[2]',
dfreq1 => 'Invalid freq $_[0] need: eg 0/30000 or hf or hf/cw',
dir1 => 'No messages found',
disc1 => 'Disconnected by $_[0]',
return bless [uc $call, []], $pkg;
}
-# the format of each entry is [manager, times found, last time]
+# the format of each entry is [manager, times found, last time, last reporter]
sub update
{
return unless $dbm;
$version = '1.55';
$subversion = '0';
-$build = '74';
-$gitversion = '2a187a4';
+$build = '75';
+$gitversion = '059fb24';
1;