Re: bytea & perl

From: SCassidy(at)overlandstorage(dot)com
To: Tom Allison <tom(at)tacocat(dot)net>
Cc: General PostgreSQL List <pgsql-general(at)postgresql(dot)org>
Subject: Re: bytea & perl
Date: 2007-05-25 15:40:55
Message-ID: OFAE9306F1.B83F23BA-ON882572E6.005576BF-882572E6.00562508@overlandstorage.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

You don't use quote when using placeholders, but you will have to escape
the special characters, as mentioned previously.

The note in DBD:Pg perldoc that says this:

NOTE: The undocumented (and invalid) support for the
"SQL_BINARY"
data type is officially deprecated. Use "PG_BYTEA" with
"bind_param()" instead:

Is talking abojut SQL_BINARY, not PG_BYTEA being deprecated as a type
name.

You use quote when building statements inline, like:

my $modelq=$dbh->quote($model);

$stmt=qq(select id, model from tbl1 where model = $modelq)

Susan Cassidy

Tom Allison <tom(at)tacocat(dot)net>
05/25/2007 04:15 AM

To
SCassidy(at)overlandstorage(dot)com
cc
General PostgreSQL List <pgsql-general(at)postgresql(dot)org>
Subject
Re: [GENERAL] bytea & perl

I think the quote() part for bytes is deprecated already?

my $string = "(" . join($glue, map{$dbh->quote($_,PG_BYTEA)} @$tokens)
. ")";

returns
Unknown type 17, defaulting to VARCHAR
as a warning...

On May 24, 2007, at 1:11 PM, SCassidy(at)overlandstorage(dot)com wrote:

Hi,

First, I would advise never using " insert into xx values (y,x)" without
explicitly naming the columns; same for select statements - never use
select * (a table change can mess things up).

By the way, I just noticed in the release notes for the very latest couple
of versions of DBD:Pg that some placeholder changes were made. You might
want to check the release notes and your version of DBD:Pg about your
placeholder issues.

----------------------------------------------------------------------------------------------
Simply protected storage solutions ensure that your information is
automatically safe, readily available and always there, visit us at http://www.overlandstorage.com
----------------------------------------------------------------------------------------------

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Robert Fitzpatrick 2007-05-25 15:53:44 Re: Referencing any field in a trigger
Previous Message Robert Fitzpatrick 2007-05-25 15:17:50 Referencing any field in a trigger