@@ -1,177 +1,179 @@
---- modules/gmysqlbackend/gmysqlbackend.cc 2013-01-17 10:16:53.000000000 +0100
-+++ modules/gmysqlbackend/gmysqlbackend.cc 2013-05-03 10:51:33.033534080 +0200
-@@ -31,6 +31,24 @@
+diff -ru modules/gmysqlbackend/gmysqlbackend.cc modules/gmysqlbackend/gmysqlbackend.cc
+--- modules/gmysqlbackend/gmysqlbackend.cc 2013-06-12 09:38:59.758626297 +0200
++++ modules/gmysqlbackend/gmysqlbackend.cc 2013-06-12 09:33:41.310616556 +0200
+@@ -31,24 +31,6 @@
throw AhuException("Unable to launch "+mode+" connection: "+e.txtReason());
}
- L<<Logger::Info<<mode<<" Connection successful"<<endl;
-+
-+ if(!getArg("slave-socket").empty() || !getArg("slave-host").empty()) {
-+ try {
-+ setDBReadonly(new SMySQL(getArg("slave-dbname"),
-+ getArg("slave-host"),
-+ getArgAsNum("slave-port"),
-+ getArg("slave-socket"),
-+ getArg("slave-user"),
-+ getArg("slave-password")));
-+ L<<Logger::Warning<<mode<<" Slave connection successful."<<endl;
-+ } catch(ArgException &e) {
-+ // Ignore exception, slave not
-+ L<<Logger::Warning<<mode<<" Slave configuration."<<endl;
-+ } catch(SSqlException &e) {
-+ // Ignore exception, slave not
-+ L<<Logger::Warning<<mode<<" Unable to connect to slave."<<endl;
-+ }
-+ }
+ L<<Logger::Info<<mode<<" Connection successful. Connected to database '"<<getArg("dbname")<<"' on '"<<getArg("host")<<"'."<<endl;
+-
+- if(!getArg("slave-socket").empty() || !getArg("slave-host").empty()) {
+- try {
+- setDBReadonly(new SMySQL(getArg("slave-dbname"),
+- getArg("slave-host"),
+- getArgAsNum("slave-port"),
+- getArg("slave-socket"),
+- getArg("slave-user"),
+- getArg("slave-password")));
+- L<<Logger::Warning<<mode<<" Slave connection successful."<<endl;
+- } catch(ArgException &e) {
+- // Ignore exception, slave not
+- L<<Logger::Warning<<mode<<" Slave configuration."<<endl;
+- } catch(SSqlException &e) {
+- // Ignore exception, slave not
+- L<<Logger::Warning<<mode<<" Unable to connect to slave."<<endl;
+- }
+- }
}
class gMySQLFactory : public BackendFactory
-@@ -49,6 +67,13 @@
+@@ -67,13 +49,6 @@
declare(suffix,"group", "Pdns backend MySQL 'group' to connect as", "client");
declare(suffix,"dnssec","Assume DNSSEC Schema is in place","no");
-+ declare(suffix,"slave-dbname","Pdns backend database name to connect to","");
-+ declare(suffix,"slave-user","Database backend user to connect as","");
-+ declare(suffix,"slave-host","Database backend host to connect to","");
-+ declare(suffix,"slave-port","Database backend port to connect to","0");
-+ declare(suffix,"slave-socket","Pdns backend socket to connect to","");
-+ declare(suffix,"slave-password","Pdns backend password to connect with","");
-+
+- declare(suffix,"slave-dbname","Pdns backend database name to connect to","");
+- declare(suffix,"slave-user","Database backend user to connect as","");
+- declare(suffix,"slave-host","Database backend host to connect to","");
+- declare(suffix,"slave-port","Database backend port to connect to","0");
+- declare(suffix,"slave-socket","Pdns backend socket to connect to","");
+- declare(suffix,"slave-password","Pdns backend password to connect with","");
+-
declare(suffix,"basic-query","Basic query","select content,ttl,prio,type,domain_id,name from records where type='%s' and name='%s'");
declare(suffix,"id-query","Basic with ID query","select content,ttl,prio,type,domain_id,name from records where type='%s' and name='%s' and domain_id=%d");
declare(suffix,"wildcard-query","Wildcard query","select content,ttl,prio,type,domain_id,name from records where type='%s' and name like '%s'");
---- pdns/backends/gsql/gsqlbackend.cc 2013-01-17 10:16:52.000000000 +0100
-+++ pdns/backends/gsql/gsqlbackend.cc 2013-05-03 10:46:20.135360708 +0200
-@@ -78,7 +78,7 @@
+diff -ru pdns/backends/gsql/gsqlbackend.cc pdns/backends/gsql/gsqlbackend.cc
+--- pdns/backends/gsql/gsqlbackend.cc 2013-06-12 09:33:54.414616957 +0200
++++ pdns/backends/gsql/gsqlbackend.cc 2013-06-12 09:33:41.318616556 +0200
+@@ -80,7 +80,7 @@
d_MasterOfDomainsZoneQuery.c_str(),
sqlEscape(domain).c_str());
try {
-- d_db->doQuery(output, d_result);
-+ getDBReadonly()->doQuery(output, d_result);
+- getDBReadonly()->doQuery(output, d_result);
++ d_db->doQuery(output, d_result);
}
catch (SSqlException &e) {
throw AhuException("GSQLBackend unable to retrieve list of master domains: "+e.txtReason());
-@@ -111,7 +111,7 @@
+@@ -113,7 +113,7 @@
snprintf(output,sizeof(output)-1,d_InfoOfDomainsZoneQuery.c_str(),
sqlEscape(domain).c_str());
try {
-- d_db->doQuery(output,d_result);
-+ getDBReadonly()->doQuery(output,d_result);
+- getDBReadonly()->doQuery(output,d_result);
++ d_db->doQuery(output,d_result);
}
catch(SSqlException &e) {
throw AhuException("GSQLBackend unable to retrieve information about a domain: "+e.txtReason());
-@@ -156,7 +156,7 @@
+@@ -158,7 +158,7 @@
/* list all domains that need refreshing for which we are slave, and insert into SlaveDomain:
id,name,master IP,serial */
try {
-- d_db->doQuery(d_InfoOfAllSlaveDomainsQuery, d_result);
-+ getDBReadonly()->doQuery(d_InfoOfAllSlaveDomainsQuery, d_result);
+- getDBReadonly()->doQuery(d_InfoOfAllSlaveDomainsQuery, d_result);
++ d_db->doQuery(d_InfoOfAllSlaveDomainsQuery, d_result);
}
catch (SSqlException &e) {
throw AhuException("GSQLBackend unable to retrieve list of slave domains: "+e.txtReason());
-@@ -192,7 +192,7 @@
+@@ -194,7 +194,7 @@
/* list all domains that need notifications for which we are master, and insert into updatedDomains
id,name,master IP,serial */
try {
-- d_db->doQuery(d_InfoOfAllMasterDomainsQuery,d_result);
-+ getDBReadonly()->doQuery(d_InfoOfAllMasterDomainsQuery,d_result);
+- getDBReadonly()->doQuery(d_InfoOfAllMasterDomainsQuery,d_result);
++ d_db->doQuery(d_InfoOfAllMasterDomainsQuery,d_result);
}
catch(SSqlException &e) {
throw AhuException("GSQLBackend unable to retrieve list of master domains: "+e.txtReason());
-@@ -243,6 +243,7 @@
+@@ -245,7 +245,6 @@
{
setArgPrefix(mode+suffix);
d_db=0;
-+ d_db_slave=NULL;
+- d_db_slave=NULL;
d_logprefix="["+mode+"Backend"+suffix+"] ";
try
-@@ -643,7 +644,7 @@
+@@ -653,7 +652,7 @@
snprintf(output,sizeof(output)-1,d_GetDomainMetadataQuery.c_str(), sqlEscape(name).c_str(), sqlEscape(kind).c_str());
try {
-- d_db->doQuery(output);
-+ getDBReadonly()->doQuery(output);
+- getDBReadonly()->doQuery(output);
++ d_db->doQuery(output);
}
catch (SSqlException &e) {
throw AhuException("GSQLBackend unable to list metadata: "+e.txtReason());
-@@ -732,7 +733,7 @@
+@@ -742,7 +741,7 @@
}
try {
-- d_db->doQuery(output);
-+ getDBReadonly()->doQuery(output);
+- getDBReadonly()->doQuery(output);
++ d_db->doQuery(output);
}
catch(SSqlException &e) {
throw AhuException(e.txtReason());
-@@ -750,7 +751,7 @@
+@@ -760,7 +759,7 @@
char output[1024];
snprintf(output,sizeof(output)-1,d_listQuery.c_str(),domain_id);
try {
-- d_db->doQuery(output);
-+ getDBReadonly()->doQuery(output);
+- getDBReadonly()->doQuery(output);
++ d_db->doQuery(output);
}
catch(SSqlException &e) {
throw AhuException("GSQLBackend list query: "+e.txtReason());
-@@ -770,7 +771,7 @@
+@@ -780,7 +779,7 @@
for(vector<DNSResourceRecord>::const_iterator i=nsset.begin();i!=nsset.end();++i) {
try {
snprintf(output,sizeof(output)-1,format.c_str(),sqlEscape(ip).c_str(),sqlEscape(i->content).c_str());
-- d_db->doQuery(output, d_result);
-+ getDBReadonly()->doQuery(output, d_result);
+- getDBReadonly()->doQuery(output, d_result);
++ d_db->doQuery(output, d_result);
}
catch (SSqlException &e) {
throw AhuException("GSQLBackend unable to search for a domain: "+e.txtReason());
-@@ -847,7 +848,7 @@
+@@ -857,7 +856,7 @@
{
// L << "GSQLBackend get() was called for "<<qtype.getName() << " record: ";
SSql::row_t row;
-- if(d_db->getRow(row)) {
-+ if(getDBReadonly()->getRow(row)) {
+- if(getDBReadonly()->getRow(row)) {
++ if(d_db->getRow(row)) {
r.content=row[0];
if (row[1].empty())
r.ttl = ::arg().asNum( "default-ttl" );
-@@ -955,7 +956,7 @@
+@@ -1008,7 +1007,7 @@
sd.domain_id);
|