Changeset 352


Ignore:
Timestamp:
06/27/12 17:07:33 (12 years ago)
Author:
Kris Deugau
Message:

/trunk

Tweak getDomRecs() to return reverse zone entries sorted by val
in the "correct" order by casting val as inet.

See #26

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DNSDB.pm

    r350 r352  
    30393039  my $filter = shift || '';
    30403040
     3041  # sort reverse zones on IP, correctly
     3042  # do other fiddling with $order while we're at it.
     3043  $order = "r.$order";
     3044  $order = 'CAST (r.val AS inet)' if $rev eq 'y' && $order eq 'r.val';
     3045  $order = 't.alphaorder' if $order eq 'r.type';
     3046
    30413047  my $sql = "SELECT r.record_id,r.host,r.type,r.val,r.ttl";
    30423048  $sql .= ",r.distance,r.weight,r.port" if $rev eq 'n';
     
    30473053  $sql .= " AND host ~* ?" if $filter;
    30483054  # use alphaorder column for "correct" ordering of sort-by-type instead of DNS RR type number
    3049   $sql .= " ORDER BY ".($order eq 'type' ? 't.alphaorder' : "r.$order")." $direction";
     3055  $sql .= " ORDER BY $order $direction";
    30503056  # ensure consistent ordering by sorting on record_id too
    30513057  $sql .= ", record_id $direction";
Note: See TracChangeset for help on using the changeset viewer.