Re: INSERT returning ID

2004-02-25 Thread Brent Baisley
Look into the mysql_insert_id function, that looks like what you want. On Feb 24, 2004, at 12:02 PM, David Scott wrote: Hi list peeps In many of my projects I have the need to insert a new record into a table and then later on in the script update this record, Right now I am doing this by

Re: INSERT returning ID

2004-02-24 Thread Paul DuBois
At 17:02 + 2/24/04, David Scott wrote: Hi list peeps In many of my projects I have the need to insert a new record into a table and then later on in the script update this record, Right now I am doing this by doing the insert, then immediately doing a Select to return the latest id

Re: INSERT returning ID

2004-02-24 Thread vpendleton
You could try creating a function in Java or C/C++ or whatever your preference is that wraps the select statements up for you and returns the insert ID. Original Message On 2/24/04, 11:02:51 AM, David Scott [EMAIL PROTECTED] wrote regarding INSERT returning ID: Hi list peeps In many

Re: INSERT returning ID

2004-02-24 Thread Jeff Mathis
but there are ways to get this value. The Java API handles this case just fine, and I'd be willing to bet other API's do it as well. here's some simple code to do with the Java API: String sql = some insert sql statement; Statement stmt = getConnection().createStatement();

Re: INSERT returning ID

2004-02-24 Thread Paul DuBois
At 10:25 -0700 2/24/04, Jeff Mathis wrote: but there are ways to get this value. The Java API handles this case just fine, and I'd be willing to bet other API's do it as well. I know that, but that isn't what he asked. here's some simple code to do with the Java API: String sql = some insert

Re: INSERT returning ID

2004-02-24 Thread Eric B.
I'm not 100% sure, but this type of programming would seem to be opening the doors for bugs down the road that get difficult to trace and to track. If you are using a multi-threaded app, then you have to make sure that you prevent any mods to the DB after your insert and before your select. If