Changeset 890


Ignore:
Timestamp:
09/02/16 16:29:25 (8 years ago)
Author:
Kris Deugau
Message:

/trunk

Updates to RPC findAllocation() to provide more details to the caller
in one shot

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/cgi-bin/ipdb-rpc.cgi

    r886 r890  
    462462  die "IP to search for required\n" if !$args{ip} || $args{ip} !~ /^\d+\.\d+\.\d+\.\d+$/;
    463463
    464   my $sql = "SELECT cidr,custid,type FROM searchme WHERE cidr >>= ?";
     464  my $sql = q(SELECT s.cidr,s.custid,s.type,s.description,a.dispname
     465    FROM searchme s
     466    JOIN alloctypes a ON s.type = a.type
     467    WHERE cidr >>= ?);
    465468  # first, check if it's even on our network
    466   my $isours = $ip_dbh->selectall_arrayref($sql." AND type = 'mm'", undef, $args{ip});
     469  my $isours = $ip_dbh->selectall_arrayref($sql." AND s.type = 'mm'", undef, $args{ip});
    467470  die $ip_dbh->errstr."\n" if $ip_dbh->err;  # do we care?
    468471  die "IP not on our network\n" if !@$isours;
    469472
    470473  # now, find the specific allocation
    471   my $result = $ip_dbh->selectall_arrayref($sql." AND NOT type LIKE '_m' ORDER BY cidr DESC",
     474  my $result = $ip_dbh->selectall_arrayref($sql." AND NOT s.type LIKE '_m' ORDER BY cidr DESC",
    472475    { Slice => {} }, $args{ip});
    473476  die $ip_dbh->errstr."\n" if $ip_dbh->err;
Note: See TracChangeset for help on using the changeset viewer.