Informix DBD and lvarchar
Posted in 2007
I am trying to return values from the genxml datablade to a perl script.
Informix Dynamic Server version 9.40.HC5, so I should have lvarchar up
to 32K or so. The output is fine in dbaccess, but is truncated in perl.
column type="char" name="fullname">
Pumpkineater, Peter </column>
<column type="integer" name="id">
106958</column>
<column type="char" name="cat">
UG01</column>
<column type="smallint" name="yr">
2002</column>
<column type="char" name="se<row>
The name of the last column above should be sess. And there are several
columns after that. I read in the DBD::Informix that lvarchar was
limited to 2048, unless it was returning a different type. The type
returned is xmlout, a cast from lvarchar. I wondering if there is any
way to get the full output from the DBD. Here is one version of the
perl test script.
$db1->{PrintError} = 1;
$STMT = <<"EOS";
select distinct i.fullname, c.id, c.cat, c.yr, c.sess, c.crs_no, c.sec
from cw_rec c, id_rec i
where c.yr > 2000
and c.crs_no matches "ENG*"
and c.stat = "R"
and c.id = i.id
into temp a with no log;EOS
$db1->do($STMT);
$STMT = <<"EOS";
create temp table xmlout(xml xmldata) with no log;EOS
$db1->do($STMT);
$STMT = <<"EOS";
insert into xmlout(xml)select genxml("row", a) row from a;
EOS
$db1->do($STMT);
$STMT = <<"EOS";
select xml from xmlout;EOS
$sth = $db1->prepare($STMT);
if ( !defined($sth) )
{ die "Cannot prepare directory select: $STMT"; }
else
{
$sth->execute();
while ( $ref = $sth->fetchrow_hashref() )
{ print $ref->{'xml'}; }
}
1;
Any help would be appreciated.
Thanks
jim