Subject: | Perl DBD::DB2 v1.78 problem with the CLOB data type |
Date: | Mon, 17 May 2010 23:18:43 +0400 |
To: | opendev [...] us.ibm.com, bug-DBD-DB2 [...] rt.cpan.org |
From: | Anatoly Davidov <tolix [...] olviko.ru> |
Hello!
It looks like the new version of DBD::DB2 (v1.78) has an issue with the
CLOB data type (at least) on my CentOS/RedHat Linux 5.5 32bit box
running DB2 Express-C v9.7, perl v5.8.8.
The problem: when a SELECT statement does not contain a CLOB field in
the list of fields to return, it works fine (returns rows). But when I
am adding a CLOB field - the resulting data set becomes
empty.($sth->fetchrow_array() returns undef immediately).
The issue is not reproducible on previous versions of DBD::DB2 (v1.76,
v1.1).
The script to reproduce:
#!/usr/bin/perl
use strict;
use DBI;
use Data::Dumper;
my $dbh = DBI->connect('dbi:DB2:o3x', '', '') || die DBI::errstr();
$dbh->{LongReadLen} = 2000000;
$dbh->{LongTruncOk} = 1;
$dbh->do('SET SCHEMA o3x');
# docfield.defvalue is CLOB, codepage CP1251.
my $q1 = qq{
SELECT
docfield.tablename,
docfield.docfieldtag,
docfield.tablefieldname,
docfield.docfieldname,
docfield.defvalue,
docfield.quoteme
FROM
docfield
WHERE
docfield.doctype = 'Man'
};
my $sth = $dbh->prepare($q1) || die $dbh->errstr();
$sth->execute();
while( my @row = $sth->fetchrow_array() )
{
print join(', ', @row), "\n";
}
die $sth->errstr() if $sth->err;
$sth->finish();
$dbh->disconnect();