Re[2]: Strange behavior of DBI/DBD::Informix
Posted in 2003
Thank you for the reply. Sorry, I wrote late in the evening and forgot to post my configuration: Perl 5.6.1 AIX 4.2.1 (I know it's old but this should not be relevant to the problem) DBI 1.32 DBD-Informix-1.04.PC1 IDS 7.30.UC8 ESQL/C 9.30.UC1 SDK 2.40.UC1 All software is located on the same server. I could not test this with the newer version or on the other platform right now... Recently I sent just a scenario. Here is the working example (change appropriately environment, database name and column name): ~~~~~~~ cut here ~~~~~~~~~~~ #!/usr/local/bin/perl -w $ENV{INFORMIXDIR}='/home/informix'; $ENV{INFORMIXSERVER}='informixservername'; $ENV{ONCONFIG}='onconfig'; $database="test"; use locale; use DBI qw(:sql_types); use DBD::Informix qw(:ix_types); $dbh = DBI->connect("dbi:Informix:$database", '', '', { PrintError => 1, RaiseError => 1}); $sql = qq{ INSERT INTO testcol VALUES ( ? ) }; $sth = $dbh->prepare( $sql ) or die "Failed to prepare '$sql'\\n"; $dbh->disconnect; $sth->bind_param( 1, 'q' ); $ret = $sth->execute; if( $@ ) { warn "Database error: $DBI::errstr\\n"; } if ( $ret!=1 ) { print "ret=$ret\\n"; if ( defined $DBI::errstr ) { print "DBI err: $DBI::errstr\\n"; } else { print "IFX err: $sth->{ix_sqlcode}:$sth->{ix_sqlerrm}\\n"; } exit; } ~~~~~~~~~~~~~~~~~~~~~~~ cut here ~~~~~~~~~~~~~~~~~~~~~~~ >> Consider the following scenario: >> 1)$dbh = DBI->connect("dbi:Informix:$database", '', '', >> { PrintError => 1, RaiseError => 1}); >> 2)$sql = qq{ INSERT INTO sometable VALUES ( somevalues ) }; >> 3)$sth = $dbh->prepare( $sql ) or die "Failed to prepare '$sql'\\n"; >> 4)$dbh->disconnect; >> 5)N statements of the form >> $sth->bind_param( K, somevalue ); >> (K=1..N) >> 6)$ret = $sth->execute; >> >> After doing 4) I still can execute 5) and 6) without any obvious error >> message. Of course no insert occurs but it is not clear why (supposing >> we do not know about 4). JL> I could live with 5 not causing problems - not happy, but I could live JL> with it. Step 6 should unequivocally fail. >> Even more, while testing the return code $ret We still can not >> understand what is the problem. $ret is equal to '0E0' that can mean >> 1) "statement does not affect any rows" >> 2) "cursor is opened successfully" >> >> All of >> $@ >> $DBI::errstr >> sqlcode >> sqlerrm >> show nothing in this situation. >> >> Should I check something else? >> Is it bug ("feature")? JL> At first glance, it is a bug - in DBD::Informix. >> Your comments are very welcome. >> >> >> Alexandre Krasnov. >> (TERN Group - Russia) >> sending to informix-list JL> Please - always - send the version information of: JL> Platform (o/s in particular, sometimes h/w) JL> Perl JL> DBI JL> DBD::Informix JL> ESQL/C or CSDK JL> Database server JL> Or use the bug reporting mechanisms provided with DBD::Informix. JL> And please send a simple, self-contained reproduction of the problem. JL> using DBD::Informix::TestHarness; my $dbh = DBI->>connect({RaiseError => 1, Printerror => 1}); $dbh->>do(q{CREATE TEMP TABLE SomeTable(col01 integer not null)}); JL> my $sql = "INSERT INTO SomeTable VALUES(?)"; my $sth = $dbh->>prepare($sql); $dbh->>disconnect; $sth->>bind_param(1, 1); $sth->>execute; JL> This should produce an error, definitely on the execute, and very JL> arguably on the bind_param. I thought there was a test to validate JL> this stuff - but either that test is broken or it is AWOL. Best regards, Alexandre Krasnov. sending to informix-list