Hi Guys
Thanks for all the help.
I have some code which inserts something into a database and immediately
(the next line) executes another sql statement with SELECT
LAST_INSERT_ID() - so it is not a previous one from somewhere else in the
code.
My concern was that because the actual connection is always the same in this
child process that I couldn't rely on LAST_INSERT_ID. However if Apache uses
child processes sequentially - i.e there is no danger of that child process
being used simultaneously by two requests I think I should be ok. I think
this is what Perrin was confirming?
Thanks
Justin
On Wed, Dec 10, 2008 at 1:22 PM, Enno <[EMAIL PROTECTED]> wrote:
yes, but, do you really want to gamble that the second request is handled
by
the same child process? and what if another request comes in between?
I think you're misunderstanding his question. As I read it, he was
worried that multiple requests would be handled by the same connection
_at the same time_, making it impossible to rely on last_insert_id.
Since each apache child or thread handles requests sequentially, that
would never happen, and he doesn't need to be concerned about it.
You're correct that it would be totally wrong to try to use
last_insert_id for a value that was inserted on a previous request.
That will not work reliably.
- Perrin