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

perldoc DBI:

  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.

Thus, the statement handle picks up the value of RaiseError at the time it
is prepared, and keeps that value even after the database handle gets a new
value for RaiseError.

You should turn off RaiseError for the statement handle, rather than for
the database handle:

$c_autonext->{'RaiseError'} = 0;


Ronald

Reply via email to