Changeset 630 for trunk/cgi-bin
- Timestamp:
- 10/08/14 17:31:48 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/cgi-bin/IPDB.pm
r629 r630 590 590 ## IPDB::listFree() 591 591 # Gets a list of free blocks in the requested parent/master and VRF instance in both CIDR and range notation 592 # Takes a parent/master and an optional VRF specifier that defaults to empty.592 # Takes a parent/master ID and an optional VRF specifier that defaults to empty. 593 593 # Returns an arrayref to a list of hashrefs containing the CIDR and range-notation blocks 594 594 # Returns some extra flags in the hashrefs for routed blocks, since those can have several subtypes … … 599 599 # Just In Case 600 600 $args{vrf} = '' if !$args{vrf}; 601 $args{rdepth} = 1 if !$args{rdepth}; 602 603 # do it this way so we can waste a little less time iterating 604 # my $sth = $dbh->prepare("SELECT cidr FROM freeblocks WHERE parent = ? AND rdepth = ? AND vrf = ? ". 605 my $sth = $dbh->prepare("SELECT cidr FROM freeblocks WHERE parent = ? AND rdepth = ? ". 606 "ORDER BY cidr"); 607 # $sth->execute($args{master}, $args{rdepth}, $args{vrf}); 608 $sth->execute($args{master}, $args{rdepth}); 601 602 my $sth = $dbh->prepare("SELECT cidr,id FROM freeblocks WHERE parent_id = ? ORDER BY cidr"); 603 # $sth->execute($args{parent}, $args{vrf}); 604 $sth->execute($args{parent}); 609 605 my @flist; 610 while (my ($cidr ) = $sth->fetchrow_array()) {606 while (my ($cidr,$id) = $sth->fetchrow_array()) { 611 607 $cidr = new NetAddr::IP $cidr; 612 608 my %row = ( 613 609 fblock => "$cidr", 614 610 frange => $cidr->range, 611 fbid => $id, 612 fbparent => $args{parent}, 615 613 ); 616 614 push @flist, \%row; … … 626 624 my $pool = shift; 627 625 628 my $sth = $dbh->prepare("SELECT ip,custid,available,description,type, rdepth".629 " FROM poolips WHERE p ool= ? ORDER BY ip");626 my $sth = $dbh->prepare("SELECT ip,custid,available,description,type,id". 627 " FROM poolips WHERE parent_id = ? ORDER BY ip"); 630 628 $sth->execute($pool); 631 629 my @poolips; 632 while (my ($ip,$custid,$available,$desc,$type,$ rdepth) = $sth->fetchrow_array) {630 while (my ($ip,$custid,$available,$desc,$type,$id) = $sth->fetchrow_array) { 633 631 my %row = ( 634 632 ip => $ip, … … 637 635 desc => $desc, 638 636 delme => $available eq 'n', 639 ipdepth => $rdepth, 637 parent => $pool, 638 id => $id, 640 639 ); 641 640 push @poolips, \%row;
Note:
See TracChangeset
for help on using the changeset viewer.