Re: mysql dlz centos error "extra input text"

Todd Lyons <[email protected]> Fri, 26 Aug 2011 06:23:44 -0700
Newsgroups gmane.network.dns.bind9.dlz
Message-ID <CAFG21oiP9bpycg59vqL2xaqq8WWm8ZUhFX-LBZo_DxbKvqUBGw@mail.gmail.com>
On Thu, Aug 25, 2011 at 11:57 PM, Roger Meier <[email protected]> wr=
ote:
> Hi all
>
> Ok i found now a solution for me. The problem was in the queries. Some
> of the queries returned also the contact, serial, refresh, etc. when
> the entries wasn't a SOA entry. This is strange, because i used the
> sample queries which are spread in the internet. But now with this
> sample below all works on my site :-) Perhaps this also helps someone.

Undoubtedly it will!

> dlz "mysql zone" {
> =A0database "mysql
> =A0{host=3D127.0.0.1 port=3D3306 dbname=3D4s_admin user=3Dnamed pass=3D4G=
rutIdvat3}
> =A0{SELECT zone FROM dns_zones WHERE zone =3D '%zone%'}
> =A0{SELECT z.ttl, r.type, r.mxpriority,
> =A0CASE WHEN LOWER(r.type)=3D'txt' THEN CONCAT('\"',r.data,'\"') ELSE
> r.data END FROM =A0dns_records r,dns_zones z
> =A0WHERE z.id =3D r.zoneid AND z.zone =3D '%zone%' AND r.host =3D '%recor=
d%'
> AND NOT (LOWER(r.type) =3D 'soa' OR LOWER(r.type) =3D 'ns')}

The above are the same.

> =A0{SELECT z.ttl, r.type, r.data,
> =A0CASE WHEN LOWER(r.type)=3D'soa' THEN CONCAT_WS(' ',z.contact, z.serial,
> z.refresh, z.retry, z.expire, z.minimum) ELSE '' END
> =A0FROM dns_records r, dns_zones z
> =A0WHERE z.id =3D r.zoneid AND z.zone =3D '%zone%' AND (LOWER(r.type) =3D=
 'soa'
> OR LOWER(r.type) =3D 'ns')}

That one is the one that's different.  You had to concat the fields.
However, now I understand where you found this change to your original
query.  Read to the end of this email.

> =A0{SELECT z.ttl, r.type, r.host, r.mxpriority,
> =A0CASE WHEN LOWER(r.type)=3D'txt' THEN CONCAT('\"',r.data,'\"') ELSE
> r.data END
> =A0FROM dns_records r, dns_zones z
> =A0WHERE z.id =3D r.zoneid AND z.zone =3D '%zone%' AND NOT (LOWER(r.type)=
 =3D
> 'soa' OR LOWER(r.type) =3D 'ns')}
> =A0{SELECT z.zone FROM dns_zones z, dns_xfr x WHERE z.id =3D x.zoneid AND
> z.zone =3D '%zone%' AND x.client =3D '%client%'}
> =A0{UPDATE dns_records r, dns_zones z SET r.count =3D r.count + 1 WHERE z=
.id
> =3D r.zoneid AND z.zone =3D '%zone%'}";
> };

Again, the same as the documentation.

You, like me, were probably originally looking primarily at the
documentation on page:
http://bind-dlz.sourceforge.net/mysql_driver.html
But the example on page:
http://bind-dlz.sourceforge.net/mysql_example.html

I can see the one small difference where they concatenate the fields
together instead of returning them all separately.  I do not know the
internals to know if the driver should be concatenating them, or if
the documentation needs to be changed.  Thank you for posting your
findings though :-)  If I ever switch to the split field system, I'll
need that knowledge.

...Todd

-- =

If Americans could eliminate sugary beverages, potatoes, white bread,
pasta, white rice and sugary snacks, we would wipe out almost all the
problems we have with weight and diabetes and other metabolic
diseases. -- Dr. Walter Willett, Harvard School of Public Health

---------------------------------------------------------------------------=
---
EMC VNX: the world's simplest storage, starting under $10K
The only unified storage solution that offers unified management =

Up to 160% more powerful than alternatives and 25% more efficient. =

Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev