Changeset 501


Ignore:
Timestamp:
05/07/13 11:00:46 (12 years ago)
Author:
Kris Deugau
Message:

/trunk

Return some more useful errors from domainID() and revID() if the zone
doesn't exist
Commit a lurking change to allow a caller to specify the pagination
count in getRecList()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DNSDB.pm

    r497 r501  
    20092009  my ($domid) = $dbh->selectrow_array("SELECT domain_id FROM domains WHERE lower(domain) = lower(?)",
    20102010        undef, ($domain) );
    2011   $errstr = $DBI::errstr if !$domid;
     2011  if (!$domid) {
     2012    if ($dbh->err) {
     2013      $errstr = $DBI::errstr;
     2014    } else {
     2015      $errstr = "Domain $domain not present";
     2016    }
     2017  }
    20122018  return $domid if $domid;
    20132019} # end domainID()
     
    20232029  my $revzone = shift;
    20242030  my ($revid) = $dbh->selectrow_array("SELECT rdns_id FROM revzones WHERE revnet=?", undef, ($revzone) );
    2025   $errstr = $DBI::errstr if !$revid;
     2031  if (!$revid) {
     2032    if ($dbh->err) {
     2033      $errstr = $DBI::errstr;
     2034    } else {
     2035      $errstr = "Reverse zone $revzone not present";
     2036    }
     2037  }
    20262038  return $revid if $revid;
    20272039} # end revID()
     
    34873499  $args{sortby} = 'val' if !$args{sortby} && $args{revrec} eq 'y';      # default sort by IP on revzone record list
    34883500  $args{offset} = 0 if !$args{offset} || $args{offset} !~ /^(?:all|\d+)$/; 
     3501  my $perpage = ($args{nrecs} ? $args{nrecs} : $config{perpage});
    34893502
    34903503  # sort reverse zones on IP, correctly
     
    35133526  # ensure consistent ordering by sorting on record_id too
    35143527  $sql .= ", record_id $args{sortorder}";
    3515   $sql .= ($args{offset} eq 'all' ? '' : " LIMIT $config{perpage} OFFSET ".$args{offset}*$config{perpage});
     3528  $sql .= ($args{offset} eq 'all' ? '' : " LIMIT $perpage OFFSET ".$args{offset}*$perpage);
    35163529
    35173530  my @bindvars = ($args{id});
Note: See TracChangeset for help on using the changeset viewer.