Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

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: Fri, 25 May 2007 08:40:55 -0700
  • Message-id: <OFAE9306F1(dot)B83F23BA-ON882572E6(dot)005576BF-882572E6(dot)00562508(at)overlandstorage(dot)com>


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
----------------------------------------------------------------------------------------------


Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group