pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Robert Perry <rlperry@lodestonetechnologies.com>
To: pgsql-interfaces@postgresql.org
Subject: Re: libpq, PQExecParams and the inserting of binary data
Date: Fri, 3 Jun 2005 14:28:14 -0400
Message-ID: <bf6927e82669ed8fd770de8dc1bbd3e8@lodestonetechnologies.com> (raw)
In-Reply-To: <6424.1117820918@sss.pgh.pa.us>
References: <ae830e6c05060309182201f85b@mail.gmail.com>
	<6424.1117820918@sss.pgh.pa.us>

	While on the subject might I ask where I could find some documentation 
of the raw binary format for other types such a Date and Decimal(,)?

Thanks
Robert Perry


On Jun 3, 2005, at 1:48 PM, Tom Lane wrote:

> David Hinkle <drachs@gmail.com> writes:
>> As you can see, I assumed I could use PQexapeBytea to escape the
>> binary data and then just use the returned value as a text parameter.
>
> No, because PQescapeBytea is designed to do the escaping that would be
> needed to put the bytea value into a string literal in a SQL command.
> There's an extra level of backslashing involved to do that (because
> backslashes are special to both the string-literal syntax and the
> text input syntax for bytea).
>
> But this is really the hard way to do it considering that you are using
> PQexecParams.  Just tell PQexecParams that you want this parameter to 
> be
> binary format, and pass the *raw* binary string as the parameter.
>
>> I couldn't find any documentation on using PQExecParams
>> with binary parameters,
>
> src/test/examples/testlibpq3.c ... that example is reproduced in
> the libpq manual, as well.
>
> 			regards, tom lane
>
> ---------------------------(end of 
> broadcast)---------------------------
> TIP 8: explain analyze is your friend
>




view thread (18+ messages)  latest in thread

Message-ID: <bf6927e82669ed8fd770de8dc1bbd3e8@lodestonetechnologies.com>
Permalink:  ../bf6927e82669ed8fd770de8dc1bbd3e8@lodestonetechnologies.com/
Also on:    postgresql.org/message-id/bf6927e82669ed8fd770de8dc1bbd3e8@lodestonetechnologies.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: rlperry@lodestonetechnologies.com
  Subject: Re: libpq, PQExecParams and the inserting of binary data
  In-Reply-To: <bf6927e82669ed8fd770de8dc1bbd3e8@lodestonetechnologies.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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