Changeset 826


Ignore:
Timestamp:
03/06/21 09:17:26 (4 years ago)
Author:
Kris Deugau
Message:

/trunk

Extend domID() and revID() to accept a magic string to search any location/view

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DNSDB.pm

    r823 r826  
    27282728  }
    27292729
    2730   my ($domid) = $dbh->selectrow_array(
    2731         "SELECT domain_id FROM domains WHERE lower(domain) = lower(?) AND default_location = ?",
    2732         undef, ($domain, $location) );
     2730  my $sql = "SELECT domain_id FROM domains WHERE lower(domain) = lower(?)";
     2731  my @zargs = ($domain);
     2732  # yay magic strings!
     2733  if ($location eq ':ANY:') {
     2734    # no-op
     2735  } else {
     2736    $sql .= " AND default_location = ?";
     2737    push @zargs, $location;
     2738  }
     2739
     2740  my ($domid) = $dbh->selectrow_array($sql, undef, @zargs);
     2741
    27332742  if (!$domid) {
    27342743    if ($dbh->err) {
     
    27592768  }
    27602769
    2761   my ($revid) = $dbh->selectrow_array(
    2762         "SELECT rdns_id FROM revzones WHERE revnet = ? AND default_location = ?",
    2763         undef, ($revzone, $location) );
     2770  my $sql = "SELECT rdns_id FROM revzones WHERE revnet = ?";
     2771  my @zargs = ($revzone);
     2772  # yay magic strings!
     2773  if ($location eq ':ANY:') {
     2774    # no-op
     2775  } else {
     2776    $sql .= " AND default_location = ?";
     2777    push @zargs, $location;
     2778  }
     2779
     2780  my ($revid) = $dbh->selectrow_array($sql, undef, @zargs);
     2781
    27642782  if (!$revid) {
    27652783    if ($dbh->err) {
Note: See TracChangeset for help on using the changeset viewer.