On Wednesday, December 11, 2002, at 09:18 AM, 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 implementation) that should be fixed.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 execute(), you get the error "parser: unterminated quoted string at or near ..." There seems to be no way to escape the null byte without truncating the string that is being passed (I would guess this happens at the libpq level rather than DBD::Pg, though). If you call $dbh->quote on the value and try to insert it directly into the statement, the null byte is tacitly removed. This seems to me to be better behaviour than the above. So I think it's sensible to remove null bytes from values for other types of columns than BYTEA.
I think that if you have a string with a null byte in it and you want to put it into a field other than BYTEA, your code should be responsible for removing it before it passes it to DBI.
dbi-dev'ers, please correct me if I'm wrong. :-)
David
--
David Wheeler AIM: dwTheory
[EMAIL PROTECTED] ICQ: 15726394
http://david.wheeler.net/ Yahoo!: dew7e
Jabber: [EMAIL PROTECTED]