Re: DBD::Pg, bytea type

From: Alex Pilosov <alex(at)pilosoft(dot)com>
To: pgsql-interfaces(at)postgresql(dot)org
Cc: E(dot)Mergl(at)bawue(dot)de
Subject: Re: DBD::Pg, bytea type
Date: 2001-03-09 00:25:27
Message-ID: Pine.BSO.4.10.10103081924330.7343-200000@spider.pilosoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

As described in the below email, here's the patch.

Few notes:

It will always properly unquote things of bytea type when retrieved from
select. If someone has code that relies on the old behaviour, you'll need
to change that.

It will only properly enquote things when you do
$sth->bind_param(1, $xxx, DBI::SQL_BINARY);
(ie you must specify binding type to bind_param).

On Thu, 8 Mar 2001, Alex Pilosov wrote:

> Hiyas,
>
> Currently, there's a problem using bytea type transparently with DBD::Pg
> driver. Postgres requires you to quote things in a special way to handle
> bytea data, for example, to insert a null character, you have to use
> '\000'. Select, on other hand, will require you to uncode such data before
> you can actually use it in perl.
>
> I'm making patches for DBD::Pg which will properly quote bytea data
> before insertion and unquote it on select. Let me know if its not a good
> idea.
>
> Another thing: Currently, Pg quote() method only will properly escape
> backslash if the datatype is not specified. If the datatype is specified,
> it'll give wrong result:
> $dbh->quote('foo\\bar', SQL_CHAR) will result in 'foo\bar', but it should
> result in 'foo\\bar'. Anyone minds if I fix this one as well?
>
> -alex
>
>
>
>
>

--
--
Alex Pilosov | http://www.acecape.com/dsl
CTO - Acecape, Inc. | AceDSL:The best ADSL in Bell Atlantic area
325 W 38 St. Suite 1005 | (Stealth Marketing Works! :)
New York, NY 10018 |

Attachment Content-Type Size
dbd-pg.patch text/plain 10.5 KB

Browse pgsql-interfaces by date

  From Date Subject
Next Message Eiji Tokuya 2001-03-09 06:38:22 Multibyte patched psqlodbc-07_01_0003.zip
Previous Message Alex Pilosov 2001-03-09 00:20:29 Re: DBD::Pg, bytea type