- Timestamp:
- 01/03/14 15:16:16 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/DNSDB.pm
r583 r584 3637 3637 my %args = @_; 3638 3638 3639 my @filterargs;3640 3641 push @filterargs, $args{filter} if $args{filter};3642 3643 3639 # protection against bad or missing arguments 3644 3640 $args{sortorder} = 'ASC' if !$args{sortorder} || !grep /^$args{sortorder}$/, ('ASC','DESC'); … … 3665 3661 $newsort =~ s/^,//; 3666 3662 3663 my @bindvars = ($args{id}); 3664 push @bindvars, ($args{filter},$args{filter}) if $args{filter}; 3665 3667 3666 ##fixme: do we need a knob to twist to switch from unix epoch to postgres time string? 3668 3667 my $sql = "SELECT r.record_id,r.host,r.type,r.val,r.ttl"; … … 3675 3674 $sql .= "WHERE "._recparent($args{defrec},$args{revrec})." = ?"; 3676 3675 $sql .= " AND NOT r.type=$reverse_typemap{SOA}"; 3677 $sql .= " AND (r.host ~* ? OR r.val ~* ?)" if $args{filter}; 3676 # if ($self->{showrev_arpa} eq 'zone' || $self->{showrev_arpa} eq 'all') { 3677 # Just In Case the UI is using formal .arpa notation, and someone enters something reversed, 3678 # we want to match both the formal and natural zone name 3679 $sql .= " AND (r.host ~* ? OR r.val ~* ? OR r.host ~* ? OR r.val ~* ?)" if $args{filter}; 3680 my $tmp = join('.',reverse(split(/\./,$args{filter}))); 3681 push @bindvars, ($tmp, $tmp) if $args{filter}; 3682 # } else { 3683 # $sql .= " AND (r.host ~* ? OR r.val ~* ?)" if $args{filter}; 3684 # } 3678 3685 $sql .= " ORDER BY $newsort $args{sortorder}"; 3679 3686 # ensure consistent ordering by sorting on record_id too 3680 3687 $sql .= ", record_id $args{sortorder}"; 3681 3688 $sql .= ($args{offset} eq 'all' ? '' : " LIMIT $perpage OFFSET ".$args{offset}*$perpage); 3682 3683 my @bindvars = ($args{id});3684 push @bindvars, ($args{filter},$args{filter}) if $args{filter};3685 3689 3686 3690 my @working; … … 3717 3721 3718 3722 my @bindvars = ($id); 3719 push @bindvars, $filterif $filter;3723 push @bindvars, ($filter,$filter) if $filter; 3720 3724 my $sql = "SELECT count(*) FROM ". 3721 3725 _rectable($defrec,$revrec). 3722 3726 " WHERE "._recparent($defrec,$revrec)."=? ". 3723 "AND NOT type=$reverse_typemap{SOA}". 3724 ($filter ? " AND host ~* ?" : ''); 3727 "AND NOT type=$reverse_typemap{SOA}"; 3728 # if ($self->{showrev_arpa} eq 'zone' || $self->{showrev_arpa} eq 'all') { 3729 # Just In Case the UI is using formal .arpa notation, and someone enters something reversed, 3730 # we want to match both the formal and natural zone name 3731 $sql .= " AND (host ~* ? OR val ~* ? OR host ~* ? OR val ~* ?)" if $filter; 3732 my $tmp = join('.',reverse(split(/\./,$filter))); 3733 push @bindvars, ($tmp, $tmp) if $filter; 3734 # } else { 3735 # $sql .= " AND (host ~* ? OR val ~* ?)" if $filter; 3736 # } 3737 3725 3738 my ($count) = $dbh->selectrow_array($sql, undef, (@bindvars) ); 3726 3739
Note:
See TracChangeset
for help on using the changeset viewer.