Changeset 1266 for trunk/pdns/pdns/backends/bind/zone2sql.cc
- Timestamp:
- 11/15/08 20:24:30 (22 months ago)
- Files:
-
- 1 modified
-
trunk/pdns/pdns/backends/bind/zone2sql.cc (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pdns/pdns/backends/bind/zone2sql.cc
r1055 r1266 86 86 cerr<<"Second SOA in zone, raised domain_id"<<endl; 87 87 if(mode==POSTGRES || mode==ORACLE) { 88 if(g_intransaction && arg().mustDo("transactions")) {88 if(g_intransaction && ::arg().mustDo("transactions")) { 89 89 cout<<"COMMIT WORK;"<<endl; 90 90 } 91 if( arg().mustDo("transactions")) {91 if(::arg().mustDo("transactions")) { 92 92 if(mode==POSTGRES) 93 93 cout<<"BEGIN TRANSACTION;"<<endl; … … 173 173 #endif 174 174 lastsoa_qname=" "; 175 arg().setSwitch("mysql","Output in format suitable for mysqlbackend")="yes";176 arg().setCmd("gpgsql","Output in format suitable for default gpgsqlbackend");177 arg().setCmd("gmysql","Output in format suitable for default gmysqlbackend");178 arg().setCmd("oracle","Output in format suitable for the oraclebackend");179 arg().setCmd("bare","Output in a bare format, suitable for further parsing");180 arg().setSwitch("verbose","Verbose comments on operation")="no";181 arg().setSwitch("slave","Keep BIND slaves as slaves")="no";182 arg().setSwitch("transactions","If target SQL supports it, use transactions")="no";183 arg().setSwitch("on-error-resume-next","Continue after errors")="no";184 arg().set("start-id","Value of first domain-id")="0";185 arg().set("zone","Zonefile with $ORIGIN to parse")="";186 arg().set("zone-name","Specify an $ORIGIN in case it is not present")="";187 arg().set("named-conf","Bind 8/9 named.conf to parse")="";188 arg().set("soa-minimum-ttl","Do not change")="0";189 arg().set("soa-refresh-default","Do not change")="0";190 arg().set("soa-retry-default","Do not change")="0";191 arg().set("soa-expire-default","Do not change")="0";192 193 arg().setCmd("help","Provide a helpful message");175 ::arg().setSwitch("mysql","Output in format suitable for mysqlbackend")="yes"; 176 ::arg().setCmd("gpgsql","Output in format suitable for default gpgsqlbackend"); 177 ::arg().setCmd("gmysql","Output in format suitable for default gmysqlbackend"); 178 ::arg().setCmd("oracle","Output in format suitable for the oraclebackend"); 179 ::arg().setCmd("bare","Output in a bare format, suitable for further parsing"); 180 ::arg().setSwitch("verbose","Verbose comments on operation")="no"; 181 ::arg().setSwitch("slave","Keep BIND slaves as slaves")="no"; 182 ::arg().setSwitch("transactions","If target SQL supports it, use transactions")="no"; 183 ::arg().setSwitch("on-error-resume-next","Continue after errors")="no"; 184 ::arg().set("start-id","Value of first domain-id")="0"; 185 ::arg().set("zone","Zonefile with $ORIGIN to parse")=""; 186 ::arg().set("zone-name","Specify an $ORIGIN in case it is not present")=""; 187 ::arg().set("named-conf","Bind 8/9 named.conf to parse")=""; 188 ::arg().set("soa-minimum-ttl","Do not change")="0"; 189 ::arg().set("soa-refresh-default","Do not change")="0"; 190 ::arg().set("soa-retry-default","Do not change")="0"; 191 ::arg().set("soa-expire-default","Do not change")="0"; 192 193 ::arg().setCmd("help","Provide a helpful message"); 194 194 195 195 S.declare("logmessages"); … … 198 198 string zonefile=""; 199 199 200 arg().parse(argc, argv);200 ::arg().parse(argc, argv); 201 201 202 if(argc<2 || arg().mustDo("help")) {202 if(argc<2 || ::arg().mustDo("help")) { 203 203 cerr<<"syntax:"<<endl<<endl; 204 cerr<< arg().helpstring()<<endl;204 cerr<<::arg().helpstring()<<endl; 205 205 exit(1); 206 206 } 207 207 208 if( arg().mustDo("mysql"))208 if(::arg().mustDo("mysql")) 209 209 mode=MYSQL; 210 if( arg().mustDo("gpgsql") ||arg().mustDo("gmysql"))210 if(::arg().mustDo("gpgsql") || ::arg().mustDo("gmysql")) 211 211 mode=POSTGRES; 212 if( arg().mustDo("bare"))212 if(::arg().mustDo("bare")) 213 213 mode=BARE; 214 if( arg().mustDo("oracle")) {214 if(::arg().mustDo("oracle")) { 215 215 mode=ORACLE; 216 if(! arg().mustDo("transactions"))216 if(!::arg().mustDo("transactions")) 217 217 cout<<"set autocommit on;"<<endl; 218 218 } 219 219 220 220 221 dirty_hack_num= arg().asNum("start-id");222 namedfile= arg()["named-conf"];223 zonefile= arg()["zone"];221 dirty_hack_num=::arg().asNum("start-id"); 222 namedfile=::arg()["named-conf"]; 223 zonefile=::arg()["zone"]; 224 224 225 225 int count=0, num_domainsdone=0; … … 227 227 if(zonefile.empty()) { 228 228 BindParser BP; 229 BP.setVerbose( arg().mustDo("verbose"));229 BP.setVerbose(::arg().mustDo("verbose")); 230 230 BP.parse(namedfile.empty() ? "./named.conf" : namedfile); 231 231 … … 251 251 try { 252 252 if(mode==POSTGRES || mode==ORACLE) { 253 if(g_intransaction && arg().mustDo("transactions")) {253 if(g_intransaction && ::arg().mustDo("transactions")) { 254 254 cout<<"COMMIT WORK;"<<endl; 255 255 } 256 if( arg().mustDo("transactions")) {256 if(::arg().mustDo("transactions")) { 257 257 if(mode==POSTGRES) 258 258 cout<<"BEGIN TRANSACTION;"<<endl; … … 261 261 262 262 if(mode==POSTGRES) { 263 if( arg().mustDo("slave")) {263 if(::arg().mustDo("slave")) { 264 264 if(i->masters.empty()) 265 265 cout<<"insert into domains (name,type) values ("<<sqlstr(i->name)<<",'NATIVE');"<<endl; … … 289 289 } 290 290 catch(exception &ae) { 291 if(! arg().mustDo("on-error-resume-next"))291 if(!::arg().mustDo("on-error-resume-next")) 292 292 throw; 293 293 else … … 296 296 297 297 catch(AhuException &ae) { 298 if(! arg().mustDo("on-error-resume-next"))298 if(!::arg().mustDo("on-error-resume-next")) 299 299 throw; 300 300 else … … 309 309 } 310 310 else { 311 ZoneParserTNG zpt(zonefile, arg()["zone-name"]);311 ZoneParserTNG zpt(zonefile, ::arg()["zone-name"]); 312 312 DNSResourceRecord rr; 313 313 dirty_hack_num=-1; // trigger first SOA output … … 332 332 } 333 333 334 if((mode==POSTGRES || mode==ORACLE) && arg().mustDo("transactions") && g_intransaction)334 if((mode==POSTGRES || mode==ORACLE) && ::arg().mustDo("transactions") && g_intransaction) 335 335 cout<<"COMMIT WORK;"<<endl; 336 336 return 1;