Changeset 5 for trunk/DNSDB.pm
- Timestamp:
- 09/01/09 17:07:57 (15 years ago)
- File:
-
- 1 edited
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.
Note:
See TracChangeset
for help on using the changeset viewer.