Changeset 516 for trunk/DNSDB.pm
- Timestamp:
- 05/24/13 16:58:49 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/DNSDB.pm
r514 r516 1811 1811 my $state = shift; 1812 1812 return ('FAIL',"Domain status must be specified\n") if !defined($state); 1813 my $defloc = shift || ''; 1813 1814 1814 1815 $state = 1 if $state =~ /^active$/; … … 1838 1839 eval { 1839 1840 # insert the domain... 1840 $dbh->do("INSERT INTO domains (domain,group_id,status) VALUES (?,?,?)", undef, ($domain, $group, $state)); 1841 $dbh->do("INSERT INTO domains (domain,group_id,status,default_location) VALUES (?,?,?,?)", undef, 1842 ($domain, $group, $state, $defloc)); 1841 1843 1842 1844 # get the ID... … … 1849 1851 # ... and now we construct the standard records from the default set. NB: group should be variable. 1850 1852 my $sth = $dbh->prepare("SELECT host,type,val,distance,weight,port,ttl FROM default_records WHERE group_id=?"); 1851 my $sth_in = $dbh->prepare("INSERT INTO records (domain_id,host,type,val,distance,weight,port,ttl )".1852 " VALUES ($dom_id,?,?,?,?,?,?,? )");1853 my $sth_in = $dbh->prepare("INSERT INTO records (domain_id,host,type,val,distance,weight,port,ttl,location)". 1854 " VALUES ($dom_id,?,?,?,?,?,?,?,?)"); 1853 1855 $sth->execute($group); 1854 while (my ($host, $type,$val,$dist,$weight,$port,$ttl) = $sth->fetchrow_array()) {1856 while (my ($host, $type, $val, $dist, $weight, $port, $ttl) = $sth->fetchrow_array()) { 1855 1857 $host =~ s/DOMAIN/$domain/g; 1856 1858 $val =~ s/DOMAIN/$domain/g; 1857 $sth_in->execute($host, $type,$val,$dist,$weight,$port,$ttl);1859 $sth_in->execute($host, $type, $val, $dist, $weight, $port, $ttl, $defloc); 1858 1860 if ($typemap{$type} eq 'SOA') { 1859 1861 my @tmp1 = split /:/, $host;
Note:
See TracChangeset
for help on using the changeset viewer.