fix sh/dx <call> with sql spot logging
authorDirk Koopman <djk@tobit.co.uk>
Fri, 13 Feb 2015 22:40:00 +0000 (22:40 +0000)
committerDirk Koopman <djk@tobit.co.uk>
Fri, 13 Feb 2015 23:01:06 +0000 (23:01 +0000)
Changes
cmd/show/dx.pl
perl/DXSql/SQLite.pm
perl/SQLHash.pm

diff --git a/Changes b/Changes
index 27fff6eaeaad8af4572d17499c164d5245a44db6..41f1fee004b3185c956e40b61bd1b9ce7069107a 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,3 +1,6 @@
+13Feb14=======================================================================
+1. Fix problem with sh/dx <call> 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=======================================================================
index b65f0f8275a54cbc6d0c9511aa90ecf3843d35ec..15eaffd0d5a434feb986827389f838552dbab50e 100644 (file)
@@ -32,6 +32,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) {
@@ -181,7 +183,7 @@ if ($pre) {
        unless (@ans) {
                $pre .= '*' unless $pre =~ /[\*\?\[]$/o;
                $pre = shellregex($pre);
-               if ($main::dbh) {
+               if ($usesql) {
                        $pre =~ s/\.\*/%/g;
                } else {
                        $pre =~ s/\.\*\$$//;
@@ -257,7 +259,7 @@ if ($spotter) {
                $expr .= ' && ' if $expr;
                $spotter .= '*' unless $spotter =~ /[\*\?\[]/o;
                $spotter = shellregex($spotter);
-               if ($main::dbh) {
+               if ($usesql) {
                        $spotter =~ s/\.\*/%/g;
                } else {
                        $spotter =~ s/\.\*\$$//;
@@ -331,7 +333,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])";
@@ -347,7 +349,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])";
index 14eb0621f96e85bbc3805daecd1200850041e168..2330837f41cd4b2192dc2821f926ff917c00653b 100644 (file)
@@ -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);
 }
 
index 807ea6351f04f93f91df93bbbe43c7853fccee07..56b629e83d05ebb40fa106ab7f7ee7d05621f2fb 100644 (file)
@@ -44,7 +44,7 @@ sub file_exists
 
 sub del_file
 {
-       m
+       
 }
 
 sub new