How about using a UUID for the primary key and then you wouldn't have to do
the select?

- Calvin 

-----Original Message-----
From: Jochem van Dieten [mailto:[EMAIL PROTECTED] 
Sent: Sunday, June 05, 2005 2:23 AM
To: CF-Talk
Subject: Re: Get New Record ID in mySQL

Aaron Rouse wrote:
> I am not familar with MySQL but what would be the advantage of using 
> that function over just using
> 
> <cftransaction>
> <cfquery ...>INSERT INTO myTABLE (myCOLUMNS) VALUES (myVALUES) 
> </cfquery> <cfquery ... name="get"> SELECT MAX(ID) AS NewID FROM 
> myTABLE </cfquery> </cftransaction>

This does not guarantee to give the right result. You need a SERIALIZABLE
transaction to be guaranteed to get the right result, but that isolation
level has a very high concurrency penalty (if it is even implemented
correctly for the table handler).

Jochem



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:208647
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to