Posted by Connector5 on 12/26/05 17:29
> But mysql_insert_id() is connection-specific, and PHP won't share a
connection
> within a request, even with persistent connections, so how can this occur?
Are
> you sure it's not some other factor?
The question becomes "can I guarantee that each instance of my web
application will utilize a unique connection?" or even "can I guarantee that
some badly-developed optimizing scheme will take into consideration the
plight of the mysql_insert_id() function?"
mysql_insert_id() is a php function that communicates with a mysql server.
Both php and mysql are in constant development, and it is naive to think
that such a function has reached it's maturity at either end. To this day
people are having issues with the register_globals default setting. We know
what mysql_insert_id() is *supposed* to do, so why not add a little of our
own assurances that it does just that well into php6 or php7?
>
> http://dev.mysql.com/doc/refman/5.0/en/getting-unique-id.html
> http://dev.mysql.com/doc/refman/5.0/en/mysql-insert-id.html
>
> "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."
>
> --
> Andy Hassall :: andy@andyh.co.uk :: http://www.andyh.co.uk
> http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
[Back to original message]
|