Re: Getting last inserted record from database

2009-10-27 Thread Brian Kotek
Exactly. On Tue, Oct 27, 2009 at 10:32 AM, James Holmes wrote: > > However without a serializable transaction (assuming read committed is > therefore the isolation level used), another query could insert a new > row and commit before the commit in this transaction; this would > result in an inco

Re: Getting last inserted record from database

2009-10-27 Thread James Holmes
However without a serializable transaction (assuming read committed is therefore the isolation level used), another query could insert a new row and commit before the commit in this transaction; this would result in an incorrect ID. mxAjax / CFAjax docs and other useful articles: http://www.bifro

Re: Getting last inserted record from database

2009-10-27 Thread Dave Watts
> Since serializable is the only isolation level that is meant to eliminate > phantom reads, that means that this approach will probably only work if you > set the isolation level to serializable (and, of course, that your RDBMS > supports it). Which includes the performance implications that this

RE: Getting last inserted record from database

2009-10-27 Thread DURETTE, STEVEN J (ATTASIAIT)
little nuances. SCOPE_IDENTITY, @@IDENTITY, etc. Steve -Original Message- From: Timothy Laureska [mailto:tlaure...@dhmh.state.md.us] Sent: Monday, October 26, 2009 3:18 PM To: cf-talk Subject: Re: Getting last inserted record from database I would think you'd use a "max_id" s

Re: Getting last inserted record from database

2009-10-26 Thread Brian Kotek
Since serializable is the only isolation level that is meant to eliminate phantom reads, that means that this approach will probably only work if you set the isolation level to serializable (and, of course, that your RDBMS supports it). Which includes the performance implications that this isolati

Re: Getting last inserted record from database

2009-10-26 Thread Timothy Laureska
I would think you'd use a "max_id" scenario , where you query for the last id number using SELET Max (id) as max_id >>> Azadi Saryev 10/26/2009 3:06 PM >>> On 27/10/2009 03:03, Arsalan Tariq Keen wrote: > I have a form of placing purchase order. Each purchase order is uniquely > identifi

Re: Getting last inserted record from database

2009-10-26 Thread Ramon Ecung
ssage-- From: Brian McCairn To: ColdFusion Mailing List ReplyTo: ColdFusion Mailing List Subject: Re: Getting last inserted record from database Sent: Oct 26, 2009 3:09 PM select the max id straight after the insert and wrap it all in cftransaction

Re: Getting last inserted record from database

2009-10-26 Thread Allen Souliere
You may also want to consider the use of sequences instead of an identity column (a la Oracle and others). I don't know if that is an option for you though. Allen Alan Rother wrote: > Here are the help docs for your database type. > > http://www.h2database.com/html/functions.html#identity > >

Re: Getting last inserted record from database

2009-10-26 Thread Brian McCairn
select the max id straight after the insert and wrap it all in cftransaction tags ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.hous

Re: Getting last inserted record from database

2009-10-26 Thread Alan Rother
Here are the help docs for your database type. http://www.h2database.com/html/functions.html#identity In the same CFQUERY as your insert do a select and follow the syntax indicated on that help page. You also need to specify a name for your

Re: Getting last inserted record from database

2009-10-26 Thread Arsalan Tariq Keen
I am using H2. -- From: "Alan Rother" Sent: Tuesday, October 27, 2009 1:09 AM To: "cf-talk" Subject: Re: Getting last inserted record from database > > What database are you using? There a specific methods for each type

Re: Getting last inserted record from database

2009-10-26 Thread Alan Rother
What database are you using? There a specific methods for each type. On Mon, Oct 26, 2009 at 12:06 PM, Azadi Saryev wrote: > > On 27/10/2009 03:03, Arsalan Tariq Keen wrote: > > I have a form of placing purchase order. Each purchase order is uniquely > identified by the 'ID' column in the datab

Re: Getting last inserted record from database

2009-10-26 Thread Azadi Saryev
On 27/10/2009 03:03, Arsalan Tariq Keen wrote: > I have a form of placing purchase order. Each purchase order is uniquely > identified by the 'ID' column in the database table which is an Auto > Increment integer field. I want to know, how can I obtain the 'ID' of an > order which I just placed

Getting last inserted record from database

2009-10-26 Thread Arsalan Tariq Keen
I have a form of placing purchase order. Each purchase order is uniquely identified by the 'ID' column in the database table which is an Auto Increment integer field. I want to know, how can I obtain the 'ID' of an order which I just placed in the database table? Regards, Arsalan