Changeset 157


Ignore:
Timestamp:
10/28/11 16:56:10 (13 years ago)
Author:
Kris Deugau
Message:

/trunk

Handle case of "id not found" in isParent(). If the requested
id can't be found, obviously the other id can't be its parent.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DNSDB.pm

    r155 r157  
    14791479##todo:  immediate, secondary, full (default)
    14801480
     1481  # Return false on invalid types
     1482  return 0 if !grep /^$type1$/, ('record','defrec','user','domain','group');
     1483  return 0 if !grep /^$type2$/, ('record','defrec','user','domain','group');
     1484
    14811485  # Return false on impossible relations
    14821486  return 0 if $type1 eq 'record';       # nothing may be a child of a record
     
    14991503    my $sql = "SELECT $par_col{$type} FROM $par_tbl{$type} WHERE $id_col{$type} = ?";
    15001504    my $result = $dbh->selectrow_hashref($sql,
    1501         undef, ($id) ) or warn $dbh->errstr." $sql";
    1502     if ($result->{$par_col{$type}} == $id1) {
     1505        undef, ($id) );
     1506    if ($result && $result->{$par_col{$type}} == $id1) {
    15031507      $foundparent = 1;
     1508      last;
     1509    } else {
     1510##fixme: do we care about trying to return a "no such record/domain/user/group" error?
     1511      warn $dbh->errstr." $sql, $id" if $dbh->errstr;
    15041512      last;
    15051513    }
Note: See TracChangeset for help on using the changeset viewer.