I've found that DBD::Pg not works with binary data.
It occurs "Unterminated quoted string" with long invisible-character.
It seems that buffer that dbdimp.c gets in dbd_st_execute
at line 1034 is too small.
I change to extend that buffer and it works fine.
[dbdimp.c(line 1034) : before]
int max_len = imp_sth->all_params_len * 4 +
DBIc_NUM_PARAMS(imp_sth) * 2 + 1;
[dbdimp.c(line 1034) : after ]
int max_len = imp_sth->all_params_len * 5 +
DBIc_NUM_PARAMS(imp_sth) * 2 + 1;
[environment]
-TurboLinux 6.0 Workstation
-PostgreSQL 7.1.3
-perl 5.00503
-DBI 1.02
-DBD::Pg 1.01
[test script]
#!/usr/bin/perl
use strict;
use DBI ;
my $dbh=DBI->connect( 'dbi:Pg:dbname=test', 'scott', 'tiger',
{RaiseError=>0, AutoCommit=>1, PrintError=>0} )
or die($DBI::errstr);
my $wk = "\x01" x 20;
my $sth;
$dbh->do('DELETE FROM TestTable WHERE key =100');
$sth=$dbh->prepare( q{INSERT INTO TestTable VALUES(?, ?)} ) ;
$sth->bind_param( 1,100 ) ;
$sth->bind_param( 2,$wk,DBI::SQL_BINARY ) ;
DBI->trace(3, 'trace');
$sth->execute ;
DBI->trace(0);
[trace : before]
DBI 1.20-nothread dispatch trace level set to 3
-> execute for DBD::Pg::st (DBI::st=HASH(0x8188500)~0x818835c)
dbd_st_execute
dbd_st_execute: statement = >INSERT INTO TestTable VALUES(100,
'\\001\\001\\001\
\001\\001\\001\\001\\001\\001\\001\\001\\001\\001\\001\\001\\001\\001\\001\\
001\
\00<
ERROR EVENT 7 'ERROR: Unterminated quoted string' on
DBI::st=HASH(0x818835c
)
ERROR: Unterminated quoted string error 7 recorded: ERROR: Unterminated
quoted
string
!! ERROR: 7 'ERROR: Unterminated quoted string'
<- execute= undef at testpg1.pl line 14
[trace : after]
DBI 1.20-nothread dispatch trace level set to 3
-> execute for DBD::Pg::st (DBI::st=HASH(0x8188500)~0x818835c)
dbd_st_execute
dbd_st_execute: statement = >INSERT INTO TestTable VALUES(100,
'\\001\\001\\001\
\001\\001\\001\\001\\001\\001\\001\\001\\001\\001\\001\\001\\001\\001\\001\\
001\
\001')<
<- execute= 1 at testpg1.pl line 14
Best regards.
==============================================
Kawai, Takanori(Hippo2000)
Mail: [EMAIL PROTECTED] [EMAIL PROTECTED]
http://member.nifty.ne.jp/hippo2000
==============================================