Skip to content

Commit

Permalink
Some zips are not unique
Browse files Browse the repository at this point in the history
  • Loading branch information
nigelhorne committed Mar 14, 2018
1 parent 337046c commit 12ab8a4
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions createdatabase.PL
Original file line number Diff line number Diff line change
Expand Up @@ -266,16 +266,13 @@ if(my $oa = $ENV{'OPENADDR_HOME'}) {
$city = $place->{'place name'};
$zipcodes{$zip} = { 'city' => $city };
# print "$zip => $city\n";
# $query = "INSERT OR REPLACE INTO openaddresses('LAT','LON','CITY','STATE','COUNTRY'" .
my $digest = Digest::MD5::md5_base64($place->{'latitude'}, $place->{'longitude'}, $city, $state, 'US');
$query = "INSERT INTO openaddresses('MD5','LAT','LON','CITY','STATE','COUNTRY'" .
$query = "INSERT OR REPLACE INTO openaddresses('MD5','LAT','LON','CITY','STATE','COUNTRY'" .
') VALUES (' .
"'$digest'," .
"'" . $place->{'latitude'} . "'," .
"'" . $place->{'longitude'} . "'," .
"'$city'," .
# "'" . $place->{'state abbreviation'} . "'," .
"'$state', 'US')";
"'$city','$state','US')";
# print "$zip => $query\n";
$dbh->prepare($query)->execute();
}
Expand Down

0 comments on commit 12ab8a4

Please sign in to comment.