Changeset 625 for trunk/cgi-bin
- Timestamp:
- 10/08/14 16:25:51 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/cgi-bin/IPDB.pm
r591 r625 424 424 my $dbh = shift; 425 425 426 my $mlist = $dbh->selectall_arrayref("SELECT cidr AS master FROM masterblocks ORDER BY cidr", { Slice => {} }); 426 my $mlist = $dbh->selectall_arrayref("SELECT cidr AS master,id,vrf FROM allocations ". 427 "WHERE type='mm' ORDER BY cidr", 428 { Slice => {} }); 427 429 428 430 foreach (@{$mlist}) { 429 my ($rcnt) = $dbh->selectrow_array("SELECT count(*) FROM allocations WHERE cidr <<= ? AND type='rm' ",430 undef, ($$_{master} ));431 my ($rcnt) = $dbh->selectrow_array("SELECT count(*) FROM allocations WHERE cidr <<= ? AND type='rm' AND master_id = ?", 432 undef, ($$_{master}, $$_{id})); 431 433 $$_{routed} = $rcnt; 432 my ($acnt) = $dbh->selectrow_array("SELECT count(*) FROM allocations WHERE cidr <<= ? AND NOT type='rm'", 433 undef, ($$_{master})); 434 my ($acnt) = $dbh->selectrow_array("SELECT count(*) FROM allocations WHERE cidr <<= ? ". 435 "AND NOT type='rm' AND NOT type='mm' AND master_id = ?", 436 undef, ($$_{master}, $$_{id})); 434 437 $$_{allocated} = $acnt; 435 my ($fcnt) = $dbh->selectrow_array("SELECT count(*) FROM freeblocks WHERE cidr <<= ? ",436 undef, ($$_{master} ));438 my ($fcnt) = $dbh->selectrow_array("SELECT count(*) FROM freeblocks WHERE cidr <<= ? AND master_id = ?", 439 undef, ($$_{master}, $$_{id})); 437 440 $$_{free} = $fcnt; 438 441 my ($bigfree) = $dbh->selectrow_array("SELECT masklen(cidr) AS maskbits FROM freeblocks WHERE cidr <<= ?". 439 " AND parent = ? ORDER BY masklen(cidr) LIMIT 1", undef, ($$_{master}, $$_{master}));442 " AND master_id = ? ORDER BY masklen(cidr) LIMIT 1", undef, ($$_{master}, $$_{id})); 440 443 ##fixme: should find a way to do this without having to HTMLize the <> 441 444 $bigfree = "/$bigfree" if $bigfree;
Note:
See TracChangeset
for help on using the changeset viewer.