Changeset 614


Ignore:
Timestamp:
04/22/14 18:01:10 (11 years ago)
Author:
Kris Deugau
Message:

/trunk

Bundle up several statements in getRecList() and getRecCount() inside an
if() block, since $args{filter} may or may not be defined, and when it's
not, it messes in the error log. See #25.

Also remove some stale, commented surrounding if/else fragments while we're
cleaning this up.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DNSDB.pm

    r613 r614  
    37633763  $sql .= "WHERE "._recparent($args{defrec},$args{revrec})." = ?";
    37643764  $sql .= " AND NOT r.type=$reverse_typemap{SOA}";
    3765 #    if ($self->{showrev_arpa} eq 'zone' || $self->{showrev_arpa} eq 'all') {
    3766       # Just In Case the UI is using formal .arpa notation, and someone enters something reversed,
    3767       # we want to match both the formal and natural zone name
    3768       $sql .= " AND (r.host ~* ? OR r.val ~* ? OR r.host ~* ? OR r.val ~* ?)" if $args{filter};
    3769       my $tmp = join('.',reverse(split(/\./,$args{filter})));
    3770       push @bindvars, ($tmp, $tmp) if $args{filter};
    3771 #    } else {
    3772 #      $sql .= " AND (r.host ~* ? OR r.val ~* ?)" if $args{filter};
    3773 #    }
     3765  if ($args{filter}) {
     3766    $sql .= " AND (r.host ~* ? OR r.val ~* ? OR r.host ~* ? OR r.val ~* ?)";
     3767    my $tmp = join('.',reverse(split(/\./,$args{filter})));
     3768    push @bindvars, ($tmp, $tmp);
     3769  }
    37743770  $sql .= " ORDER BY $newsort $args{sortorder}";
    37753771  # ensure consistent ordering by sorting on record_id too
     
    38183814        " WHERE "._recparent($defrec,$revrec)."=? ".
    38193815        "AND NOT type=$reverse_typemap{SOA}";
    3820 #    if ($self->{showrev_arpa} eq 'zone' || $self->{showrev_arpa} eq 'all') {
    3821       # Just In Case the UI is using formal .arpa notation, and someone enters something reversed,
    3822       # we want to match both the formal and natural zone name
    3823       $sql .= " AND (host ~* ? OR val ~* ? OR host ~* ? OR val ~* ?)" if $filter;
    3824       my $tmp = join('.',reverse(split(/\./,$filter)));
    3825       push @bindvars, ($tmp, $tmp) if $filter;
    3826 #    } else {
    3827 #      $sql .= " AND (host ~* ? OR val ~* ?)" if $filter;
    3828 #    }
     3816  if ($args{filter}) {
     3817    $sql .= " AND (r.host ~* ? OR r.val ~* ? OR r.host ~* ? OR r.val ~* ?)";
     3818    my $tmp = join('.',reverse(split(/\./,$args{filter})));
     3819    push @bindvars, ($tmp, $tmp);
     3820  }
     3821  $sql .= " AND (host ~* ? OR val ~* ? OR host ~* ? OR val ~* ?)" if $filter;
     3822  my $tmp = join('.',reverse(split(/\./,$filter)));
     3823  push @bindvars, ($tmp, $tmp) if $filter;
    38293824
    38303825  my ($count) = $dbh->selectrow_array($sql, undef, (@bindvars) );
Note: See TracChangeset for help on using the changeset viewer.