}
}
}
++<<<<<<< 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);
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<<num_domainsdone<<" domains were fully parsed, containing "<<g_numRecords<<" records\n";