Legend:
- Unmodified
- Added
- Removed
-
trunk/DNSDB.pm
r4 r5 209 209 sub delDomain { 210 210 my $dbh = shift; 211 my $dom ain= shift;211 my $domid = shift; 212 212 213 213 # Allow transactions, and raise an exception on errors so we can catch it later. … … 218 218 # Wrap all the SQL in a transaction 219 219 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); 230 224 231 225 # once we get here, we should have suceeded. -
trunk/dns.cgi
r4 r5 300 300 } 301 301 302 } elsif ($webvar{page} eq 'deldom') { 303 304 $page->param(id => $webvar{id}); 305 # first pass = confirm y/n (sorta) 306 if (!defined($webvar{del})) { 307 $page->param(del_getconf => 1); 308 $page->param(domain => domainName($dbh,$webvar{id})); 309 # print some neato things? 310 } elsif ($webvar{del} eq 'ok') { 311 my ($code,$msg) = delDomain($dbh, $webvar{id}); 312 if ($code ne 'OK') { 313 # need to find failure mode 314 $page->param(del_failed => 1); 315 $page->param(errmsg => $msg); 316 } 317 } else { 318 # cancelled. whee! 319 $page->param(del_failed => 0); 320 # more params? 321 } 322 302 323 } elsif ($webvar{page} eq 'editsoa') { 303 324
Note:
See TracChangeset
for help on using the changeset viewer.