]> granicus.if.org Git - pdns/commitdiff
Remove mostly nonfunctional diff. in gsqlbackends
authorChristian Hofstaedtler <christian@hofstaedtler.name>
Tue, 15 Oct 2013 12:11:08 +0000 (14:11 +0200)
committerChristian Hofstaedtler <christian@hofstaedtler.name>
Tue, 15 Oct 2013 12:11:08 +0000 (14:11 +0200)
Makes for easier diffing of g*sqlbackend code

modules/gmysqlbackend/gmysqlbackend.cc
modules/gmysqlbackend/gmysqlbackend.hh
modules/goraclebackend/goraclebackend.cc
modules/goraclebackend/goraclebackend.hh
modules/gpgsqlbackend/gpgsqlbackend.cc

index 1d838d000dc0b245979e90b862b1a2a833209e9d..7d7715f71aed2527cf62fe051618336f7d00e610 100644 (file)
@@ -1,15 +1,14 @@
-// $Id$ 
 #include <string>
 #include <map>
 #include "pdns/namespaces.hh"
 #include "pdns/dns.hh"
 #include "pdns/dnsbackend.hh"
-#include "gmysqlbackend.hh"
 #include "pdns/dnspacket.hh"
 #include "pdns/ueberbackend.hh"
 #include "pdns/pdnsexception.hh"
 #include "pdns/logger.hh"
 #include "pdns/arguments.hh"
+#include "gmysqlbackend.hh"
 #include "smysql.hh"
 #include <sstream>
 
@@ -37,7 +36,7 @@ class gMySQLFactory : public BackendFactory
 {
 public:
   gMySQLFactory(const string &mode) : BackendFactory(mode),d_mode(mode) {}
-  
+
   void declareArguments(const string &suffix="")
   {
     declare(suffix,"dbname","Pdns backend database name to connect to","powerdns");
@@ -47,9 +46,10 @@ public:
     declare(suffix,"socket","Pdns backend socket to connect to","");
     declare(suffix,"password","Pdns backend password to connect with","");
     declare(suffix,"group", "Pdns backend MySQL 'group' to connect as", "client");
-    declare(suffix,"dnssec","Assume DNSSEC Schema is in place","no");
     declare(suffix,"innodb-read-committed","Use InnoDB READ-COMMITTED transaction isolation level","yes");
 
+    declare(suffix,"dnssec","Assume DNSSEC Schema is in place","no");
+
     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'");
@@ -65,7 +65,7 @@ public:
     declare(suffix,"remove-empty-non-terminals-from-zone-query", "remove all empty non-terminals from zone", "delete from records where domain_id='%d' and type is null");
     declare(suffix,"insert-empty-non-terminal-query", "insert empty non-terminal in zone", "insert into records (domain_id,name,type) values ('%d','%s',null)");
     declare(suffix,"delete-empty-non-terminal-query", "delete empty non-terminal from zone", "delete from records where domain_id='%d' and name='%s' and type is null");
-  
+
     // and now with auth
     declare(suffix,"basic-query-auth","Basic query","select content,ttl,prio,type,domain_id,name, auth from records where type='%s' and name='%s'");
     declare(suffix,"id-query-auth","Basic with ID query","select content,ttl,prio,type,domain_id,name, auth from records where type='%s' and name='%s' and domain_id=%d");
@@ -80,7 +80,7 @@ public:
     declare(suffix,"list-query-auth","AXFR query", "select content,ttl,prio,type,domain_id,name, auth from records where domain_id='%d' order by name, type");
 
     declare(suffix,"insert-empty-non-terminal-query-auth", "insert empty non-terminal in zone", "insert into records (domain_id,name,type,auth) values ('%d','%s',null,'1')");
-    
+
     declare(suffix,"master-zone-query","Data", "select master from domains where name='%s' and type='SLAVE'");
 
     declare(suffix,"info-zone-query","","select id,name,master,last_check,notified_serial,type from domains where name='%s'");
@@ -102,9 +102,10 @@ public:
     declare(suffix,"get-order-after-query","DNSSEC Ordering Query, after", "select min(ordername) from records where ordername > '%s' and domain_id=%d and ordername is not null");
     declare(suffix,"get-order-last-query","DNSSEC Ordering Query, last", "select ordername, name from records where ordername != '' and domain_id=%d and ordername is not null order by 1 desc limit 1");
     declare(suffix,"set-order-and-auth-query", "DNSSEC set ordering query", "update records set ordername='%s',auth=%d where name='%s' and domain_id='%d'");
+    declare(suffix,"set-auth-on-ds-record-query", "DNSSEC set auth on a DS record", "update records set auth=1 where domain_id='%d' and name='%s' and type='DS'");
+
     declare(suffix,"nullify-ordername-and-update-auth-query", "DNSSEC nullify ordername and update auth query", "update records set ordername=NULL,auth=%d where domain_id='%d' and name='%s'");
     declare(suffix,"nullify-ordername-and-auth-query", "DNSSEC nullify ordername and auth query", "update records set ordername=NULL,auth=0 where name='%s' and type='%s' and domain_id='%d'");
-    declare(suffix,"set-auth-on-ds-record-query", "DNSSEC set auth on a DS record", "update records set auth=1 where domain_id='%d' and name='%s' and type='DS'");
 
     declare(suffix,"update-master-query","", "update domains set master='%s' where name='%s'");
     declare(suffix,"update-kind-query","", "update domains set type='%s' where name='%s'");
@@ -115,6 +116,7 @@ public:
     declare(suffix,"delete-domain-query","", "delete from domains where name='%s'");
     declare(suffix,"delete-zone-query","", "delete from records where domain_id=%d");
     declare(suffix,"delete-rrset-query","","delete from records where domain_id=%d and name='%s' and type='%s'");
+
     declare(suffix,"add-domain-key-query","", "insert into cryptokeys (domain_id, flags, active, content) select id, %d, %d, '%s' from domains where name='%s'");
     declare(suffix,"list-domain-keys-query","", "select cryptokeys.id, flags, active, content from domains, cryptokeys where cryptokeys.domain_id=domains.id and name='%s'");
     declare(suffix,"get-domain-metadata-query","", "select content from domains, domainmetadata where domainmetadata.domain_id=domains.id and name='%s' and domainmetadata.kind='%s'");
@@ -123,7 +125,7 @@ public:
     declare(suffix,"set-domain-metadata-query","", "insert into domainmetadata (domain_id, kind, content) select id, '%s', '%s' from domains where name='%s'");
     declare(suffix,"activate-domain-key-query","", "update cryptokeys set active=1 where domain_id=(select id from domains where name='%s') and  cryptokeys.id=%d");
     declare(suffix,"deactivate-domain-key-query","", "update cryptokeys set active=0 where domain_id=(select id from domains where name='%s') and  cryptokeys.id=%d");
-    declare(suffix,"remove-domain-key-query","", "delete from cryptokeys where domain_id=(select id from domains where name='%s') and cryptokeys.id=%d");    
+    declare(suffix,"remove-domain-key-query","", "delete from cryptokeys where domain_id=(select id from domains where name='%s') and cryptokeys.id=%d");
     declare(suffix,"clear-domain-all-keys-query","", "delete from cryptokeys where domain_id=(select id from domains where name='%s')");
     declare(suffix,"get-tsig-key-query","", "select algorithm, secret from tsigkeys where name='%s'");
     declare(suffix,"set-tsig-key-query","", "replace into tsigkeys (name,algorithm,secret) values('%s','%s','%s')");
@@ -132,7 +134,7 @@ public:
 
     declare(suffix,"get-all-domains-query", "Retrieve all domains", "select records.domain_id, records.name, records.content, domains.type, domains.master, domains.notified_serial, domains.last_check from records, domains where records.domain_id=domains.id and records.type='SOA'");
   }
-  
+
   DNSBackend *make(const string &suffix="")
   {
     return new gMySQLBackend(d_mode,suffix);
index 68356165cc13d086dab047a24a0b1ef171ca2ea7..4fbda4e49aa1d812adfb535da3fad6acc4023b1a 100644 (file)
@@ -1,6 +1,5 @@
 #include <string>
 #include <map>
-
 #include "pdns/backends/gsql/gsqlbackend.hh"
 
 #include "pdns/namespaces.hh"
@@ -11,6 +10,4 @@ class gMySQLBackend : public GSQLBackend
 {
 public:
   gMySQLBackend(const string &mode, const string &suffix); //!< Makes our connection to the database. Throws an exception if it fails.
-private:
 };
index a0380b21d0d7dac15a8bdbbc20971a4f56e17cab..68a6a83f8bbc0c1a430c5cdc8add4e89cf306ba0 100644 (file)
@@ -1,20 +1,16 @@
 
 #include <string>
 #include <map>
-
 #include "pdns/namespaces.hh"
-
 #include "pdns/dns.hh"
 #include "pdns/dnsbackend.hh"
-#include "goraclebackend.hh"
 #include "pdns/dnspacket.hh"
 #include "pdns/ueberbackend.hh"
 #include "pdns/pdnsexception.hh"
 #include "pdns/logger.hh"
 #include "pdns/arguments.hh"
-
+#include "goraclebackend.hh"
 #include "soracle.hh"
-
 #include <sstream>
 
 gOracleBackend::gOracleBackend(const string &mode, const string &suffix)  : GSQLBackend(mode,suffix)
@@ -30,19 +26,19 @@ gOracleBackend::gOracleBackend(const string &mode, const string &suffix)  : GSQL
                     getArg("password")));
     
   }
-  
+
   catch(SSqlException &e) {
     L<<Logger::Error<<mode<<" Connection failed: "<<e.txtReason()<<endl;
     throw PDNSException("Unable to launch "+mode+" connection: "+e.txtReason());
   }
-  L<<Logger::Warning<<mode<<" Connection successful"<<endl;
+  L<<Logger::Info<<mode<<" Connection successful"<<endl;
 }
 
 class gOracleFactory : public BackendFactory
 {
 public:
   gOracleFactory(const string &mode) : BackendFactory(mode),d_mode(mode) {}
-  
+
   void declareArguments(const string &suffix="")
   {
     declare(suffix,"home", "Oracle home path", "");
@@ -52,6 +48,7 @@ public:
     declare(suffix,"tnsname","Generic Oracle backend TNSNAME to connect to","powerdns");
     declare(suffix,"user","Database backend user to connect as","powerdns");
     declare(suffix,"password","Pdns backend password to connect with","");
+
     declare(suffix,"dnssec","Assume DNSSEC Schema is in place","no");
 
     declare(suffix,"basic-query","Basic query","select content,ttl,prio,type,domain_id,name from records where type='%s' and name='%s'");
@@ -69,7 +66,7 @@ public:
     declare(suffix,"remove-empty-non-terminals-from-zone-query", "remove all empty non-terminals from zone", "delete from records where domain_id='%d' and type is null");
     declare(suffix,"insert-empty-non-terminal-query", "insert empty non-terminal in zone", "insert into records (domain_id,name,type) values ('%d','%s',null)");
     declare(suffix,"delete-empty-non-terminal-query", "delete empty non-terminal from zone", "delete from records where domain_id='%d' and name='%s' and type is null");
-  
+
     // and now with auth
     declare(suffix,"basic-query-auth","Basic query","select content,ttl,prio,type,domain_id,name, auth from records where type='%s' and name='%s'");
     declare(suffix,"id-query-auth","Basic with ID query","select content,ttl,prio,type,domain_id,name, auth from records where type='%s' and name='%s' and domain_id=%d");
@@ -84,7 +81,7 @@ public:
     declare(suffix,"list-query-auth","AXFR query", "select content,ttl,prio,type,domain_id,name, auth from records where domain_id='%d' order by name, type");
 
     declare(suffix,"insert-empty-non-terminal-query-auth", "insert empty non-terminal in zone", "insert into records (domain_id,name,type,auth) values ('%d','%s',null,'1')");
-    
+
     declare(suffix,"master-zone-query","Data", "select master from domains where name='%s' and type='SLAVE'");
 
     declare(suffix,"info-zone-query","","select id,name,master,last_check,notified_serial,type from domains where name='%s'");
@@ -92,8 +89,9 @@ public:
     declare(suffix,"info-all-slaves-query","","select id,name,master,last_check,type from domains where type='SLAVE'");
     declare(suffix,"supermaster-query","", "select account from supermasters where ip='%s' and nameserver='%s'");
     declare(suffix,"insert-zone-query","", "insert into domains (id, type, name) values(domain_id_sequence.nextval, 'NATIVE','%s')");
-    declare(suffix,"insert-slave-query","", "insert into domains (id, type,name,master,account) values(domain_id_sequence.nextval, 'SLAVE','%s','%s','%s')"); 
-    declare(suffix,"insert-record-query","", "insert into records (id, content,ttl,prio,type,domain_id,name) values (records_id_sequence.nextval, '%s',%d,%d,'%s',%d,'%s')"); 
+    declare(suffix,"insert-slave-query","", "insert into domains (id, type,name,master,account) values(domain_id_sequence.nextval, 'SLAVE','%s','%s','%s')");
+
+    declare(suffix,"insert-record-query","", "insert into records (id, content,ttl,prio,type,domain_id,name) values (records_id_sequence.nextval, '%s',%d,%d,'%s',%d,'%s')");
     declare(suffix,"insert-record-query-auth","", "insert into records (id, content,ttl,prio,type,domain_id,name,auth) values (records_id_sequence.nextval, '%s',%d,%d,'%s',%d,'%s','%d')");
     
     declare(suffix,"get-order-first-query","DNSSEC Ordering Query, first", "select ordername, name from records where domain_id=%d and ordername is not null and rownum=1 order by 1 asc");
@@ -101,9 +99,10 @@ public:
     declare(suffix,"get-order-after-query","DNSSEC Ordering Query, after", "select min(ordername) from records where ordername > '%s' and domain_id=%d and ordername is not null");
     declare(suffix,"get-order-last-query","DNSSEC Ordering Query, last", "select ordername, name from records where ordername != '' and domain_id=%d and ordername is not null and rownum=1 order by 1 desc");
     declare(suffix,"set-order-and-auth-query", "DNSSEC set ordering query", "update records set ordername='%s',auth=%d where name='%s' and domain_id='%d'");
+    declare(suffix,"set-auth-on-ds-record-query", "DNSSEC set auth on a DS record", "update records set auth=1 where domain_id='%d' and name='%s' and type='DS'");
+
     declare(suffix,"nullify-ordername-and-update-auth-query", "DNSSEC nullify ordername and update auth query", "update records set ordername=NULL,auth=%d where domain_id='%d' and name='%s'");
     declare(suffix,"nullify-ordername-and-auth-query", "DNSSEC nullify ordername and auth query", "update records set ordername=NULL,auth=0 where name='%s' and type='%s' and domain_id='%d'");
-    declare(suffix,"set-auth-on-ds-record-query", "DNSSEC set auth on a DS record", "update records set auth=1 where domain_id='%d' and name='%s' and type='DS'");
 
     declare(suffix,"update-master-query","", "update domains set master='%s' where name='%s'");
     declare(suffix,"update-kind-query","", "update domains set type='%s' where name='%s'");
@@ -114,6 +113,7 @@ public:
     declare(suffix,"delete-domain-query","", "delete from domains where name='%s'");
     declare(suffix,"delete-zone-query","", "delete from records where domain_id=%d");
     declare(suffix,"delete-rrset-query","","delete from records where domain_id=%d and name='%s' and type='%s'");
+
     declare(suffix,"add-domain-key-query","", "insert into cryptokeys (id, domain_id, flags, active, content) select cryptokeys_id_sequence.nextval, id, %d, %d, '%s' from domains where name='%s'");
     declare(suffix,"list-domain-keys-query","", "select cryptokeys.id, flags, active, content from domains, cryptokeys where cryptokeys.domain_id=domains.id and name='%s'");
     declare(suffix,"get-domain-metadata-query","", "select content from domains, domainmetadata where domainmetadata.domain_id=domains.id and name='%s' and domainmetadata.kind='%s'");
@@ -122,7 +122,7 @@ public:
     declare(suffix,"set-domain-metadata-query","", "insert into domainmetadata (id, domain_id, kind, content) select domainmetadata_sequence_id.nextval, id, '%s', '%s' from domains where name='%s'");
     declare(suffix,"activate-domain-key-query","", "update cryptokeys set active=1 where domain_id=(select id from domains where name='%s') and  cryptokeys.id=%d");
     declare(suffix,"deactivate-domain-key-query","", "update cryptokeys set active=0 where domain_id=(select id from domains where name='%s') and  cryptokeys.id=%d");
-    declare(suffix,"remove-domain-key-query","", "delete from cryptokeys where domain_id=(select id from domains where name='%s') and cryptokeys.id=%d");    
+    declare(suffix,"remove-domain-key-query","", "delete from cryptokeys where domain_id=(select id from domains where name='%s') and cryptokeys.id=%d");
     declare(suffix,"clear-domain-all-keys-query","", "delete from cryptokeys where domain_id=(select id from domains where name='%s')");
     declare(suffix,"get-tsig-key-query","", "select algorithm, secret from tsigkeys where name='%s'");
     declare(suffix,"set-tsig-key-query","", "insert into tsigkeys (name,algorithm,secret) VALUES('%s','%s','%s')");
@@ -130,9 +130,8 @@ public:
     declare(suffix,"get-tsig-keys-query","", "select name,algorithm, secret from tsigkeys");
 
     declare(suffix,"get-all-domains-query", "Retrieve all domains", "select records.domain_id, records.name, records.content, domains.type, domains.master, domains.notified_serial, domains.last_check from records, domains where records.domain_id=domains.id and records.type='SOA'");
-
   }
-  
+
   DNSBackend *make(const string &suffix="")
   {
     return new gOracleBackend(d_mode,suffix);
index 5d8146b7734582ea9f4d6a4036f49fc0115af20a..1ca3b8b05f6233f2d340d21863fa3decde0756e4 100644 (file)
@@ -1,6 +1,5 @@
 #include <string>
 #include <map>
-
 #include "pdns/backends/gsql/gsqlbackend.hh"
 
 #include "pdns/namespaces.hh"
@@ -11,6 +10,4 @@ class gOracleBackend : public GSQLBackend
 {
 public:
   gOracleBackend(const string &mode, const string &suffix); //!< Makes our connection to the database. Throws an exception if it fails.
-private:
 };
index 1ae3c3ded79380b96cee72699a2aaadeeca5202e..7d30494b316bc451777fe31f0bbca66aab88065a 100644 (file)
@@ -1,17 +1,14 @@
 #include <string>
 #include <map>
-
 #include "pdns/namespaces.hh"
-
 #include "pdns/dns.hh"
 #include "pdns/dnsbackend.hh"
-#include "gpgsqlbackend.hh"
 #include "pdns/dnspacket.hh"
 #include "pdns/ueberbackend.hh"
 #include "pdns/pdnsexception.hh"
 #include "pdns/logger.hh"
 #include "pdns/arguments.hh"
-
+#include "gpgsqlbackend.hh"
 #include "spgsql.hh"
 #include <sstream>
 
@@ -25,7 +22,7 @@ gPgSQLBackend::gPgSQLBackend(const string &mode, const string &suffix)  : GSQLBa
                  getArg("user"),
                  getArg("password")));
   }
-  
+
   catch(SSqlException &e) {
     L<<Logger::Error<<mode<<" Connection failed: "<<e.txtReason()<<endl;
     throw PDNSException("Unable to launch "+mode+" connection: "+e.txtReason());
@@ -38,7 +35,6 @@ class gPgSQLFactory : public BackendFactory
 public:
   gPgSQLFactory(const string &mode) : BackendFactory(mode),d_mode(mode) {}
 
-  // XXX FIXME this stuff is duplicate with gmysqlbackend
   void declareArguments(const string &suffix="")
   {
     declare(suffix,"dbname","Pdns backend database name to connect to","");
@@ -47,7 +43,8 @@ public:
     declare(suffix,"port","Database backend port to connect to","");
     declare(suffix,"socket","Pdns backend socket to connect to","");
     declare(suffix,"password","Pdns backend password to connect with","");
-    declare(suffix, "dnssec", "Assume DNSSEC Schema is in place","no");
+
+    declare(suffix,"dnssec","Assume DNSSEC Schema is in place","no");
 
     declare(suffix,"basic-query","Basic query","select content,ttl,prio,type,domain_id,name from records where type='%s' and name=E'%s'");
     declare(suffix,"id-query","Basic with ID query","select content,ttl,prio,type,domain_id,name from records where type='%s' and name=E'%s' and domain_id=%d");
@@ -64,7 +61,7 @@ public:
     declare(suffix,"remove-empty-non-terminals-from-zone-query", "remove all empty non-terminals from zone", "delete from records where domain_id='%d' and type is null");
     declare(suffix,"insert-empty-non-terminal-query", "insert empty non-terminal in zone", "insert into records (domain_id,name,type) values ('%d','%s',null)");
     declare(suffix,"delete-empty-non-terminal-query", "delete empty non-terminal from zone", "delete from records where domain_id='%d' and name='%s' and type is null");
-  
+
     // and now with auth
     declare(suffix,"basic-query-auth","Basic query","select content,ttl,prio,type,domain_id,name,auth::int from records where type='%s' and name=E'%s'");
     declare(suffix,"id-query-auth","Basic with ID query","select content,ttl,prio,type,domain_id,name,auth::int from records where type='%s' and name=E'%s' and domain_id=%d");
@@ -79,7 +76,7 @@ public:
     declare(suffix,"list-query-auth","AXFR query", "select content,ttl,prio,type,domain_id,name, auth::int from records where domain_id='%d' order by name, type");
 
     declare(suffix,"insert-empty-non-terminal-query-auth", "insert empty non-terminal in zone", "insert into records (domain_id,name,type,auth) values ('%d','%s',null,true)");
-    
+
     declare(suffix,"master-zone-query","Data", "select master from domains where name=E'%s' and type='SLAVE'");
 
     declare(suffix,"info-zone-query","","select id,name,master,last_check,notified_serial,type from domains where name=E'%s'");
@@ -95,7 +92,7 @@ public:
     declare(suffix,"insert-ent-query", "insert empty non-terminal in zone", "insert into records (type,domain_id,name) values (null,'%d',E'%s')");
     declare(suffix,"insert-ent-query-auth", "insert empty non-terminal in zone", "insert into records (type,domain_id,name,auth) values (null,'%d',E'%s',true)");
     declare(suffix,"insert-ent-order-query-auth", "insert empty non-terminal in zone", "insert into records (type,domain_id,name,ordername,auth) values (null,'%d',E'%s',E'%s',true)");
-    
+
     declare(suffix,"get-order-first-query","DNSSEC Ordering Query, last", "select ordername, name from records where domain_id=%d and ordername is not null order by 1 using ~<~ limit 1");
     declare(suffix,"get-order-before-query","DNSSEC Ordering Query, before", "select ordername, name from records where ordername ~<=~ E'%s' and domain_id=%d and ordername is not null order by 1 using ~>~ limit 1");
     declare(suffix,"get-order-after-query","DNSSEC Ordering Query, after", "select ordername from records where ordername ~>~ E'%s' and domain_id=%d and ordername is not null order by 1 using ~<~ limit 1");
@@ -105,7 +102,7 @@ public:
 
     declare(suffix,"nullify-ordername-and-update-auth-query", "DNSSEC nullify ordername and update auth query", "update records set ordername=NULL,auth=%d::bool where domain_id='%d' and name='%s'");
     declare(suffix,"nullify-ordername-and-auth-query", "DNSSEC nullify ordername and auth query", "update records set ordername=NULL,auth=false where name=E'%s' and type=E'%s' and domain_id='%d'");
-    
+
     declare(suffix,"update-master-query","", "update domains set master='%s' where name='%s'");
     declare(suffix,"update-kind-query","", "update domains set type='%s' where name='%s'");
     declare(suffix,"update-serial-query","", "update domains set notified_serial=%d where id=%d");
@@ -133,7 +130,7 @@ public:
 
     declare(suffix,"get-all-domains-query", "Retrieve all domains", "select records.domain_id, records.name, records.content, domains.type, domains.master, domains.notified_serial, domains.last_check from records, domains where records.domain_id=domains.id and records.type='SOA'");
   }
-  
+
   DNSBackend *make(const string &suffix="")
   {
     return new gPgSQLBackend(d_mode,suffix);