Changeset 334
- Timestamp:
- 05/09/12 22:24:27 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/DNSDB.pm
r333 r334 3973 3973 3974 3974 my $domsth = $dbh->prepare("SELECT domain_id,domain,status FROM domains WHERE status=1"); 3975 my $recsth = $dbh->prepare("SELECT host,type,val,distance,weight,port,ttl ".3975 my $recsth = $dbh->prepare("SELECT host,type,val,distance,weight,port,ttl,record_id ". 3976 3976 "FROM records WHERE domain_id=?"); 3977 3977 $domsth->execute(); 3978 3978 while (my ($domid,$dom,$domstat) = $domsth->fetchrow_array) { 3979 3979 $recsth->execute($domid); 3980 while (my ($host,$type,$val,$dist,$weight,$port,$ttl) = $recsth->fetchrow_array) { 3980 while (my ($host,$type,$val,$dist,$weight,$port,$ttl,$recid) = $recsth->fetchrow_array) { 3981 next if $recflags{$recid}; 3981 3982 ##fixme: need to store location in the db, and retrieve it here. 3982 3983 # temporarily hardcoded to empty so we can include it further down. … … 3990 3991 3991 3992 _printrec_tiny($datafile,'n',\%recflags,$dom,$host,$type,$val,$dist,$weight,$port,$ttl,$loc,$stamp); 3993 $recflags{$recid} = 1; 3992 3994 3993 3995 } # while ($recsth) … … 3995 3997 3996 3998 my $revsth = $dbh->prepare("SELECT rdns_id,revnet,status FROM revzones WHERE status=1"); 3997 $recsth = $dbh->prepare("SELECT host,type,val,distance,weight,port,ttl ".3999 $recsth = $dbh->prepare("SELECT host,type,val,distance,weight,port,ttl,record_id ". 3998 4000 "FROM records WHERE rdns_id=?"); 3999 4001 $revsth->execute(); 4000 4002 while (my ($revid,$revzone,$revstat) = $revsth->fetchrow_array) { 4001 4003 $recsth->execute($revid); 4002 while (my ($host,$type,$val,$dist,$weight,$port,$ttl) = $recsth->fetchrow_array) { 4004 while (my ($host,$type,$val,$dist,$weight,$port,$ttl,$recid) = $recsth->fetchrow_array) { 4005 next if $recflags{$recid}; 4003 4006 ##fixme: need to store location in the db, and retrieve it here. 4004 4007 # temporarily hardcoded to empty so we can include it further down. … … 4012 4015 4013 4016 _printrec_tiny($datafile,'y',\%recflags,$revzone,$host,$type,$val,$dist,$weight,$port,$ttl,$loc,$stamp); 4017 $recflags{$recid} = 1; 4014 4018 4015 4019 } # while ($recsth) … … 4157 4161 print $datafile "^". 4158 4162 _ZONE($val, 'ZONE', 'r', '.').($val->{isv6} ? '.ip6.arpa' : '.in-addr.arpa'). 4159 ":$host: ttl:$stamp:$loc\n";4163 ":$host:$ttl:$stamp:$loc\n"; 4160 4164 } 4161 4165 4162 4166 } elsif ($type == 65280) { # A+PTR 4167 4168 print $datafile "=$host:$val:$ttl:$stamp:$loc\n"; 4169 4163 4170 } elsif ($type == 65281) { # AAAA+PTR 4164 4171 … … 4170 4177 $type = 12; 4171 4178 } 4172 _printrec_tiny($datafile,$revrec,$ zone,$host,$type,$val,$dist,$weight,$port,$ttl,$loc,$stamp);4179 _printrec_tiny($datafile,$revrec,$recflags,$zone,$host,$type,$val,$dist,$weight,$port,$ttl,$loc,$stamp); 4173 4180 4174 4181 } elsif ($type == 65282) { # PTR template
Note:
See TracChangeset
for help on using the changeset viewer.