Re: libpq, PQExecParams and the inserting of binary data

From: David Hinkle <drachs(at)gmail(dot)com>
To: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: libpq, PQExecParams and the inserting of binary data
Date: 2005-06-03 19:00:51
Message-ID: ae830e6c05060312001f4e6ba1@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

It would be great if someone could take the time to write this up and
include it in the manual, I have to do about a million extraniouse
text conversions, small string allocations and deallocations because I
couldn't find any docs.

David

On 6/3/05, Robert Perry <rlperry(at)lodestonetechnologies(dot)com> wrote:
> 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(at)gmail(dot)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
> >
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: the planner will ignore your desire to choose an index scan if your
> joining column's datatypes do not match
>

In response to

Browse pgsql-interfaces by date

  From Date Subject
Next Message Tom Lane 2005-06-03 19:11:22 Re: libpq, PQExecParams and the inserting of binary data
Previous Message Robert Perry 2005-06-03 18:28:14 Re: libpq, PQExecParams and the inserting of binary data