I ran into a problem where $sth->err was not being set to the
appropriate Informix SQL error. It was always being set to undef. This
only happens when I was using an ISPY server. If I run the exact code
and point it to the actual Informix server, $sth->err gets set correct.
Here is some of the dbi trace output. It shows the SQL error, and that
->err is being set to undef.
***ERROR***
SQL: -239: Could not insert new row - duplicate value in a UNIQUE INDEX
column.
ISAM: -100: ISAM error: duplicate value for a record with unique key.
<<-- DBD::Informix::dbd_ix_exec()
<<-- DBD::Informix::dbd_ix_st_execute()
<- execute('92' '100001533899' ...)= undef at micro_upd.pl line 68
<- err= undef at micro_upd.pl line 69
Here is the actual code.
$sth_ins->execute($order_id,$serial_num,$man_date,$phone,$status,$last_update_y4md.$last_update_hms);
print "inserted ",$rows ,"
xxxxxxx",defined($sth_ins->err)?" defined":" not defined","\n";
if ($sth_ins->err()) {
print "ERROR-INS:",$DBI::err,"
:$order_id,$man_date,$phone,$status,$last_update_y4md.$last_update_hms,$serial_num\n";
$ins_errors++;
}else{
$rows_ins=$rows_ins+$sth_ins->rows;
}
I am using DBI 1.35, DBD 2003.04 and perl 5.8.0 on AIX 5.2 using
informix 9.30 uc7.
Rick
Jonathan Leffler - 29 Jan 2005 21:47 GMT
> I ran into a problem where $sth->err was not being set to the
> appropriate Informix SQL error. It was always being set to undef. This
[quoted text clipped - 27 lines]
> I am using DBI 1.35, DBD 2003.04 and perl 5.8.0 on AIX 5.2 using
> informix 9.30 uc7.
Dear Rick,
I've not had a chance to investigate this problem. It is not obvious
how the DBD::Informix code could be affected by whether it is I-Spy or
IDS that it connects to, assuming that the I-Spy actually relays the
errors accurately. Does an ESQL/C application - such as DB-Access -
get the errors?

Signature
Jonathan Leffler #include <disclaimer.h>
Email: jleffler@earthlink.net, jleffler@us.ibm.com
Guardian of DBD::Informix v2003.04 -- http://dbi.perl.org/