Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Global dbh and inserts

by sundialsvc4 (Monsignor)
on Feb 19, 2014 at 14:13 UTC ( #1075461=note: print w/ replies, xml ) Need Help??


in reply to Global dbh and inserts

I would recommend that things like last_insert_id be used only immediately after a statement that inserted something, and that the pair of statements be wrapped in an SQL transaction with an appropriate isolation level.   This kind of highly-temporal value must not be maintained in any sort of global variable.   If you do that, you will create a “random, un-reproducible, yet very fatal” bug of the very, very worst kind.


Comment on Re: Global dbh and inserts
Re^2: Global dbh and inserts
by SleepyJay (Beadle) on Feb 19, 2014 at 16:23 UTC

    Exactly what I was thinking, yes. Thanks guys! Sounds like I'm not insane (about this stuff, at least).

    I think I need to understand the Apache::DBI features better.

    Thanks

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (8)
As of 2014-08-29 20:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (288 votes), past polls