]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Deprecate the insert-record-order-query
authorPieter Lexis <pieter.lexis@powerdns.com>
Wed, 10 Feb 2016 11:20:56 +0000 (12:20 +0100)
committerPieter Lexis <pieter.lexis@powerdns.com>
Wed, 24 Feb 2016 14:51:57 +0000 (15:51 +0100)
docs/markdown/authoritative/backend-generic-sql.md
modules/gmysqlbackend/gmysqlbackend.cc
modules/godbcbackend/godbcbackend.cc
modules/goraclebackend/goraclebackend.cc
modules/gpgsqlbackend/gpgsqlbackend.cc
modules/gsqlite3backend/gsqlite3backend.cc
pdns/backends/gsql/gsqlbackend.cc
pdns/backends/gsql/gsqlbackend.hh
pdns/ssqlite3.cc

index 63d988497d5a13ed6cb3b18451f10849da540d0f..704b083319c3b9153003a23205ff3168b844a117 100644 (file)
@@ -206,7 +206,6 @@ if you wish to calculate ordername and auth without using pdns-rectify.
 - `info-zone-query`: Called to retrieve (nearly) all information for a domain.
 
 - `insert-record-query`: Called during incoming AXFR.
-- `insert-record-order-query`: Add a new record for a domain, including the ordername.
 - `update-account-query`: Set the account for a domain.
 - `delete-names-query`: Called to delete all records of a certain name.
 - `delete-rrset-query`: Called to delete an RRset based on domain\_id, name and type.
index e14e99e8de9f5ad6b8a56dbb998a9eaececcde62..6b0e7c033e0c10833161b76abad6a3a14281e5ef 100644 (file)
@@ -77,8 +77,7 @@ public:
     declare(suffix,"insert-zone-query","", "insert into domains (type,name) values('NATIVE',?)");
     declare(suffix,"insert-slave-query","", "insert into domains (type,name,master,account) values('SLAVE',?,?,?)");
 
-    declare(suffix, "insert-record-query", "", "insert into records (content,ttl,prio,type,domain_id,disabled,name,auth) values (?,?,?,?,?,?,?,?)");
-    declare(suffix, "insert-record-order-query", "", "insert into records (content,ttl,prio,type,domain_id,disabled,name,ordername,auth) values (?,?,?,?,?,?,?,?,?)");
+    declare(suffix, "insert-record-query", "", "insert into records (content,ttl,prio,type,domain_id,disabled,name,ordername,auth) values (?,?,?,?,?,?,?,?,?)");
     declare(suffix, "insert-empty-non-terminal-order-query", "insert empty non-terminal in zone", "insert into records (type,domain_id,disabled,name,ordername,auth) values (null,?,0,?,?,?)");
 
     declare(suffix, "get-order-first-query", "DNSSEC Ordering Query, first", "select ordername from records where domain_id=? and disabled=0 and ordername is not null order by 1 asc limit 1");
index 6c73fce114da45a5298e0c555371aed88621c35f..9be9e7c64c837eb7e60bf118bb3383838fb535d3 100644 (file)
@@ -75,8 +75,7 @@ public:
     declare(suffix,"insert-zone-query","", "insert into domains (type,name) values('NATIVE',?)");
     declare(suffix,"insert-slave-query","", "insert into domains (type,name,master,account) values('SLAVE',?,?,?)");
 
-    declare(suffix, "insert-record-query", "", "insert into records (content,ttl,prio,type,domain_id,disabled,name,auth) values (?,?,?,?,?,?,?,?)");
-    declare(suffix, "insert-record-order-query", "", "insert into records (content,ttl,prio,type,domain_id,disabled,name,ordername,auth) values (?,?,?,?,?,?,?,convert(varbinary(255),?),?)");
+    declare(suffix, "insert-record-query", "", "insert into records (content,ttl,prio,type,domain_id,disabled,name,ordername,auth) values (?,?,?,?,?,?,?,convert(varbinary(255),?),?)");
     declare(suffix, "insert-empty-non-terminal-order-query", "insert empty non-terminal in zone", "insert into records (type,domain_id,disabled,name,ordername,auth) values (null,?,0,?,convert(varbinary(255),?),?)");
 
     declare(suffix, "get-order-first-query", "DNSSEC Ordering Query, first", "select top 1 convert(varchar(255), ordername) from records where domain_id=? and disabled=0 and ordername is not null order by 1 asc");
