Re: best technique to get the ID of the last inserted value
| From: | Richard Lynch | Date: | Fri, 20 Jul 2007 21:20:53 +0000 |
| Subject: | Re: best technique to get the ID of the last inserted value | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-259239@lists.php.net to get a copy of this message | ||
On Fri, July 20, 2007 2:42 pm, Nathan Nobbe wrote:
> im not sure, but i think you still want to surround the insert and the
> db
> specific call to get the
> last insert id within a transaction.
ID generation and uniqueness thereof is SOOO common, that most (all?)
the DBs support it without wrapping things up in a transaction.
In fact, depending on your ACID level, a transaction may or may not
provide a guarantee of getting the right ID back.
Thus, wrapping an insert up in a transaction is generally expensive,
and potentially useless.
So you probably don't want to do that, as a general rule. :-)
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?