|go ahead... be a heretic|
DBI and last_insert_idby cog (Parson)
|on Jan 28, 2009 at 21:02 UTC||Need Help??|
cog has asked for the
wisdom of the Perl Monks concerning the following question:
Here's a shorter version of what I was trying to do:
Where the id is an auto-increment column, and also the primary key.
The problem is that last_insert_id() not always gives me the right id. (concurrency? transaction issues?)
I actually tried doing a SELECT on the table right after that INSERT, but since I'm doing this inside a transaction, the SELECT clause returns nothing...
Any ideas on how to go around this? Am I missing something trivial?
Both DBI's and MySQL's documentation point to a few CAVEATS around last_insert_id()...