Changeset 714 for trunk/cgi-bin
- Timestamp:
- 03/27/15 17:03:27 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/cgi-bin/IPDB.pm
r713 r714 750 750 my $tgroup = shift || 'a'; # technically optional, like this, but should 751 751 # really be specified in the call for clarity 752 my $tlist; 752 my $seltype = shift || ''; 753 754 my $sql = "SELECT type,listname,type=? AS sel FROM alloctypes WHERE listorder <= 500"; 753 755 if ($tgroup eq 'n') { 754 756 # grouping 'p' - all netblock types. These include routed blocks, containers (_c) 755 757 # and contained (_r) types, dynamic-allocation ranges (_e), static IP pools (_d and _p), 756 758 # and the "miscellaneous" cn, in, and en types. 757 $tlist = $dbh->selectall_arrayref("SELECT type,listname FROM alloctypes WHERE listorder <= 500 ". 758 "AND type NOT LIKE '_i' ORDER BY listorder", { Slice => {} }); 759 $sql .= " AND type NOT LIKE '_i'"; 759 760 } elsif ($tgroup eq 'p') { 760 761 # grouping 'p' - primary allocation types. As with 'n' above but without the _r contained types. 761 $tlist = $dbh->selectall_arrayref("SELECT type,listname FROM alloctypes WHERE listorder <= 500 ". 762 "AND type NOT LIKE '_i' AND type NOT LIKE '_r' ORDER BY listorder", { Slice => {} }); 762 $sql .= " AND type NOT LIKE '_i' AND type NOT LIKE '_r'"; 763 763 } elsif ($tgroup eq 'c') { 764 764 # grouping 'c' - contained types. These include all static IPs and all _r types. 765 $tlist = $dbh->selectall_arrayref("SELECT type,listname FROM alloctypes WHERE listorder <= 500 ". 766 " AND (type LIKE '_i' OR type LIKE '_r') ORDER BY listorder", { Slice => {} }); 765 $sql .= " AND (type LIKE '_i' OR type LIKE '_r')"; 767 766 } elsif ($tgroup eq 'i') { 768 767 # grouping 'i' - static IP types. 769 $tlist = $dbh->selectall_arrayref("SELECT type,listname FROM alloctypes WHERE listorder <= 500 ". 770 " AND type LIKE '_i' ORDER BY listorder", { Slice => {} }); 768 $sql .= " AND type LIKE '_i'"; 771 769 } else { 772 770 # grouping 'a' - all standard allocation types. This includes everything 773 771 # but mm (present only as a formality). Make this the default. 774 $tlist = $dbh->selectall_arrayref("SELECT type,listname FROM alloctypes WHERE listorder <= 500 ". 775 " ORDER BY listorder", { Slice => {} }); 776 } 772 # ... whee! no extra WHERE clauses 773 } 774 $sql .= " ORDER BY listorder"; 775 my $tlist = $dbh->selectall_arrayref($sql, { Slice => {} }, $seltype); 777 776 return $tlist; 778 777 }
Note:
See TracChangeset
for help on using the changeset viewer.