On 27 Jun 2001, Randal L. Schwartz wrote:
> Nope.  Still fails on pack "C*", 128..255;  Works for pack "C*", 128
> though.  Dies with
> 
> ERROR:  Unterminated quoted string
> 
> Something isn't being detected right.  It doesn't work
> until it can handle pack "C*", 0..255, correct?
This is what I have, and it seems to work.

#!/usr/bin/perl

    use DBI qw(SQL_BINARY SQL_VARCHAR);

    my $dbh = DBI->connect("dbi:Pg:dbname=users", "sw", "sw",
      { RaiseError => 1 });
    $dbh->do("drop TABLE test");
    $dbh->do("CREATE TABLE test (a BYTEA)");
    my $insert = $dbh->prepare("INSERT INTO test VALUES (?)");
    my $x1=pack "C*", 0..255;
    $insert->bind_param(1, undef, SQL_BINARY); # necessary for BYTEA
    $insert->execute($x1);

Can you give me your code? and output from DBI_TRACE=2 yourscript?

-alex

Reply via email to