On Fri, 30 May 2008 at 09:38 -0400, mdykman@stripped confabulated:
> I'm not clear what you mean when you distinguish between JUST inserted
> and LAST inserted. In any case, the only mechanism available is
> SELECT LAST_INSERT_ID(). MySQL does have a concept of sessions, so if
> 2 users are submitting at the same moment, that database activity
> would be occurring across two distinct connections and the result of
> the call would reflect the last insert on that same connection. It's
> perfectly safe and will give you the value that you are looking for.
> (If it didn't, ~70% of the apps on the web would be irretrievably
> broken).
Sorry to break in on the conversation. This is exactly what I was
attempting to find out myself and have one question about your response. I
believe this is what the OP may have been getting at.
So, if you are using either table locking (MyISAM) or row locking
(InnoDB) when doing an INSERT, would SELECT LAST_INSERT_ID() within the
table/row locking be guaranteed to give back the ID of the record you just
inserted?