Skip to content

Commit

Permalink
Flush the print statements
Browse files Browse the repository at this point in the history
  • Loading branch information
nigelhorne committed Mar 27, 2018
1 parent 6205905 commit 3791a03
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion createdatabase.PL
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,9 @@ if(my $oa = $ENV{'OPENADDR_HOME'}) {
my $filename = 'lib/Geo/Coder/Free/OpenAddresses/databases/states.txt';
if(-r $filename) {
# Import counties and states from https://github.com/openaddresses/openaddresses/tree/master/us-data
$| = 1;
printf "%-70s\r", $filename;
$| = 0;
my %state_fips;

my @data = @{xsv_slurp(
Expand Down Expand Up @@ -146,7 +148,9 @@ if(my $oa = $ENV{'OPENADDR_HOME'}) {
}

$filename = 'lib/Geo/Coder/Free/OpenAddresses/databases/counties.txt';
$| = 1;
printf "%-70s\r", $filename;
$| = 0;

@data = @{xsv_slurp(
shape => 'aoh',
Expand Down Expand Up @@ -577,11 +581,16 @@ if(my $oa = $ENV{'OPENADDR_HOME'}) {
}
}
flush_queue($dbh);
$| = 1;
printf "%-70s\r", 'creating index';
$| = 0;
$dbh->prepare('CREATE UNIQUE INDEX md5_index ON openaddresses(MD5)')->execute();
print ' ' x 70, "\r";
$| = 1;
printf "%-70s\r", 'committing';
$| = 0;
$dbh->commit();
$dbh->disconnect();
print ' ' x 70, "\r";
}

# TODO: Import the Maxmind databases
Expand Down

0 comments on commit 3791a03

Please sign in to comment.