Changeset 246


Ignore:
Timestamp:
02/27/12 18:04:23 (12 years ago)
Author:
Kris Deugau
Message:

/trunk

Move SOA update SQL into DNSDB.pm while we update it for
handling reverse zones. See #26.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DNSDB.pm

    r244 r246  
    18011801  my $sth = $dbh->prepare($sql);
    18021802  $sth->execute($id);
     1803##fixme:  stick a flag somewhere if the record doesn't exist.  by the API, this is an impossible case, but...
    18031804
    18041805  my ($recid,$host,$val,$ttl) = $sth->fetchrow_array() or return;
     
    18181819  return %ret;
    18191820} # end getSOA()
     1821
     1822
     1823## DNSDB::updateSOA()
     1824# Update the specified SOA record
     1825# Takes a database handle, default/live flag, forward/reverse flag, and SOA data hash
     1826sub updateSOA {
     1827  my $dbh = shift;
     1828  my $defrec = shift;
     1829  my $reverc = shift;
     1830
     1831  my %soa = @_;
     1832
     1833##fixme: data validation: make sure {recid} is really the SOA for {parent}
     1834  my $sql = "UPDATE "_rectable($defrec, $revrec)." SET host=?, val=?, ttl=? WHERE record_id=? AND type=6";
     1835  $sth = $dbh->prepare($sql);
     1836  $sth->execute("$soa{contact}:$soa{prins}", "$soa{refresh}:$soa{retry}:$soa{expire}:$soa{minttl}",
     1837        $soa{ttl}, $soa{recid});
     1838
     1839} # end updateSOA()
    18201840
    18211841
Note: See TracChangeset for help on using the changeset viewer.