Changeset 5 for trunk/DNSDB.pm


Ignore:
Timestamp:
09/01/09 17:07:57 (15 years ago)
Author:
Kris Deugau
Message:

/trunk

checkpoint
Delete domain mostly complete - need to fix up "redirection" after completion

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DNSDB.pm

    r4 r5  
    209209sub delDomain {
    210210  my $dbh = shift;
    211   my $domain = shift;
     211  my $domid = shift;
    212212
    213213  # Allow transactions, and raise an exception on errors so we can catch it later.
     
    218218  # Wrap all the SQL in a transaction
    219219  eval {
    220     # brute force.
    221     my $sth = $dbh->prepare("select domain_id from domains where domain=?");
    222     $sth->execute($domain);
    223     die "Domain not found, can't delete\n" if $sth->rows < 1;
    224     my ($id) = $sth->fetchrow_array;
    225 
    226     $sth = $dbh->prepare("delete from records where domain_id=$id");
    227     $sth->execute;
    228     $sth = $dbh->prepare("delete from domains where domain=?");
    229     $sth->execute($domain);
     220    my $sth = $dbh->prepare("delete from records where domain_id=?");
     221    $sth->execute($domid);
     222    $sth = $dbh->prepare("delete from domains where domain_id=?");
     223    $sth->execute($domid);
    230224
    231225    # once we get here, we should have suceeded.
Note: See TracChangeset for help on using the changeset viewer.