Changeset 591 for trunk


Ignore:
Timestamp:
Oct 17, 2007, 3:22:37 PM (12 years ago)
Author:
Nick Burch
Message:

Rename import script

File:
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/npemap.org.uk/scripts/npemap-importer/importer.pl

    r590 r591  
    33#                   ----------------------
    44#
    5 # This script handles downloading the latest NPEMaps dataset export, and
    6 the latest FreeThePostcode export, and importing them into a local
     5# This script handles downloading the latest NPEMaps dataset export (but
     6not the latest FreeThePostcode export), and importing it into a local
    77#  copy of the NPE Maps database.
    88# This allows you to run your own copy of the NPE Maps api, and have it
    99#  loaded with the latest data nightly / weekly
     10# (You will almost certainly want to schedule a run of the
     11#  freethepostcode importer too)
     12#
    1013# Warning - you should not be tracking bad postcodes if you use this
    11 #  script, as it will zap everything between runs!
     14#  script, as it will zap everything it has previously imported between
     15#   runs!
    1216
    1317# Find our private perl libraries
     
    2327if($?) { exit $?; }
    2428
     29# Our entry in the sources table
     30my $source = 2;
     31
    2532# Clear out the current entries
    2633my $dbh = setup_dbh();
    27 my $del = $dbh->prepare("DELETE FROM postcodes");
    28 $del->execute();
    29 
    30 # Our entry in the sources table
    31 my $source = 2;
     34my $del = $dbh->prepare("DELETE FROM postcodes WHERE source = ?");
     35$del->execute($source);
    3236
    3337# Load up the new ones
     
    4953# Close our connection
    5054$dbh->disconnect;
    51 
    52 # Run the FTP importer
    53 print `$FindBin::Bin/../freethepostcode.org-importer/importer.py --download --no-confirm`;
Note: See TracChangeset for help on using the changeset viewer.