pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
libpq string escaping question
2+ messages / 2 participants
[nested] [flat]

* libpq string escaping question
@ 2008-01-25 10:13 Klaus Darilion <klaus.mailinglists@pernau.at>
  2008-01-26 13:58 ` Re: libpq string escaping question Daniel Verite <daniel@manitou-mail.org>
  0 siblings, 1 reply; 2+ messages in thread

From: Klaus Darilion @ 2008-01-25 10:13 UTC (permalink / raw)
  To: pgsql-interfaces

Hi all!

 From the docs:
 > PQunescapeBytea
 >
 > Converts a string representation of binary data into binary data —
 > the reverse of PQescapeBytea. This is needed when retrieving bytea
 > data in text format, but not when retrieving it in binary format.

But how do I know if data is retrieved in text or binary format? I read
that PQexecParams allows to specify the return format (text or binary)
but what about PQexec() and PQgetResult()? Do they return binary or
text? Or is it configurable for PQexec ann PQgetResult too?

Further from the docs (about E'' syntax):
 > The standard_conforming_strings value is read-only. Applications can
 > retrieve the value to know how backslashes are processed. (Presence
 > of the parameter can also be taken as an indication that E'' string
 > syntax is supported.)

How can I retrieve this value?

thanks
klaus




^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: libpq string escaping question
  2008-01-25 10:13 libpq string escaping question Klaus Darilion <klaus.mailinglists@pernau.at>
@ 2008-01-26 13:58 ` Daniel Verite <daniel@manitou-mail.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Daniel Verite @ 2008-01-26 13:58 UTC (permalink / raw)
  To: Klaus Darilion <klaus.mailinglists@pernau.at>; +Cc: pgsql-interfaces

	Klaus Darilion wrote:

> But how do I know if data is retrieved in text or binary format? I 
read
> that PQexecParams allows to specify the return format (text or 
binary)
> but what about PQexec() and PQgetResult()? Do they return binary or
> text? Or is it configurable for PQexec ann PQgetResult too?

PQfformat() applied to a column of a result indicates whether it's text 
or binary.
When the query is run through PQexec(), my understanding is that 
results will always be in text format except if specified otherwise at 
the SQL level. That would be the case for a FETCH from a BINARY CURSOR. 
I'm not sure if there is any other case, BTW, anyone knows?

> Further from the docs (about E'' syntax):
>  > The standard_conforming_strings value is read-only. Applications 
can
>  > retrieve the value to know how backslashes are processed. 
(Presence
>  > of the parameter can also be taken as an indication that E'' 
string
>  > syntax is supported.)
> 
> How can I retrieve this value?

Check out PQparameterStatus()

-- 
 Daniel
 PostgreSQL-powered mail user agent and storage: 
http://www.manitou-mail.org



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2008-01-26 13:58 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2008-01-25 10:13 libpq string escaping question Klaus Darilion <klaus.mailinglists@pernau.at>
2008-01-26 13:58 ` Daniel Verite <daniel@manitou-mail.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