index d7d495c2b29a4d150304cc2c38f3512645a33156..a52908940bdbed9a0c91c2f509d32d76bcc02f32 100644 (file)
@@ -90,8 +90,7 @@ public:
     declare(suffix, "supermaster-name-to-ips", "", "select ip,account from supermasters where nameserver=:nameserver and account=:account");
     declare(suffix, "insert-zone-query", "", "insert into domains (id,type,name) values(domains_id_sequence.nextval,'NATIVE',:domain)");
     declare(suffix, "insert-slave-query", "", "insert into domains (id,type,name,master,account) values(domains_id_sequence.nextval,'SLAVE',:domain,:masters,:account)");
-    declare(suffix, "insert-record-query", "", "insert into records (id,content,ttl,prio,type,domain_id,disabled,name,auth) values (records_id_sequence.nextval,:content,:ttl,:priority,:qtype,:domain_id,:disabled,:qname,:auth)");
-    declare(suffix, "insert-record-order-query", "", "insert into records (id,content,ttl,prio,type,domain_id,disabled,name,ordername,auth) values (records_id_sequence.nextval,:content,:ttl,:priority,:qtype,:domain_id,:disabled,:qname,:ordername || ' ',:auth)");
+    declare(suffix, "insert-record-query", "", "insert into records (id,content,ttl,prio,type,domain_id,disabled,name,ordername,auth) values (records_id_sequence.nextval,:content,:ttl,:priority,:qtype,:domain_id,:disabled,:qname,:ordername || ' ',:auth)");
     declare(suffix, "insert-empty-non-terminal-order-query", "insert empty non-terminal in zone", "insert into records (id,type,domain_id,disabled,name,ordername,auth) values (records_id_sequence.nextval,null,:domain_id,0,:qname,:ordername,:auth)");
 
     declare(suffix, "get-order-first-query", "DNSSEC Ordering Query, first", "select * FROM (select trim(ordername) from records where disabled=0 and domain_id=:domain_id and ordername is not null order by ordername asc) where rownum=1");
index 9822bbd908346270b02c7f3d86ebd589bfe67c62..f5b97391e4cba95d8ea3375a9809f5918a86d07d 100644 (file)
@@ -72,8 +72,7 @@ public:
     declare(suffix,"insert-zone-query","", "insert into domains (type,name) values('NATIVE',$1)");
     declare(suffix,"insert-slave-query","", "insert into domains (type,name,master,account) values('SLAVE',$1,$2,$3)");
 
-    declare(suffix, "insert-record-query", "", "insert into records (content,ttl,prio,type,domain_id,disabled,name,auth) values ($1,$2,$3,$4,$5,$6,$7,$8)");
-    declare(suffix, "insert-record-order-query", "", "insert into records (content,ttl,prio,type,domain_id,disabled,name,ordername,auth) values ($1,$2,$3,$4,$5,$6,$7,$8,$9)");
+    declare(suffix, "insert-record-query", "", "insert into records (content,ttl,prio,type,domain_id,disabled,name,ordername,auth) values ($1,$2,$3,$4,$5,$6,$7,$8,$9)");
     declare(suffix, "insert-empty-non-terminal-order-query", "insert empty non-terminal in zone", "insert into records (type,domain_id,disabled,name,ordername,auth) values (null,$1,false,$2,$3,$4)");
 
     declare(suffix, "get-order-first-query", "DNSSEC Ordering Query, last", "select ordername from records where disabled=false and domain_id=$1 and ordername is not null order by 1 using ~<~ limit 1");
index 5f36707b2a61d1af636c74f777ff98477fc2f043..9952acfaea3c90e6e1b8404e36ae258732068e6c 100644 (file)
@@ -88,8 +88,7 @@ public:
     declare(suffix, "insert-zone-query", "", "insert into domains (type,name) values('NATIVE',:domain)");
     declare(suffix, "insert-slave-query", "", "insert into domains (type,name,master,account) values('SLAVE',:domain,:masters,:account)");
 
