From: Dirk Koopman Date: Fri, 13 Feb 2015 22:40:00 +0000 (+0000) Subject: fix sh/dx with sql spot logging X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=commitdiff_plain;h=74a756eeda9aaf5732589bea9dd75371b0cb35e0;p=spider.git fix sh/dx with sql spot logging --- diff --git a/Changes b/Changes index b4a800f2..3a318dfc 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,6 @@ +13Feb14======================================================================= +1. Fix problem with sh/dx if people are logging spots to a SQL database +2. My late father would have been 102 today. 27Nov14======================================================================= 1. Add CTY-2415 prefix list 25Nov14======================================================================= diff --git a/cmd/show/dx.pl b/cmd/show/dx.pl index f2629bff..171b5efd 100644 --- a/cmd/show/dx.pl +++ b/cmd/show/dx.pl @@ -31,6 +31,8 @@ my $fromdxcc; my $exact; my ($doqsl, $doiota, $doqra, $dofilter); +my $usesql = $main::dbh && $Spot::use_db_for_search; + while ($f = shift @list) { # next field # print "f: $f list: ", join(',', @list), "\n"; if (!$from && !$to) { @@ -180,7 +182,7 @@ if ($pre) { unless (@ans) { $pre .= '*' unless $pre =~ /[\*\?\[]$/o; $pre = shellregex($pre); - if ($main::dbh) { + if ($usesql) { $pre =~ s/\.\*/%/g; } else { $pre =~ s/\.\*\$$//; @@ -256,7 +258,7 @@ if ($spotter) { $expr .= ' && ' if $expr; $spotter .= '*' unless $spotter =~ /[\*\?\[]/o; $spotter = shellregex($spotter); - if ($main::dbh) { + if ($usesql) { $spotter =~ s/\.\*/%/g; } else { $spotter =~ s/\.\*\$$//; @@ -330,7 +332,7 @@ if ($state) { push @expr, "\$f12 eq '$_'"; push @hint, "m{$_}"; } - if ($main::dbh) { + if ($usesql) { $expr .= @expr > 1 ? '(' . join(' || ', @expr) . ')' : "$expr[0]"; } else { $expr .= @expr > 1 ? '(\$f12 && (' . join(' || ', @expr) . '))' : "(\$f12 && $expr[0])"; @@ -346,7 +348,7 @@ if ($bystate) { push @expr, "\$f13 eq '$_'"; push @hint, "m{$_}"; } - if ($main::dbh) { + if ($usesql) { $expr .= @expr > 1 ? '(' . join(' || ', @expr) . ')' : "$expr[0]"; } else { $expr .= @expr > 1 ? '(\$f13 && (' . join(' || ', @expr) . '))' : "(\$f13 && $expr[0])"; diff --git a/perl/DXSql/SQLite.pm b/perl/DXSql/SQLite.pm index 14eb0621..2330837f 100644 --- a/perl/DXSql/SQLite.pm +++ b/perl/DXSql/SQLite.pm @@ -36,7 +36,7 @@ sub has_ipaddr my $sth = $self->prepare($s); $sth->execute; while (my @t = $sth->fetchrow_array) { - if ($t[0] eq 'ipaddr') { + if ($t[1] eq 'ipaddr') { $sth->finish; return 1; } @@ -48,7 +48,7 @@ sub has_ipaddr sub add_ipaddr { my $self = shift; - my $s = q(alter table spot add column ipaddr varchar(40)); + my $s = q(alter table spot add column ipaddr text); $self->do($s); } diff --git a/perl/SQLHash.pm b/perl/SQLHash.pm index 807ea635..56b629e8 100644 --- a/perl/SQLHash.pm +++ b/perl/SQLHash.pm @@ -44,7 +44,7 @@ sub file_exists sub del_file { - m + } sub new