Subject: | informix 10.uc3, unable to select from lvarchar columns with a size qualifier |
Version strings
Linux host 2.6.9-5.ELsmp #1 SMP Wed Jan 5 19:30:39 EST 2005 i686 i686 i386 GNU/Linux
IBM Informix Dynamic Server Version 10.00.UC3
Perl v5.8.5 built for i386-linux-thread-multi
[user@host]$ perl -MDBI -e'print "$DBI::VERSION\n";'
1.48
[user@host]$ perl -MDBD::Informix -e'print "$DBD::Informix::VERSION\n";'
2005.01
Bug description
For the above configuration (at least), values from lvarchar columns with "not null" set are not returned.
To test this is create a test table and data:
-- create table lvarchar_test (
-- nulls_allowed lvarchar,
-- no_nulls_allowed lvarchar not null
-- )
-- insert into lvarchar_test (nulls_allowed, no_nulls_allowed)
-- values ('this is returned', 'this isnt beening returned');
And run the attached code.
Note that this works from within dbaccess and via the informix 3.80 32bit ODBC driver so believe it is a DBD::Informix issue.
#!/usr/bin/perl -w
#-------------------------------------------------------------------------------
use strict; use diagnostics;
use DBI 1.48;
my $hostname = 'testhost'; # CHANGE ME
my $db_type = 'Informix';
my $database = 'testdatabase'; # CHANGE ME
#You will need to ensure this configuration information is correct for your environment.
$ENV{'INFORMIXDIR'} = "/usr/informix";
$ENV{'INFORMIXSERVER'} = "$hostname";
$ENV{'ONCONFIG'} = "onconfig";
$ENV{'DBCENTURY'} = "C";
$ENV{'INFORMIXC'} = "i386-glibc20-linux-gcc";
my $INFORMIXDIR = $ENV{'INFORMIXDIR'};
$ENV{'PATH'} .= ":$INFORMIXDIR/bin";
#connect to database
my $dbh;
if ($dbh = DBI->connect("dbi:${db_type}:${database}")) {
$dbh->{PrintError} = 0;
$dbh->{AutoCommit} = 1;
$dbh->{ChopBlanks} = 1;
} else {
die "Failed to connect to db $database";
}
#run sql
my $sql = "SELECT * from lvarchar_test";
my $sth;
my $result_set;
if ( ($sth = $dbh->prepare($sql)) && ($sth->execute() ) ) {
$result_set = $sth->fetchall_arrayref({});
$sth->finish();
print Dumper($result_set);
}else{
print STDERR "Error runing sql $DBI::err $DBI::errstr";
}
$dbh->disconnect;