-    declare(suffix, "insert-record-query", "", "insert into records (content,ttl,prio,type,domain_id,disabled,name,auth) values (:content,:ttl,:priority,:qtype,:domain_id,:disabled,:qname,:auth)");
-    declare(suffix, "insert-record-order-query", "", "insert into records (content,ttl,prio,type,domain_id,disabled,name,ordername,auth) values (:content,:ttl,:priority,:qtype,:domain_id,:disabled,:qname,:ordername,:auth)");
+    declare(suffix, "insert-record-query", "", "insert into records (content,ttl,prio,type,domain_id,disabled,name,ordername,auth) values (:content,:ttl,:priority,:qtype,:domain_id,:disabled,:qname,:ordername,:auth)");
     declare(suffix, "insert-empty-non-terminal-order-query", "insert empty non-terminal in zone", "insert into records (type,domain_id,disabled,name,ordername,auth) values (null,:domain_id,0,:qname,:ordername,:auth)");
 
     declare(suffix, "get-order-first-query", "DNSSEC Ordering Query, first", "select ordername from records where disabled=0 and domain_id=:domain_id and ordername is not null order by 1 asc limit 1");
index 7d97153a23fea60227fccd347d537338d9659d33..70f5e3eee688d7b8921b383ab150e3feeac53962 100644 (file)
@@ -93,8 +93,6 @@ GSQLBackend::GSQLBackend(const string &mode, const string &suffix)
   d_DeleteCommentRRsetQuery = getArg("delete-comment-rrset-query");
   d_DeleteCommentsQuery = getArg("delete-comments-query");
 
-  d_InsertRecordOrderQuery=getArg("insert-record-order-query");
-
   d_firstOrderQuery = getArg("get-order-first-query");
   d_beforeOrderQuery = getArg("get-order-before-query");
   d_afterOrderQuery = getArg("get-order-after-query");
@@ -144,7 +142,6 @@ GSQLBackend::GSQLBackend(const string &mode, const string &suffix)
   d_InsertZoneQuery_stmt = NULL;
   d_InsertSlaveZoneQuery_stmt = NULL;
   d_InsertRecordQuery_stmt = NULL;
-  d_InsertRecordOrderQuery_stmt = NULL;
   d_InsertEmptyNonTerminalOrderQuery_stmt = NULL;
   d_UpdateMasterOfZoneQuery_stmt = NULL;
   d_UpdateKindOfZoneQuery_stmt = NULL;
