If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Informix > Error SQL -1820 when using long varchars with perl informix linux

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old
Registered User
 
Join Date: Jan 2013
Posts: 2
Error SQL -1820 when using long varchars with perl informix linux

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.
Reply With Quote
  #2 (permalink)  
Old
Registered User
 
Join Date: Jan 2013
Posts: 2
Solved!!!
This is an error in the IBM Informix CSDK. A work-around has been provided by Jonathan Leffler in DBD::Informix-2013.0118.

Thank you Jonathan
Reply With Quote
  #3 (permalink)  
Old
Registered User
 
Join Date: Sep 2011
Location: Pont l'Abbé, Brittany, France
Posts: 322
Oh this looks like a retroactive announcement of a new release of DBD::Informix
good!
E.

by the way, for anyone interested:

here is where you can find it
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On