Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Is last_insert_id for msyql reliable with DBI?

by drewbie (Chaplain)
on Jun 05, 2004 at 13:44 UTC ( [id://361608]=note: print w/replies, xml ) Need Help??


in reply to Is last_insert_id for msyql reliable with DBI?

I've never once had a problem with last_insert_id. As a previous poster mentioned, it's per connection. Relevant quote from the docs below. There's also a note about SQL function LAST_INSERT_ID() if you happen to use it.

From http://dev.mysql.com/doc/mysql/en/mysql_insert_id.html
Note that mysql_insert_id() returns 0 if the previous statement does not use an AUTO_INCREMENT value. If you need to save the value for later, be sure to call mysql_insert_id() immediately after the statement that generates the value.

The value of mysql_insert_id() is affected only by statements issued within the current client connection. It is not affected by statements issued by other clients.

  • Comment on Re: Is last_insert_id for msyql reliable with DBI?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (5)
As of 2024-04-16 05:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found