@@ -1305,39 +1302,28 @@ bool GSQLBackend::feedRecord(const DNSResourceRecord &r, string *ordername)
   }
 
   try {
-    if(d_dnssecQueries && ordername)
-    {
-      d_InsertRecordOrderQuery_stmt->
-        bind("content",content)->
-        bind("ttl",r.ttl)->
-        bind("priority",prio)->
-        bind("qtype",r.qtype.getName())->
-        bind("domain_id",r.domain_id)->
-        bind("disabled",r.disabled)->
-        bind("qname",r.qname); // FIXME400 lowercase?
-        if (ordername == NULL)
-          d_InsertRecordOrderQuery_stmt->bindNull("ordername");
-        else 
-          d_InsertRecordOrderQuery_stmt->bind("ordername",*ordername);
-        d_InsertRecordOrderQuery_stmt->
-        bind("auth",r.auth)->
-        execute()->
-        reset();
-    }
+    d_InsertRecordQuery_stmt->
+      bind("content",content)->
+      bind("ttl",r.ttl)->
+      bind("priority",prio)->
+      bind("qtype",r.qtype.getName())->
+      bind("domain_id",r.domain_id)->
+      bind("disabled",r.disabled)->
+      bind("qname",stripDot(r.qname.toString())); // FIXME400 lowercase?
+
+    if (ordername == NULL)
+      d_InsertRecordQuery_stmt->bindNull("ordername");
     else
-    {
-      d_InsertRecordQuery_stmt->
-        bind("content",content)->
-        bind("ttl",r.ttl)->
-        bind("priority",prio)->
-        bind("qtype",r.qtype.getName())-> 
-        bind("domain_id",r.domain_id)->
-        bind("disabled",r.disabled)->
-        bind("qname",r.qname)->
-        bind("auth", (r.auth || !d_dnssecQueries))->
-        execute()->
-        reset();
-    }
+      d_InsertRecordQuery_stmt->bind("ordername",*ordername);
+
+    if (d_dnssecQueries)
+      d_InsertRecordQuery_stmt->bind("auth", r.auth);
+    else
+      d_InsertRecordQuery_stmt->bind("auth", true);
+
+    d_InsertRecordQuery_stmt->
+      execute()->
+      reset();
   }
   catch (SSqlException &e) {
     throw DBException("GSQLBackend unable to feed record: "+e.txtReason());
index fb55e0556e6339fdb599f21e494fdf6382d6154a..ae713201a0ac2aaf03619ddb63964a51ac7ed0e4 100644 (file)
@@ -44,8 +44,7 @@ public:
       d_GetSuperMasterIPs_stmt = d_db->prepare(d_GetSuperMasterIPs, 2);
       d_InsertZoneQuery_stmt = d_db->prepare(d_InsertZoneQuery, 1);
       d_InsertSlaveZoneQuery_stmt = d_db->prepare(d_InsertSlaveZoneQuery, 3);
-      d_InsertRecordQuery_stmt = d_db->prepare(d_InsertRecordQuery, 8);
-      d_InsertRecordOrderQuery_stmt = d_db->prepare(d_InsertRecordOrderQuery, 9);
+      d_InsertRecordQuery_stmt = d_db->prepare(d_InsertRecordQuery, 9);
       d_InsertEmptyNonTerminalOrderQuery_stmt = d_db->prepare(d_InsertEmptyNonTerminalOrderQuery, 4);
       d_UpdateMasterOfZoneQuery_stmt = d_db->prepare(d_UpdateMasterOfZoneQuery, 2);
       d_UpdateKindOfZoneQuery_stmt = d_db->prepare(d_UpdateKindOfZoneQuery, 2);
@@ -114,7 +113,6 @@ public:
     release(&d_InsertZoneQuery_stmt);
     release(&d_InsertSlaveZoneQuery_stmt);
     release(&d_InsertRecordQuery_stmt);
-    release(&d_InsertRecordOrderQuery_stmt);
     release(&d_InsertEmptyNonTerminalOrderQuery_stmt);
     release(&d_UpdateMasterOfZoneQuery_stmt);
     release(&d_UpdateKindOfZoneQuery_stmt);
@@ -252,7 +250,6 @@ private:
   string d_InsertZoneQuery;
   string d_InsertSlaveZoneQuery;
   string d_InsertRecordQuery;
-  string d_InsertRecordOrderQuery;
   string d_InsertEmptyNonTerminalOrderQuery;
   string d_UpdateMasterOfZoneQuery;
   string d_UpdateKindOfZoneQuery;
@@ -325,7 +322,6 @@ private:
   SSqlStatement* d_InsertZoneQuery_stmt;
   SSqlStatement* d_InsertSlaveZoneQuery_stmt;
   SSqlStatement* d_InsertRecordQuery_stmt;
-  SSqlStatement* d_InsertRecordOrderQuery_stmt;
   SSqlStatement* d_InsertEmptyNonTerminalOrderQuery_stmt;
   SSqlStatement* d_UpdateMasterOfZoneQuery_stmt;
   SSqlStatement* d_UpdateKindOfZoneQuery_stmt;
index 536442b4220f63356ef25259343f0ff44360ff8f..3b57698b4e81cc23229da18b40be3ded50b38229 100644 (file)
@@ -46,7 +46,7 @@ public:
 #else
     if (sqlite3_prepare(d_db->db(), query.c_str(), -1, &d_stmt, &pTail ) != SQLITE_OK)
 #endif
-      throw SSqlException(string("Unable to compile SQLite statement : ")+sqlite3_errmsg(d_db->db()));
+      throw SSqlException(string("Unable to compile SQLite statement : '")+query+"': "+sqlite3_errmsg(d_db->db()));
     if (pTail && strlen(pTail)>0)
       L<<Logger::Warning<<"Sqlite3 command partially processed. Unprocessed part: "<<pTail<<endl;
   }