I get the following message from Informix when executing 2 select statements one after the other and the select statement returns a lvarchar. The problem occurs in an application written using Perl, Catalyst, DBIx::Class. This application runs without problem in HPUX/Informix environment but fails under Linux/Informix.
Because the application is so complicated I have written a perl script (below) which replicates the problem. The first execute runs ok but fails on the second one.
DBD::Informix::st fetchall_arrayref failed: SQL: -1820: Host variable type has been changed between fetches or puts. at ./lvarchar.pl line 46. (2nd $row_ref = $sth->fetchall_arrayref;
)
Versions:
Linux: Redhat 2.6.18-308.1.1.e15
Perl: 5.10.1
Archname: x86_64-linux-thread-multi
DBD::Informix: 2011.0612
Informix database: IBM Informix Dynamic Server Version 11.50.FC9TL
Informix client: 3.50.FC9
Perl script:
=================================
#!/usr/local/bin/perl
use strict;
use Data:

umper;
use DBD::Informix;
my ($informixserver, $database, $user, $password, $search);
$informixserver='greyst23_sys_test';
$database='qmr_test';
$ENV{INFORMIXDIR} = '/opt/informix';
$ENV{INFORMIXSERVER} = $informixserver;
$ENV{DBDATE} = 'DMY4';
warn "$informixserver\n";
my $dbh = DBI->connect("dbi:Informix:$database")
|| die "Can't connect to $database";
emy $sql = "select id, description,eu_quota_code, declaration_text, active from product_types where id = ?";
my $sth = $dbh->prepare($sql);
$sth->execute(1);
my $row = 0;
my @row;
my $row_ref;
$row_ref = $sth->fetchall_arrayref;
foreach my $ref (@{$row_ref}) {
print "Row $row: ";
foreach my $item (@$ref) {
print $item . ',';
}
print "\n";
$row++;
}
$sth->execute(3);
my $row = 0;
my @row;
my $row_ref;
$row_ref = $sth->fetchall_arrayref;
foreach my $ref (@{$row_ref}) {
print "Row $row: ";
foreach my $item (@$ref) {
print $item . ',';
}
print "\n";
$row++;
}
$sth->finish;
======================
Table schema:
---------- qmr_test@greyst23_sys_test ---------- Press CTRL-W for Help --------
Column name Type Nulls
id serial no
code varchar(254,0) no
description varchar(254,0) no
eu_quota_code varchar(254,0) yes
declaration_text lvarchar(2000) yes
active char(1) no
create_user varchar(20,0) no
create_at datetime year to second no
update_user varchar(20,0) no
update_at datetime year to second no
---------------------------------------------------------------------------------------------
Declaration_text is the one causing the problem. If this is omitted then the script runs ok.
Am I (or DBIx::Class) doing something wrong or is this a bug in DBD::Informix or Informix csdk?
Let me know if you need anymore information.