+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=======================================================================
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) {
unless (@ans) {
$pre .= '*' unless $pre =~ /[\*\?\[]$/o;
$pre = shellregex($pre);
- if ($main::dbh) {
+ if ($usesql) {
$pre =~ s/\.\*/%/g;
} else {
$pre =~ s/\.\*\$$//;
$expr .= ' && ' if $expr;
$spotter .= '*' unless $spotter =~ /[\*\?\[]/o;
$spotter = shellregex($spotter);
- if ($main::dbh) {
+ if ($usesql) {
$spotter =~ s/\.\*/%/g;
} else {
$spotter =~ s/\.\*\$$//;
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])";
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])";
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;
}
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);
}