- Timestamp:
- 12/30/15 17:24:35 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/DNSDB.pm
r699 r701 4829 4829 my $dbh = $self->{dbh}; 4830 4830 my $cidr = shift; 4831 my $group = shift || 1; # just in case 4831 my %args = @_; 4832 $args{group} = 1 if !$args{group}; # just in case 4833 $args{location} = '' if !$args{location}; 4832 4834 4833 4835 # for speed! Casting and comparing even ~7K records takes ~2.5s, so narrow it down to one revzone first. … … 4837 4839 ##fixme? may need to narrow things down more by octet-chopping and doing text comparisons before casting. 4838 4840 my ($revpatt) = $dbh->selectrow_array("SELECT host FROM records ". 4839 "WHERE (type in (12,65280,65281,65282,65283,65284)) AND rdns_id = ? AND inetlazy(val) >>= ? ". 4840 "ORDER BY inetlazy(val) DESC LIMIT 1", undef, ($revid, $cidr) ); 4841 "WHERE (type in (12,65280,65281,65282,65283,65284)) AND rdns_id = ? ". 4842 "AND location = ? AND inetlazy(val) >>= ? ". 4843 "ORDER BY inetlazy(val) DESC LIMIT 1", 4844 undef, ($revid, $args{location}, $cidr) ); 4845 4841 4846 return $revpatt; 4842 4847 } # end getRevPattern() … … 4850 4855 my $dbh = $self->{dbh}; 4851 4856 my $cidr = shift; 4852 my $group = shift || 1; # just in case 4857 my %args = @_; 4858 $args{group} = 1 if !$args{group}; # just in case 4859 $args{location} = '' if !$args{location}; 4853 4860 4854 4861 # for speed! Casting and comparing even ~7K records takes ~2.5s, so narrow it down to one revzone first. … … 4866 4873 4867 4874 my $sth = $dbh->prepare("SELECT val, host FROM records ". 4868 "WHERE (type in (12,65280,65281,65282,65283,65284)) AND rdns_id = ? AND inetlazy(val) = ?");4875 "WHERE (type in (12,65280,65281,65282,65283,65284)) AND rdns_id = ? AND location = ? AND inetlazy(val) = ?"); 4869 4876 4870 4877 my @ret; 4871 4878 foreach my $ip (@{$cidr->splitref()}) { 4872 $sth->execute($revid, $ ip);4879 $sth->execute($revid, $args{location}, $ip); 4873 4880 my @data = $sth->fetchrow_array(); 4874 4881 my %row;
Note:
See TracChangeset
for help on using the changeset viewer.