Changeset 720 for trunk/cgi-bin/IPDB.pm
- Timestamp:
- 05/07/15 15:17:05 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/cgi-bin/IPDB.pm
r716 r720 29 29 &initIPDBGlobals &connectDB &finish &checkDBSanity 30 30 &addMaster &touchMaster 31 &listSummary &listSubs &listContainers &listAllocations &listF ree &listPool31 &listSummary &listSubs &listContainers &listAllocations &listForMerge &listFree &listPool 32 32 &getMasterList &getTypeList &getPoolSelect &findAllocateFrom 33 33 &ipParent &subParent &blockParent &getBreadCrumbs &getRoutedCity … … 45 45 &initIPDBGlobals &connectDB &finish &checkDBSanity 46 46 &addMaster &touchMaster 47 &listSummary &listSubs &listContainers &listAllocations &listF ree &listPool47 &listSummary &listSubs &listContainers &listAllocations &listForMerge &listFree &listPool 48 48 &getMasterList &getTypeList &getPoolSelect &findAllocateFrom 49 49 &ipParent &subParent &blockParent &getBreadCrumbs &getRoutedCity … … 810 810 811 811 812 ## IPDB::listForMerge() 813 # Get a list of blocks targetted in a proposed merge 814 sub listForMerge { 815 my $dbh = shift; 816 my $parent = shift; 817 my $newblock = shift; 818 my $btype = shift || 'a'; 819 $btype = 'a' if $btype !~/^[af]$/; 820 821 my $sql; 822 if ($btype eq 'a') { 823 my $ret = $dbh->selectall_arrayref(q( 824 SELECT a.cidr,a.id,t.dispname FROM allocations a 825 JOIN alloctypes t ON a.type=t.type 826 WHERE a.parent_id = ? AND a.cidr <<= ? 827 ORDER BY a.cidr 828 ), 829 { Slice => {} }, $parent, $newblock); 830 return $ret; 831 } else { 832 ##fixme: Not sure about the casting hackery in "SELECT ?::integer AS id", but it works as intended 833 my $ret = $dbh->selectall_arrayref(q( 834 SELECT cidr,id FROM freeblocks 835 WHERE parent_id IN (SELECT ?::integer AS id UNION 836 SELECT id FROM allocations WHERE parent_id = ? AND cidr <<= ? 837 ) AND cidr <<= ? 838 ORDER BY cidr 839 ), 840 { Slice => {} }, $parent, $parent, $newblock, $newblock) or print $dbh->errstr; 841 return $ret; 842 } 843 } # end listForMerge() 844 845 812 846 ## IPDB::listFree() 813 847 # Gets a list of free blocks in the requested parent/master and VRF instance in both CIDR and range notation
Note:
See TracChangeset
for help on using the changeset viewer.