Skip site navigation (1) Skip section navigation (2)

Re: Extend libpq to support mixed text and binary results

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Extend libpq to support mixed text and binary results
Date: 2012-11-07 16:28:22
Message-ID: CAHyXU0y4+5gW78MDihmUCdf8bXqnh0VX0vR85rm0y5RMh-v06g@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-hackers
On Wed, Nov 7, 2012 at 7:08 AM, Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at> wrote:
> The Frontend/Backend protocol's "bind" message allows to
> specify mixed text and binary result formats, but there
> is not support in the C API for that.
>
> I'd like to add support for that to libpq for these reasons:
>
> - I think that every feature of the line protocol should
>   be exposed in the C API.
>
> - This is quite useful if you select bytea and other
>   fields in one query (less overhead and data traffic
>   for the bytea).
>
> - I've seen at least one case on the list where
>   somebody would have liked to have that feature:
>   http://archives.postgresql.org/pgsql-general/2012-08/msg00761.php
>
> Attached is a WIP patch that adds four new functions
> to libpq:
> PQexecParams2
> PQexecPrepared2
> PQsendQueryParams2
> PQsendQueryPrepared2
>
> If that idea meets with approval, I'd add documentation and
> submit it to the next commitfest.
>
> I am aware that these names are rather ugly and welcome
> better ideas.
>
> Maybe it is not necessary to add four new functions.
> You could get the full functionality just with
> PQsendQueryPrepared2, the rest is just for ease of use.

How would this compare to libpqtypes which I might in-humbly suggest
is the gold standard in terms of dealing with libpq binary formats: it
pulls everything in binary and puts the complicated stuff in structs
so you don't have to parse.

merlin


In response to

pgsql-hackers by date

Next:From: Tom LaneDate: 2012-11-07 16:53:49
Subject: Re: Proposal for Allow postgresql.conf values to be changed via SQL
Previous:From: Merlin MoncureDate: 2012-11-07 16:17:23
Subject: Re: WIP patch for hint bit i/o mitigation

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group