Changeset 653 for trunk/cgi-bin
- Timestamp:
- 12/17/14 18:04:01 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/cgi-bin/IPDB.pm
r652 r653 500 500 my $custsth = $dbh->prepare("SELECT count(*) FROM customers WHERE custid = ?"); 501 501 502 # snag some more details 503 my $substh = $dbh->prepare("SELECT count(*) FROM allocations WHERE cidr <<= ? AND type='rm' AND master_id = ? AND NOT cidr = ? "); 504 my $alsth = $dbh->prepare("SELECT count(*) FROM allocations WHERE cidr <<= ? ". 505 "AND NOT type='rm' AND NOT type='mm' AND master_id = ?"); 506 my $freesth = $dbh->prepare("SELECT count(*) FROM freeblocks WHERE cidr <<= ? AND master_id = ?"); 507 my $lfreesth = $dbh->prepare("SELECT masklen(cidr) AS maskbits FROM freeblocks WHERE cidr <<= ?". 508 " AND master_id = ? ORDER BY masklen(cidr) LIMIT 1"); 509 502 510 my @blocklist; 503 while (my ($cidr,$city,$type,$custid,$swip,$desc,$id ) = $sth->fetchrow_array()) {511 while (my ($cidr,$city,$type,$custid,$swip,$desc,$id,$mid) = $sth->fetchrow_array()) { 504 512 $custsth->execute($custid); 505 513 my ($ncust) = $custsth->fetchrow_array(); 514 $substh->execute($cidr, $mid, $cidr); 515 my ($cont) = $substh->fetchrow_array(); 516 $alsth->execute($cidr, $mid); 517 my ($alloc) = $alsth->fetchrow_array(); 518 $freesth->execute($cidr, $mid); 519 my ($free) = $freesth->fetchrow_array(); 520 $lfreesth->execute($cidr, $mid); 521 my ($lfree) = $lfreesth->fetchrow_array(); 522 $lfree = "/$lfree" if $lfree; 523 $lfree = '<NONE>' if !$lfree; 506 524 my %row = ( 507 525 block => $cidr, 526 subcontainers => $cont, 527 suballocs => $alloc, 528 subfree => $free, 529 lfree => $lfree, 508 530 city => $city, 509 531 type => $disp_alloctypes{$type},
Note:
See TracChangeset
for help on using the changeset viewer.