Below is a short program that illustrates a problem I'm having with the RaiseError and PrintError attributes. To replicate the problem, you need to have a database table with a single row (in this case stores:customer), and have that row locked by another program.
What should happen is that the prepare cursor should function fine since only the row is locked and not the table, then the RaiseError and PrintError flags are redefined to ignore any errors that may come from the following 'fetchrow_hashref' stmt. But that is not the case, the program will abort at the 'fetchrow_hashref'. If I change the DBI->connect stmt to RaiseError=>0, then it will work as expected. My question is this, why can't I use '$dbh->{RaiseError}=0' to redefine the error handling after an initial connect? Regards, Ron MacNeil Versions used: Linux kernel 2.2.19 with glibc-2.1.3 Informix ESQL 9.51.UC1 Informix SE 7.24.UC5 Perl 5.00503 DBI 1.20 DBD:Informix 1.00.PC1 #!/usr/bin/perl -w # use strict; use DBI; # Define local vars my $sqlcode; my $stat_flag; my $sql_str; my $p_rowcode my $next_number; my $c_autonext; my $c_href; my $dbh = DBI->connect("DBI:Informix:stores", '', '', {AutoCommit => 0, RaiseError => 1}); # Prepare the select statement $sql_str = "select rowid as p_rowid, " . "customer_num as next_number " . "from customer for update"; $c_autonext = $dbh->prepare($sql_str); $stat_flag = 1; # Temporarily turn off error reporting. $dbh->{RaiseError}=0; #<---- This is not working. Why? $dbh->{PrintError}=0; #<---- This is not working. Why? print "RaiseError: $dbh->{RaiseError}\n"; print "PrintError: $dbh->{PrintError}\n"; # This next stmt should not fail if RaiseError is turned off, but it does fail! $c_autonext->execute; $c_href = $c_autonext->fetchrow_hashref; $next_number = $c_href->{next_number}; $p_rowcode $c_href->{p_rowcode $sqlcode = $c_autonext->{ix_sqlcode}; # We never get to this stmt since the 'execute' stmt fails even if # RaiseError is off. Why? print "sqlcode: $sqlcode\n"; # END OF PROGRAM