ID: 8786
Updated by: kara
Reported By: [EMAIL PROTECTED]
Old-Status: Open
Status: Closed
Bug Type: Feature/Change Request
Assigned To: 
Comments:

There is no way to get this information through ODBC.

A possible solution could be to wrap your inserts into a
stored procedure (more exactly function) that does the
INSERT and returns the desired information.

Or simply use sequences, if your database supports this.

Previous Comments:
---------------------------------------------------------------------------

[2001-01-18 11:19:49] [EMAIL PROTECTED]
Some way of accessing the most recently-inserted row would be very useful.  This could 
be done either by an odbc version of mysql_insert_id(), or (preferably) odbc_exec() 
returning a pointer to the newly-inserted row so that odbc_fetch_row() and 
odbc_fetch_into() can retrieve the data.

I need this because I need to access any identity fields (the closest mysql equivalent 
is auto_increment) that were created during an insert since I tend to use these as 
keys and have foreign keys in other tables pointing to them.

The 2nd way is preferable because it ensures that a very busy SQL server will not 
return any inserts that may have been done in between the insert command and the 
odbc_insert_id() command.  (Even if they're back-to-back, you may still have an insert 
sneak in between if the server is constantly being accessed.)

---------------------------------------------------------------------------


Full Bug description available at: http://bugs.php.net/?id=8786


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to