[bind10-dev] missing C API for PostgreSQL: row-by-row query result retrieval

Michal 'vorner' Vaner michal.vaner at nic.cz
Mon Oct 8 07:19:39 UTC 2012


Hello

On Wed, Oct 03, 2012 at 02:52:31PM +0200, Shane Kerr wrote:
>     SELECT rdtype, ttl, sigtype, rdata, name, rname FROM records 
>         WHERE zone_id = ?1
>         ORDER by rname, rdtype
> 	LIMIT 100 

I'm not sure if this is indeed the best way to do it, but I got another idea ‒
iterating it by single-name queries and getting the next name every time, like
this:

SELECT
    rdtype, ttl, sigtype, rdata, name, MINIMUM(next_scan.name)
FROM
    records
  LEFT OUTER JOIN
    records AS next_scan
  ON records.name < next_scan.name
WHERE
    name = ?
  AND
    zone_id = ?
GROUP_BY
    rdtype, ttl, sigtype, rdata, name

I must admit I didn't try it yet, but the idea is to take the current name and
then take the lowest next name, if it exists. So the next time we know what to
ask for.

With regards

-- 
Something is obviously wrong. The thing works.

Michal 'vorner' Vaner
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <https://lists.isc.org/pipermail/bind10-dev/attachments/20121008/ca9e441e/attachment.bin>


More information about the bind10-dev mailing list