Changeset 326


Ignore:
Timestamp:
Nov 5, 2006, 1:51:58 PM (13 years ago)
Author:
Dominic Hargreaves
Message:

Can now update too.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/npemap.org.uk/scripts/process-problems

    r325 r326  
    5858}
    5959
    60 my $del1sth = $dbh->prepare("UPDATE postcodes SET deleted = 't', delete_reason = 1 WHERE id = ?");
    61 my $del2sth = $dbh->prepare("UPDATE bad_postcodes SET actioned = 't' WHERE postcode = ?");
     60my $delsth = $dbh->prepare("UPDATE postcodes SET deleted = 't', delete_reason = 1 WHERE id = ?");
     61my $actionsth = $dbh->prepare("UPDATE bad_postcodes SET actioned = 't' WHERE postcode = ?");
     62my $updsth = $dbh->prepare("UPDATE postcodes SET outward = ?, inward = ? WHERE id = ?");
    6263
    6364# Now prompt for deletions
     
    6768        last;
    6869    }
    69     print "Resolve problem by deleting (^C to exit): ";
     70    print "ID to resolve? (^C to exit): ";
    7071    my $input = <STDIN>;
    7172    chomp $input;
    7273    if ($probids{$input}) {
    73         $del1sth->execute($input) or warn $dbh->errstr;
    74         $del2sth->execute($input) or warn $dbh->errstr;
     74        print "d for delete or comma separated postcode to update: ";
     75        my $input2 = <STDIN>;
     76        if ($input2 =~ /^d$/i) {
     77            $delsth->execute($input) or warn $dbh->errstr;
     78        } elsif ($input2 =~ /(\w+),(\w+)/) {
     79            $updsth->execute($1, $2, $input) or warn $dbh->errstr;
     80        } else {
     81            print "invalid input\n";
     82            next;
     83        }
     84        $actionsth->execute($input) or warn $dbh->errstr;
    7585        delete $probids{$input};
    7686    } else {
Note: See TracChangeset for help on using the changeset viewer.