Changeset 752
- Timestamp:
- 06/29/15 18:24:51 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/cgi-bin/IPDB.pm
r749 r752 2216 2216 2217 2217 # We always update the "prime" block passed in... 2218 $dbh->do("UPDATE allocations SET cidr = ?, type = ? WHERE id = ?", undef,2219 ($newblock, $args{newtype}, $prime) ) 2220 # ... but only on existing container or pool types. Leaf -> container conversions 2221 # may need a new parent inserted instead. 2222 if $basetype =~ /[cm]/; 2218 my $updsth = $dbh->prepare("UPDATE allocations SET cidr = ?, type = ? WHERE id = ?"); 2219 2220 ##fixme: There's still an edge case in the return list where some branches accidentally include 2221 # the original block as "additional". Probably due to the ordering of when the prepared update 2222 # above gets executed. 2223 2223 2224 2224 # For leaf blocks, we may need to create a new parent as the "primary" instead … … 2280 2280 push @retlist, { block => "$newblock", type => $disp_alloctypes{$args{newtype}}, id => $prime }; 2281 2281 # update the primary allocation info 2282 $ dbh->do("UPDATE allocations SET cidr = ?, type = ? WHERE id = ?", undef, ($newblock, $args{newtype}, $prime));2282 $updsth->execute($newblock, $args{newtype}, $prime); 2283 2283 # Reparent the free blocks in the new block 2284 2284 $fbreparentsth->execute($prime, $binfo->{master_id}, $binfo->{city}, $newcontainerclass, $binfo->{vrf}, … … 2349 2349 } # merge peers 2350 2350 # update the primary allocation info. Do this last so we don't stomp extra data-retrieval in the loop above 2351 $ dbh->do("UPDATE allocations SET cidr = ?, type = ? WHERE id = ?", undef, ($newblock, $args{newtype}, $prime));2351 $updsth->execute($newblock, $args{newtype}, $prime); 2352 2352 2353 2353 } # scope … … 2404 2404 } 2405 2405 # Update the primary allocation info. 2406 $ dbh->do("UPDATE allocations SET cidr = ?, type = ? WHERE id = ?", undef, ($newblock, $args{newtype}, $prime));2406 $updsth->execute($newblock, $args{newtype}, $prime); 2407 2407 # Delete any lingering free blocks 2408 2408 $dbh->do("DELETE FROM freeblocks WHERE parent_id = ? AND cidr <<= ?", undef, $binfo->{parent_id}, $newblock); … … 2416 2416 # keepall, mergepeer, and clearpeer all imply keeping suballocations, where leaf allocations 2417 2417 # by definition do not have suballocations. 2418 # Update the old allocation 2419 $updsth->execute($newblock, $args{newtype}, $prime); 2418 2420 # Snag the new parent info for the return list 2419 2421 push @retlist, {block => "$newblock", type => $disp_alloctypes{$args{newtype}}, id => $prime};
Note:
See TracChangeset
for help on using the changeset viewer.