Changeset 222 for trunk


Ignore:
Timestamp:
01/18/12 13:47:47 (13 years ago)
Author:
Kris Deugau
Message:

/trunk

Fix buglet in record list filter; we have to adjust the list of bind
variables depending on whether there's a filter to apply or not.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DNSDB.pm

    r219 r222  
    13171317  $sql .= " LIMIT $nrecs OFFSET ".($nstart*$nrecs) if $nstart ne 'all';
    13181318
     1319  my @bindvars = ($id);
     1320  push @bindvars, $filter if $filter;
    13191321  my $sth = $dbh->prepare($sql) or warn $dbh->errstr;
    1320   $sth->execute($id) or warn "$sql: ".$sth->errstr;
     1322  $sth->execute(@bindvars) or warn "$sql: ".$sth->errstr;
    13211323
    13221324  my @retbase;
     
    13441346  $filter =~ s/[^a-zA-Z0-9_.:-]//g;
    13451347
     1348  my @bindvars = ($id);
     1349  push @bindvars, $filter if $filter;
    13461350  my ($count) = $dbh->selectrow_array("SELECT count(*) FROM ".
    13471351        ($defrec eq 'y' ? 'default_' : '')."records ".
    13481352        "WHERE ".($defrec eq 'y' ? 'group' : 'domain')."_id=? ".
    13491353        "AND NOT type=$reverse_typemap{SOA}".
    1350         ($filter ? " AND host ILIKE '%$filter%'" : ''),
    1351         undef, ($id) );
     1354        ($filter ? " AND host ~* ?" : ''),
     1355        undef, (@bindvars) );
    13521356
    13531357  return $count;
Note: See TracChangeset for help on using the changeset viewer.