Re: PQexecParams

Lists: pgsql-hackers
From: "Merlin Moncure" <merlin(dot)moncure(at)rcsonline(dot)com>
To: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
Cc: "Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PQexecParams
Date: 2005-03-16 14:52:52
Message-ID: 6EE64EF3AB31D5448D0007DD34EEB3412A7640@Herge.rcsinc.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

> >>Will PQexecParams automatically escape bytea data as it goes in, or
must
> >>one run it through PQescapeBytea first?
> >
> > Neither. The data does not need escaping (assuming you pass it as a
> > parameter, of course.)
>
> Even binary data? ie. You could upload a binary string straight into
> PQexecParams with no octal conversion?

Well, what it means you do not have to escape data at the protocol level
you don't have to be concerned about formatting the query string.
However the server still may still need to interpret the data for
storage...meaning for the bytea type at least you have to do octal
encoding (at least that's what I do, I'd like nothing better than to be
corrected on this point).

Merlin


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Merlin Moncure" <merlin(dot)moncure(at)rcsonline(dot)com>
Cc: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>, "Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PQexecParams
Date: 2005-03-16 15:39:15
Message-ID: 6245.1110987555@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

"Merlin Moncure" <merlin(dot)moncure(at)rcsonline(dot)com> writes:
>> Even binary data? ie. You could upload a binary string straight into
>> PQexecParams with no octal conversion?

> Well, what it means you do not have to escape data at the protocol level
> you don't have to be concerned about formatting the query string.
> However the server still may still need to interpret the data for
> storage...meaning for the bytea type at least you have to do octal
> encoding (at least that's what I do, I'd like nothing better than to be
> corrected on this point).

Not if you send the bytea parameter in binary format. If you send it in
text format that's true.

regards, tom lane