Changeset 719 for trunk


Ignore:
Timestamp:
05/17/16 15:25:14 (8 years ago)
Author:
Kris Deugau
Message:

/trunk

Refine location handling in domainID() and revID()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DNSDB.pm

    r716 r719  
    25402540  my $dbh = $self->{dbh};
    25412541  my $domain = shift;
    2542   my ($domid) = $dbh->selectrow_array("SELECT domain_id FROM domains WHERE lower(domain) = lower(?)",
    2543         undef, ($domain) );
     2542  my $location = shift;
     2543
     2544  # Note that location may be *empty*, but it may not be *undefined*
     2545  if (!defined($location)) {
     2546    $errstr = "Missing location";
     2547    return;
     2548  }
     2549
     2550  my ($domid) = $dbh->selectrow_array(
     2551        "SELECT domain_id FROM domains WHERE lower(domain) = lower(?) AND default_location = ?",
     2552        undef, ($domain, $location) );
    25442553  if (!$domid) {
    25452554    if ($dbh->err) {
     
    25612570  my $dbh = $self->{dbh};
    25622571  my $revzone = shift;
    2563   my ($revid) = $dbh->selectrow_array("SELECT rdns_id FROM revzones WHERE revnet=?", undef, ($revzone) );
     2572  my $location  = shift;
     2573
     2574  # Note that location may be *empty*, but it may not be *undefined*
     2575  if (!defined($location)) {
     2576    $errstr = "Missing location";
     2577    return;
     2578  }
     2579
     2580  my ($revid) = $dbh->selectrow_array(
     2581        "SELECT rdns_id FROM revzones WHERE revnet = ? AND default_location = ?",
     2582        undef, ($revzone, $location) );
    25642583  if (!$revid) {
    25652584    if ($dbh->err) {
Note: See TracChangeset for help on using the changeset viewer.