Changeset 120 for trunk/cgi-bin


Ignore:
Timestamp:
01/07/05 11:00:06 (19 years ago)
Author:
Kris Deugau
Message:

/trunk

Fixed some SQL bugs before they become problems - make sure to
use <<= and >>= in Postgres CIDR comparisons "just in case" the
items being compared are equal

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/cgi-bin/IPDB.pm

    r118 r120  
    408408      $msg = "Unable to deallocate $type $cidr";
    409409      $sth = $dbh->prepare("update poolips set custid='6750400',available='y',".
    410         "city=(select city from allocations ".
    411         "where cidr=(select pool from poolips where ip='$cidr')),".
     410        "city=(select city from allocations where cidr >>= '$cidr'),".
    412411        "description='',notes='',circuitid='' where ip='$cidr'");
    413412      $sth->execute;
     
    471470
    472471        # Set up query for compacting free blocks.
    473         $sth = $dbh->prepare("select * from freeblocks where cidr << ".
    474                 "(select cidr from routed where cidr >> '$cidr') ".
     472        $sth = $dbh->prepare("select * from freeblocks where cidr <<= ".
     473                "(select cidr from routed where cidr >>= '$cidr') ".
    475474                " and maskbits<=".$cidr->masklen." and routed='y' order by maskbits desc");
    476475
Note: See TracChangeset for help on using the changeset viewer.