Changeset 715
- Timestamp:
- 04/13/16 10:31:32 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/DNSDB.pm
r714 r715 4200 4200 my $perpage = ($args{nrecs} ? $args{nrecs} : $self->{perpage}); 4201 4201 4202 4203 4202 ##fixme: do we need a knob to twist to switch from unix epoch to postgres time string? 4204 4203 my @bindvars; … … 4230 4229 4231 4230 # Filtering on other fields 4232 foreach (qw(type distance weight port ttl description )) {4231 foreach (qw(type distance weight port ttl description location)) { 4233 4232 if ($args{$_}) { 4234 4233 $sql .= " AND $_ ~* ?"; … … 5184 5183 # Get a list of zone names and IDs that records for a passed CIDR block are within. 5185 5184 # Optionally restrict to a specific location/view 5185 # Optionally leave off the default_location field 5186 5186 sub getZonesByCIDR { 5187 5187 my $self = shift; 5188 5188 my $dbh = $self->{dbh}; 5189 5189 my %args = @_; 5190 5191 my $sql = "SELECT rdns_id,revnet,default_location FROM revzones WHERE (revnet >>= ? OR revnet <<= ?)". 5192 ($args{location} ? " AND default_location = ?" : ''); 5190 $args{return_location} = 1 if !defined($args{return_location}); 5191 5192 my $sql = "SELECT rdns_id,revnet".($args{return_location} ? ',default_location' : ''). 5193 " FROM revzones WHERE (revnet >>= ? OR revnet <<= ?)". 5194 (defined($args{location}) ? " AND default_location = ?" : ''); 5193 5195 my @svals = ($args{cidr}, $args{cidr}); 5194 push @svals, $args{location} if $args{location};5196 push @svals, $args{location} if defined $args{location}; 5195 5197 5196 5198 my $result = $dbh->selectall_arrayref($sql, { Slice => {} }, @svals );
Note:
See TracChangeset
for help on using the changeset viewer.