Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^2: How to safely test if a database handle is capable of transactions?

by larryl (Scribe)
on Nov 19, 2008 at 19:40 UTC ( #724699=note: print w/ replies, xml ) Need Help??


in reply to Re: How to safely test if a database handle is capable of transactions?
in thread How to safely test if a database handle is capable of transactions?

ikegami: I'm just wondering:

Why do you say:

eval { local $dbh->{AutoCommit} = 0; }; $self->{_can_do_transactions} = $@ ? 0 : 1;
can be written more reliably as
$self->{_can_do_transactions} = eval { local $dbh->{AutoCommit} = 0; 1 };
?


Comment on Re^2: How to safely test if a database handle is capable of transactions?
Select or Download Code
Replies are listed 'Best First'.
Re^3: How to safely test if a database handle is capable of transactions?
by ikegami (Pope) on Nov 19, 2008 at 21:50 UTC
    If there's an eval without a local $@; in the code that handles $dbh->{AutoCommit} = $previous_value;, then $@ will get clobbered. Keep in mind that $dbh->{AutoCommit} is a tied variable.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://724699]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (17)
As of 2015-07-28 19:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (258 votes), past polls