bluefeet / Geo-Distance

Calculate distances and closest locations. (DEPRECATED)
https://metacpan.org/pod/Geo::Distance
Other
6 stars 5 forks source link

Pull request -- bug fix and typo #1

Closed anirvan closed 13 years ago

anirvan commented 13 years ago

Hi Aran.

I use Geo::Distance, but noticed that the SQL generated at around line 390 made DBDs powered by SQL::Statement (e.g. DBD::AnyData) die like this:

DBD::AnyData::db prepare failed: Bad table or column name: 'lon >=?' has chars not alphanumeric or underscore! at /usr/lib/perl5/site_perl/5.8.8/SQL/Statement.pm line 88 [for Statement " SELECT lon,lat,code FROM hub_lat_lon WHERE lon>=? AND lat>=? AND lon<=? AND lat<=? "] at /usr/lib/perl5/site_perl/5.8.8/Geo/Distance.pm line 392

I fixed this by putting some spaces in, e.g. "lon>=?" is now "lon >= ?"

You can verify that this is an issue with SQL::Statement by running this code:

use SQL::Statement;
my $parser = SQL::Parser->new();
$parser->parse('SELECT a FROM b WHERE c>=?');

Thanks for incorporating this fix!

bluefeet commented 13 years ago

Thanks!