in reply to Re: Toggling dbi attribute within a connection?
in thread Toggling dbi attribute within a connection?

First, thank you very much for the suggestions.

I had thought that delete $dbh->{RaiseError} might work, too, but it gives this error:

Can't locate object method "DELETE" via package "DBI::db"

I had tried (and just tried again) making it local in scope when setting it, as you suggested, and that does not seem to be working either to turn it on only temporarily. (it stays on outside of the scrope)

This is weird.

Matt
  • Comment on Re^2: Toggling dbi attribute within a connection?

Replies are listed 'Best First'.
Re^3: Toggling dbi attribute within a connection?
by Limbic~Region (Chancellor) on May 12, 2005 at 15:35 UTC
    Matt,
    First, DELETE is not delete. Second, can you provide a minimal example of the code that you can't get to work per the docs (using naked blocks for scopes).

    Cheers - L~R

      %$dbh is tied, so the delete translates to a DELETE.
      The error complains about 'DELETE', yes, but I am calling 'delete'.
      delete $dbh->{RaiseError};
      Minimal example of code as follows:

      # at this point RaiseError is off as per default connection { local $dbh->{RaiseError} = 1; LABEL_START_TRANSACTION1: eval { # prepare the sql statement $sth = $dbh->prepare($sql); # execute the sql statement $sth->execute(); }; } if ($@) { .. handle the error }
      But at this point, right below where this code ends, dbi calls still act as if I have RaiseError turned on.

      Matt