>From the docs:

    =head1 ATTRIBUTES COMMON TO ALL HANDLES
     
    These attributes are common to all types of DBI handles.
     
    Some attributes are inherited by child handles. That is, the value
    of an inherited attribute in a newly created statement handle is the
    same as the value in the parent database handle. Changes to attributes
    in the new statement handle do not affect the parent database handle
    and changes to the database handle do not affect existing statement
    handles, only future ones.

Tim.

On Fri, Feb 01, 2002 at 09:20:59AM -0500, Ron MacNeil wrote:
> 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
> 
> 
> 

Reply via email to