Changeset 534 for trunk/cgi-bin/IPDB.pm
- Timestamp:
- 10/31/12 16:51:18 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/cgi-bin/IPDB.pm
r533 r534 1184 1184 1185 1185 ## IPDB::getBlockData() 1186 # Return custid, type, city, and description for a block 1186 # Get CIDR or IP, custid, type, city, circuit ID, description, notes, modification time, private/restricted 1187 # data, for a CIDR block or pool IP 1188 # Also returns SWIP status flag for CIDR blocks 1189 # Takes the block/IP to look up 1190 # Returns an arrayref to a list of hashrefs 1187 1191 sub getBlockData { 1188 1192 my $dbh = shift; 1189 1193 my $block = shift; 1190 1194 1191 my $binfo = $dbh->selectrow_hashref("SELECT cidr,custid,type,city,description FROM searchme". 1192 " WHERE cidr = ?", undef, ($block) ); 1195 my $cidr = new NetAddr::IP $block; 1196 1197 my $keycol = 'cidr'; 1198 my $blocktable = 'allocations'; 1199 my $poolip = 0; 1200 1201 # Pool IP and IPv6 check all in one! Still needs to be tightened 1202 # up a little for the as-yet-unhandled case of IPv6 IP pools 1203 if ($cidr->bits == 32 && $cidr->masklen == 32) { 1204 $poolip = 1; 1205 $keycol = 'ip'; 1206 $blocktable = 'poolips'; 1207 } 1208 my $binfo = $dbh->selectrow_hashref("SELECT $keycol AS block, custid, type, city, circuitid, description,". 1209 " notes, modifystamp AS lastmod, privdata".($poolip ? '' : ', swip')." FROM $blocktable". 1210 " WHERE $keycol = ?", undef, ($block) ); 1193 1211 return $binfo; 1194 1212 } # end getBlockData()
Note:
See TracChangeset
for help on using the changeset viewer.