From: bert hubert Date: Wed, 23 Apr 2014 12:59:56 +0000 (+0200) Subject: fix how we emit 'disabled' for 't' and 'f' SQL, plus implement feature to supress... X-Git-Tag: rec-3.6.0-rc1~43^2~1^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8439c4e3ca924026ef5e566e40773935e6f67c7f;p=thirdparty%2Fpdns.git fix how we emit 'disabled' for 't' and 'f' SQL, plus implement feature to supress duplicate SOAs and turn it on by default --- diff --git a/pdns/zone2sql.cc b/pdns/zone2sql.cc index 15d1832107..87dd76d35d 100644 --- a/pdns/zone2sql.cc +++ b/pdns/zone2sql.cc @@ -208,16 +208,16 @@ static void emitRecord(const string& zoneName, const string &qname, const string cout<<"insert into records (domain_id, name,type,content,ttl,prio,disabled) select id ,"<< sqlstr(toLower(stripDot(qname)))<<", "<< sqlstr(qtype)<<", "<< - sqlstr(stripDotContent(content))<<", "<filename, i->name, BP.getDirectory()); DNSResourceRecord rr; - while(zpt.get(rr)) + bool seenSOA=false; + while(zpt.get(rr)) { + if(filterDupSOA && seenSOA && rr.qtype.getCode() == QType::SOA) + continue; + if(rr.qtype.getCode() == QType::SOA) + seenSOA=true; emitRecord(i->name, rr.qname, rr.qtype.getName(), rr.content, rr.ttl, rr.priority); + } num_domainsdone++; } catch(std::exception &ae) { @@ -412,9 +422,13 @@ try startNewTransaction(); emitDomain(zonename); string comment; - + bool seenSOA=false; while(zpt.get(rr, &comment)) { - + if(filterDupSOA && seenSOA && rr.qtype.getCode() == QType::SOA) + continue; + if(rr.qtype.getCode() == QType::SOA) + seenSOA=true; + emitRecord(zonename, rr.qname, rr.qtype.getName(), rr.content, rr.ttl, rr.priority, comment); } num_domainsdone=1;