Changeset 274


Ignore:
Timestamp:
May 14, 2006, 11:58:47 AM (14 years ago)
Author:
Dominic Hargreaves
Message:

fix for new schema

Location:
wiki-toolkit-plugin-locator-grid/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • wiki-toolkit-plugin-locator-grid/trunk/Changes

    r269 r274  
    110.04    14 May 2006
    22        Rename to Wiki::Toolkit::Plugin::Locator::Grid
     3        Move to new Wiki::Toolkit schema.
    34
    450.03    5 January 2005
  • wiki-toolkit-plugin-locator-grid/trunk/lib/Wiki/Toolkit/Plugin/Locator/Grid.pm

    r270 r274  
    227227    # radius $distance.  The SELECT DISTINCT is needed because we might
    228228    # have multiple versions in the table.
    229     my $sql = "SELECT DISTINCT x.node
    230                 FROM metadata AS x, metadata AS y
    231                 WHERE x.metadata_type = '$self->{x}'
    232                   AND y.metadata_type = '$self->{y}'
    233                   AND x.metadata_value >= " . ($sx - $metres)
    234             . "   AND x.metadata_value <= " . ($sx + $metres)
    235             . "   AND y.metadata_value >= " . ($sy - $metres)
    236             . "   AND y.metadata_value <= " . ($sy + $metres)
    237             . "   AND x.node = y.node";
    238     $sql .= "     AND x.node != " . $dbh->quote($args{node})
     229    my $sql = "SELECT DISTINCT x.name FROM node AS x INNER JOIN metadata
     230              AS mx ON (mx.node_id = x.id), node AS y INNER JOIN metadata my
     231              ON (my.node_id = y.id) WHERE mx.metadata_type = '$self->{x}'
     232                  AND my.metadata_type = '$self->{y}'
     233                  AND mx.metadata_value >= " . ($sx - $metres)
     234            . "   AND mx.metadata_value <= " . ($sx + $metres)
     235            . "   AND my.metadata_value >= " . ($sy - $metres)
     236            . "   AND my.metadata_value <= " . ($sy + $metres)
     237            . "   AND x.name = y.name";
     238    $sql .= "     AND x.name != " . $dbh->quote($args{node})
    239239        if $args{node};
    240240    # Postgres is a fussy bugger.
Note: See TracChangeset for help on using the changeset viewer.