Changeset 712 for trunk/cgi-bin


Ignore:
Timestamp:
03/25/15 17:11:27 (10 years ago)
Author:
Kris Deugau
Message:

/trunk

Exclude $self from the count of allocations in a container in listSubs()
and listContainers()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/cgi-bin/IPDB.pm

    r707 r712  
    524524        "AND type ~ '[mc]\$' AND master_id = ? AND NOT cidr = ? ");
    525525  my $alsth = $dbh->prepare("SELECT count(*) FROM allocations WHERE cidr <<= ? ".
    526         "AND NOT type='rm' AND NOT type='mm' AND master_id = ?");
     526        "AND NOT type='rm' AND NOT type='mm' AND master_id = ? AND NOT id = ?");
    527527  my $freesth = $dbh->prepare("SELECT count(*) FROM freeblocks WHERE cidr <<= ? AND master_id = ?");
    528528  my $lfreesth = $dbh->prepare("SELECT masklen(cidr) AS maskbits FROM freeblocks WHERE cidr <<= ?".
     
    537537    $substh->execute($cidr, $mid, $cidr);
    538538    my ($cont) = $substh->fetchrow_array();
    539     $alsth->execute($cidr, $mid);
     539    $alsth->execute($cidr, $mid, $id);
    540540    my ($alloc) = $alsth->fetchrow_array();
    541541    $freesth->execute($cidr, $mid);
     
    588588
    589589  my $alsth = $dbh->prepare("SELECT count(*) FROM allocations WHERE cidr <<= ? ".
    590         "AND NOT type='rm' AND NOT type='mm' AND master_id = ?");
     590        "AND NOT type='rm' AND NOT type='mm' AND master_id = ? AND NOT id = ?");
    591591  my $freesth = $dbh->prepare("SELECT count(*) FROM freeblocks WHERE cidr <<= ? AND master_id = ?");
    592592  my $lfreesth = $dbh->prepare("SELECT masklen(cidr) AS maskbits FROM freeblocks WHERE cidr <<= ?".
     
    597597    $desc .= " - vrf:$vrf" if $desc && $vrf;
    598598    $desc = "vrf:$vrf" if !$desc && $vrf;
    599     $alsth->execute($cidr, $mid);
     599    $alsth->execute($cidr, $mid, $id);
    600600    my ($alloc) = $alsth->fetchrow_array();
    601601    $freesth->execute($cidr, $mid);
Note: See TracChangeset for help on using the changeset viewer.