Changeset 1592 for trunk/pdns/pdns/backends/bind/zone2sql.cc
- Timestamp:
- 04/30/10 22:49:09 (3 years ago)
- Files:
-
- 1 modified
-
trunk/pdns/pdns/backends/bind/zone2sql.cc (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pdns/pdns/backends/bind/zone2sql.cc
r1472 r1592 1 1 /* 2 2 PowerDNS Versatile Database Driven Nameserver 3 Copyright (C) 2002 - 20 07PowerDNS.COM BV3 Copyright (C) 2002 - 2010 PowerDNS.COM BV 4 4 5 5 This program is free software; you can redistribute it and/or modify … … 48 48 using namespace boost; 49 49 StatBag S; 50 bool g_doDNSSEC; 50 51 51 52 static const string sqlstr(const string &name) … … 124 125 lastsoa_domain_id=dirty_hack_num; 125 126 127 bool auth = true; 128 if(qtype == "NS" && !pdns_iequals(stripDot(domain), lastsoa_qname)) { 129 // cerr<<"'"<<domain<<"' != '"<<lastsoa_qname<<"'\n"; 130 auth=false; 131 } 132 126 133 if(mode==MYSQL) { 127 cout<<"insert into records (domain_id, name,type,content,ttl,prio) values ("<< dirty_hack_num<<", "<< 128 sqlstr(stripDot(domain))<<", "<< 129 sqlstr(qtype)<<", "<< 130 sqlstr(stripDot(content))<<", "<<ttl<<", "<<prio<<");\n"; 131 } 132 if(mode==POSTGRES) { 133 cout<<"insert into records (domain_id, name,type,content,ttl,prio) select id ,"<< 134 sqlstr(toLower(stripDot(domain)))<<", "<< 135 sqlstr(qtype)<<", "<< 136 sqlstr(stripDot(content))<<", "<<ttl<<", "<<prio<< 137 " from domains where name="<<toLower(sqlstr(lastsoa_qname))<<";\n"; 134 if(!g_doDNSSEC) { 135 136 cout<<"insert into records (domain_id, name, type,content,ttl,prio) values ("<< dirty_hack_num<<", "<< 137 sqlstr(stripDot(domain))<<", "<< 138 sqlstr(qtype)<<", "<< 139 sqlstr(stripDot(content))<<", "<<ttl<<", "<<prio<<");\n"; 140 } else { 141 cout<<"insert into records (domain_id, name, ordername, auth, type,content,ttl,prio) values ("<< dirty_hack_num<<", "<< 142 sqlstr(stripDot(domain))<<", "<< 143 sqlstr(toLower(labelReverse(domain)))<<", "<< auth <<" ,"<< 144 sqlstr(qtype)<<", "<< 145 sqlstr(stripDot(content))<<", "<<ttl<<", "<<prio<<");\n"; 146 } 147 } 148 else if(mode==POSTGRES) { 149 if(!g_doDNSSEC) { 150 cout<<"insert into records (domain_id, name,type,content,ttl,prio) select id ,"<< 151 sqlstr(toLower(stripDot(domain)))<<", "<< 152 sqlstr(qtype)<<", "<< 153 sqlstr(stripDot(content))<<", "<<ttl<<", "<<prio<< 154 " from domains where name="<<toLower(sqlstr(lastsoa_qname))<<";\n"; 155 } else 156 { 157 cout<<"insert into records (domain_id, name, ordername, auth, type,content,ttl,prio) select id ,"<< 158 sqlstr(toLower(stripDot(domain)))<<", "<< 159 sqlstr(toLower(labelReverse(domain)))<<", "<<auth<<", "<< 160 sqlstr(qtype)<<", "<< 161 sqlstr(stripDot(content))<<", "<<ttl<<", "<<prio<< 162 " from domains where name="<<toLower(sqlstr(lastsoa_qname))<<";\n"; 163 } 138 164 } 139 165 else if(mode==ORACLE) { … … 180 206 ::arg().setCmd("bare","Output in a bare format, suitable for further parsing"); 181 207 ::arg().setSwitch("verbose","Verbose comments on operation")="no"; 208 ::arg().setSwitch("dnssec","Add DNSSEC related data")="no"; 182 209 ::arg().setSwitch("slave","Keep BIND slaves as slaves")="no"; 183 210 ::arg().setSwitch("transactions","If target SQL supports it, use transactions")="no"; … … 219 246 } 220 247 248 g_doDNSSEC=::arg().mustDo("dnssec"); 249 221 250 222 251 dirty_hack_num=::arg().asNum("start-id"); 223 252 namedfile=::arg()["named-conf"]; 224 253 zonefile=::arg()["zone"]; 254 255 225 256 226 257 int count=0, num_domainsdone=0; … … 312 343 ZoneParserTNG zpt(zonefile, ::arg()["zone-name"]); 313 344 DNSResourceRecord rr; 314 dirty_hack_num= -1; // trigger first SOA output345 dirty_hack_num=::arg().asNum("start-id"); // trigger first SOA output 315 346 while(zpt.get(rr)) 316 347 callback(0, rr.qname, rr.qtype.getName(), rr.content, rr.ttl, rr.priority);