From: bert hubert Date: Thu, 24 Apr 2014 07:26:39 +0000 (+0200) Subject: Merge branch 'jsonzone2sql' X-Git-Tag: rec-3.6.0-rc1~43 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bd91637ee65d2f0b0568aed790f3a5177c84fbaa;p=thirdparty%2Fpdns.git Merge branch 'jsonzone2sql' Conflicts: pdns/zone2sql.cc pdns/zoneparser-tng.hh --- bd91637ee65d2f0b0568aed790f3a5177c84fbaa diff --cc pdns/zone2sql.cc index 250c31ec01,5a585cf37f..3b50ecaec1 --- a/pdns/zone2sql.cc +++ b/pdns/zone2sql.cc @@@ -141,9 -141,24 +141,30 @@@ static void emitDomain(const string& do } } } ++<<<<<<< HEAD + +static void emitRecord(const string& zoneName, const string &qname, const string &qtype, const string &ocontent, int ttl, int prio) +{ ++======= + bool g_doJSONComments; + static void emitRecord(const string& zoneName, const string &qname, const string &qtype, const string &ocontent, int ttl, int prio, const string& comment="") + { + int disabled=0; + string recordcomment; + + if(g_doJSONComments & !comment.empty()) { + string::size_type pos = comment.find("json={"); + if(pos!=string::npos) { + string json = comment.substr(pos+5); + rapidjson::Document document; + if(document.Parse<0>(json.c_str()).HasParseError()) + throw runtime_error("Could not parse JSON '"+json+"'"); + + disabled=boolFromJson(document, "disabled", false); + recordcomment=stringFromJson(document, "comment", ""); + } + } ++>>>>>>> jsonzone2sql g_numRecords++; string content(ocontent); @@@ -389,8 -424,16 +423,21 @@@ tr DNSResourceRecord rr; startNewTransaction(); emitDomain(zonename); ++<<<<<<< HEAD + while(zpt.get(rr)) + emitRecord(zonename, rr.qname, rr.qtype.getName(), rr.content, rr.ttl, rr.priority); ++======= + 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); + } ++>>>>>>> jsonzone2sql num_domainsdone=1; } cerr<