On Mon, 17 Jan 2005, Dmitry Karasik wrote:

> Hello,

Hello,

> 
> After I've upgraded to newest versions of DBI(1.46) and DBD::Pg (1.32), my
> scripts started to fail while feeding arrays into stored procedures in 
> postgresql base (v7.4.6). The (old working) code was something like
> 
>     $dbh-> selectrow_array("SELECT dummy(?)", {}, [ 1, 2, 3]);
> 

Um I don't know why that would work with an earlier version of DBD::Pg unless 
you were using a version that was hacked to searalize perl arrays. I remember 
that there was a patch floating around to do this, but it was never part of an 
official release.

> Then I've modified the script so it looks like this:
> 
>    my $sth = $dbh->prepare( "SELECT dummy(?)");
>    $sth-> bind_param_array( 1, [1,2,3]);

You caould hack it by passing in a searlized copy of the array and let 
bind_param do the final quote pass.

Also, If you want, you can check out the current cvs version on the 
array_support branch which has support for array quoting and dequoting; 
although, you will have to use bind_param to get the above behaviour, so

        $sth->bind_param(":array_column", [EMAIL PROTECTED], 
{pg_type=>INT4ARRAYOID});
        $sth->execute();

I need to make a final pass at the array code (probably on either tue, or wed or
friday) before it in production ready, but I think that you will be fine with
the integer support as it is now.


Rudy

Reply via email to