[Pdns-users] PowerDNS Queries (sprints)

Peter van Dijk peter.van.dijk at netherlabs.nl
Fri May 30 05:36:12 UTC 2014


Hello Drew,

On 23 May 2014, at 17:32 , Drew Decker <drewrockshard at gmail.com> wrote:

> Anyone know what all the “%character” items are for PowerDNS?  
> 
> I’ve referencing:
> http://doc.powerdns.com/html/generic-mypgsql-backends.html#idp9683232
> 
> If you look at "basic-query”, it reads:
> 
> Default: select content,ttl,prio,type,domain_id,name from records where type='%s' and name='%s' This is the most used query, needed for doing 1:1 lookups of qtype/name values. First %s is replaced by the ASCII representation of the qtype of the question, the second by the name. 
> I need to know what the %x is for “id” (not “domain_id”, just “id”).  The reason is, I would like to have it do some additional thing, that requires me to know the actual ID of query.

Right now, the meaning of each %s is fixed, and determined by the order in the query.

From the code:

  d_NoIdQuery=getArg("basic-query”);
  d_IdQuery=getArg("id-query");
…
    if(domain_id < 0) {
      query = (boost::format(d_NoIdQuery)
               % sqlEscape(qtype.getName())
               % sqlEscape(lcqname)
        ).str();
    } else {
      query = (boost::format(d_IdQuery)
               % sqlEscape(qtype.getName())
               % sqlEscape(lcqname)
               % domain_id
        ).str();
    }
This applies type and lcqname (the lowercased query name) to the %s items in the query, in that order. You cannot change this without editing gsqlbackend.cc and recompiling, right now.

Note that -if- PowerDNS has a domain_id, it will use d_IdQuery (which you know as id-query), as also seen in the code above. So for your situation, changing id-query may be enough.

Kind regards,
-- 
Peter van Dijk
Netherlabs Computer Consulting BV - http://www.netherlabs.nl/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 841 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://mailman.powerdns.com/pipermail/pdns-users/attachments/20140530/7384e34b/attachment-0001.sig>


More information about the Pdns-users mailing list