Re: DBD::Pg: Null bytes in text

2002-12-14 Thread Bruce Momjian
Baldur Kristinsson wrote: Interesting. However, the null byte is by definition a string terminator, so it makes no sense to me to include any data in a string beyond the null byte. The behavior of quote() to tacitly strip out a null byte is actually a bug (left over from an earlier

Re: DBD::Pg: Null bytes in text

2002-12-14 Thread Bruce Momjian
David Wheeler wrote: On Saturday, December 14, 2002, at 03:24 PM, Bruce Momjian wrote: I can't think of an ultimate solution. If we added a length to the passed query string, so you could embed nulls, we would still have the problem of handling the null once we split the query up into

Re: DBD::Pg: Null bytes in text

2002-12-14 Thread David Wheeler
On Saturday, December 14, 2002, at 05:46 PM, Bruce Momjian wrote: Yes, thanks David. You are correct, and I meant to talk about that, but by the time I got to the end of the email, I had forgotten. We are looking to overhaul the wire protocol for 7.4, and one of the TODO items is: o

Re: DBD::Pg: Null bytes in text

2002-12-14 Thread Bruce Momjian
David Wheeler wrote: On Saturday, December 14, 2002, at 05:46 PM, Bruce Momjian wrote: Yes, thanks David. You are correct, and I meant to talk about that, but by the time I got to the end of the email, I had forgotten. We are looking to overhaul the wire protocol for 7.4, and one

Re: DBD::Pg: Null bytes in text

2002-12-11 Thread David Wheeler
On Wednesday, December 11, 2002, at 09:18 AM, Baldur Kristinsson wrote: Here is an issue regarding DBD::Pg (I wouldn't exactly call it a bug, but it can be irritating nonetheless): If you try to pass a text value containing a null character as a bind value to a statement handle during

Re: DBD::Pg: Null bytes in text

2002-12-11 Thread Tim Bunce
On Wed, Dec 11, 2002 at 09:26:38AM -0800, David Wheeler wrote: On Wednesday, December 11, 2002, at 09:18 AM, Baldur Kristinsson wrote: Here is an issue regarding DBD::Pg (I wouldn't exactly call it a bug, but it can be irritating nonetheless): If you try to pass a text value containing a

Re: DBD::Pg: Null bytes in text

2002-12-11 Thread Bruce Momjian
David Wheeler wrote: On Wednesday, December 11, 2002, at 01:00 PM, Tim Bunce wrote: The driver should always try to be as transparent as possible. The general principle is don't mes with the users data unless they've specifically asked you to (cf. ChopBlanks). Hrm. So what do you

Re: DBD::Pg: Null bytes in text

2002-12-11 Thread David Wheeler
On Wednesday, December 11, 2002, at 04:16 PM, Bruce Momjian wrote: Hrm. So what do you reckon is the most transparent way to deal with nul bytes embedded in strings? Because libpq is C based, and we pass the query as a C string to the backend, I can not think of a way to make nulls pass

Re: DBD::Pg: Null bytes in text

2002-12-11 Thread Bruce Momjian
David Wheeler wrote: On Wednesday, December 11, 2002, at 04:16 PM, Bruce Momjian wrote: Hrm. So what do you reckon is the most transparent way to deal with nul bytes embedded in strings? Because libpq is C based, and we pass the query as a C string to the backend, I can not think

Re: DBD::Pg: Null bytes in text

2002-12-11 Thread Rudy Lippan
On Wed, 11 Dec 2002, David Wheeler wrote: Because libpq is C based, and we pass the query as a C string to the backend, I can not think of a way to make nulls pass transparatenly. Seems bytea is the only good solution, where \\0 becomes NULL. Yeah, but now we're talking about what to do

Re: DBD::Pg: Null bytes in text

2002-12-11 Thread Rudy Lippan
On Wed, 11 Dec 2002, Bruce Momjian wrote: PQescapeString is not for binary data, only for text string, escaping quotes and backslashes and stuff like that. The only binary one is PQescapeBytea(). Makes sense. What exactly is Pg's idea of binary data? Anything !in SQL_CHARACTER || !in in

Re: DBD::Pg: Null bytes in text

2002-12-11 Thread Bruce Momjian
Rudy Lippan wrote: On Wed, 11 Dec 2002, Bruce Momjian wrote: PQescapeString is not for binary data, only for text string, escaping quotes and backslashes and stuff like that. The only binary one is PQescapeBytea(). Makes sense. What exactly is Pg's idea of binary data? Anything !in