pg.ddx.io pgsql-interfaces@postgresql.org mailing list archive
help / color / mirror / Atom feedPQexecParams question
3+ messages / 2 participants
[nested] [flat]
* PQexecParams question
@ 2007-05-15 12:44 Michael Meskes <meskes@postgresql.org>
0 siblings, 1 reply; 3+ messages in thread
From: Michael Meskes @ 2007-05-15 12:44 UTC (permalink / raw)
To: pgsql-interfaces
I had a closer look at PQexecParams and even started moving ecpglib to
use this function. However, there is one behaviour that troubles me
some.
I declare a binary cursor using PQexecParams, which of course works
nicely and then fetch data from it. I'm not able to tell whether the
cursor is binary, unless I keep my own client side cursor list. So I
call PQexecParams with the fetch command without knowing that the
results are binary. Using the default values however all data is
returned in ascii. It appears you have to tell the fetch command to
return data in binary, or else it will return ascii, no matter how the
cursor was defined.
Is this a feature? Essantially with this behaviour programmers do not
need to declare binary cursors at all because for a normal cursor the
behaviour is exactly the same.
I can surely work around this, for instance by calling PQexec instead
for fetch commands, which does the right thing, but I wonder if this is
desirable.
Michael
--
Michael Meskes
Email: Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: meskes@jabber.org
Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: PQexecParams question
@ 2007-05-15 23:13 Andrew McNamara <andrewm@object-craft.com.au>
parent: Michael Meskes <meskes@postgresql.org>
0 siblings, 1 reply; 3+ messages in thread
From: Andrew McNamara @ 2007-05-15 23:13 UTC (permalink / raw)
To: Michael Meskes <meskes@postgresql.org>; +Cc: pgsql-interfaces
>I declare a binary cursor using PQexecParams, which of course works
>nicely and then fetch data from it. I'm not able to tell whether the
>cursor is binary, unless I keep my own client side cursor list. So I
>call PQexecParams with the fetch command without knowing that the
>results are binary. Using the default values however all data is
>returned in ascii. It appears you have to tell the fetch command to
>return data in binary, or else it will return ascii, no matter how the
>cursor was defined.
In the documentation for the frontend/backend protocol, it says:
Note: The choice between text and binary output is determined
by the format codes given in Bind, regardless of the SQL command
involved. The BINARY attribute in cursor declarations is irrelevant
when using extended query protocol.
http://www.postgresql.org/docs/8.2/static/protocol-flow.html
PQexecParams does the Bind behind the scenes, the resultFormat parameter
deciding whether you get binary or text.
--
Andrew McNamara, Senior Developer, Object Craft
http://www.object-craft.com.au/
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: PQexecParams question
@ 2007-05-16 09:27 Michael Meskes <meskes@postgresql.org>
parent: Andrew McNamara <andrewm@object-craft.com.au>
0 siblings, 0 replies; 3+ messages in thread
From: Michael Meskes @ 2007-05-16 09:27 UTC (permalink / raw)
To: Andrew McNamara <andrewm@object-craft.com.au>; +Cc: Michael Meskes <meskes@postgresql.org>; pgsql-interfaces
On Wed, May 16, 2007 at 09:13:42AM +1000, Andrew McNamara wrote:
> In the documentation for the frontend/backend protocol, it says:
> ...
I wonder why I didn't see it myself. Anyway, thanks for the
clarification. I'm not sure I like this situation, but will surely work
around it, so ecpg remains working as it is right now.
Michael
--
Michael Meskes
Email: Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: meskes@jabber.org
Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2007-05-16 09:27 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-05-15 12:44 PQexecParams question Michael Meskes <meskes@postgresql.org>
2007-05-15 23:13 ` Andrew McNamara <andrewm@object-craft.com.au>
2007-05-16 09:27 ` Michael Meskes <meskes@postgresql.org>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox