PHP 4.0 Bug #8786 Updated: odbc_insert_id()
| From: | kara@php.net | Date: | Thu, 18 Jan 2001 16:29:53 +0000 |
| Subject: | PHP 4.0 Bug #8786 Updated: odbc_insert_id() | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-44490@lists.php.net to get a copy of this message | ||
ID: 8786
Updated by: kara
Reported By: stuarth@generalsearch.net
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] stuarth@generalsearch.net
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