On Tuesday, October 29, 2002, at 02:50  AM, Tim Bunce wrote:

That seems like a rather poor design.
Yes, it's unfortunate that binary and string data can't be escaped in the same way. The reasons for the double parsing of bytea data are perhaps historical, I honestly don't know. Perhaps I'll pester the PostgreSQL developers to change that or introduce a new binary type (byteb?) that doesn't get parsed a second time.

And probably not possible in all cases.
Right.

Beware that your semantics for SQL_BINARY must match those of ODBC.
I think ODBC requires SQL_BINARY values to be formated as pairs of
hex chars.
Hex? Hrm. Quoting from DBD::Pg's dbdimp.c:

/* if the parameter was bound as SQL_BINARY, escape nonprintables */
if (phs->ftype == 17 && !isPRINT(*val)) { /* escape null character */
dest+=snprintf(dest, strlen(imp_sth->statement) + max_len +
(statement - dest), "\\\\%03o", *((unsigned char *)val));

That looks to me like it's using octal characters. Is this wrong, then? This approach, BTW, is what the bytea data type understands, not hex.

Best to use bind_param($col, $val, { pg_type => NNN })
where NNN is the value of the PostgreSQL bytea type.
Right, okay.

Thanks for the reply, Tim!

Regards,

David

--
David Wheeler                                     AIM: dwTheory
[EMAIL PROTECTED]                                 ICQ: 15726394
http://david.wheeler.net/                      Yahoo!: dew7e
                                               Jabber: [EMAIL PROTECTED]

Reply via email to