Synchronous MySQL: return row ID on INSERT query?
Posted: Fri Dec 12, 2008 5:15 am
I'm curious if MySQL has any synchronous option that would return values on an INSERT query?
Such a return would negate the need to execute a SELECT query to get the ID of the newly created row. For example when creating a new forum thread there is the need to create a row in the thread table and then create a row in the post table. I need to get the newly created ID of the thread so I can associate the row I'll INSERT next in to the posts table to the thread.
I can do the old fashioned method just fine though it'd be nice if this sort of approach exists.
Such a return would negate the need to execute a SELECT query to get the ID of the newly created row. For example when creating a new forum thread there is the need to create a row in the thread table and then create a row in the post table. I need to get the newly created ID of the thread so I can associate the row I'll INSERT next in to the posts table to the thread.
I can do the old fashioned method just fine though it'd be nice if this sort of approach exists.