| Justin Patrin 2004-11-29, 8:56 pm |
| On Mon, 29 Nov 2004 15:19:15 -0800, Ken Restivo <ken@restivo.org> wrote:
> On Mon, Nov 15, 2004 at 10:46:12AM -0800, Justin Patrin wrote:
>
> Thanks. The API docs also have the wrong information in the main body (about returning the last inserted ID), but with a note that says "mysql-specific? fixme". My fault for missing that, I guess. It does describe the return value correctly.
>
> I read somewhere that the inserted ID gets inserted into the object after the ->insert(). Is that a reliable, safe way to get the last inserted ID?
>
> I think what I'm saying is, I can't believe that I have to write a utility function (and then subclass DBDO or copy/paste it) to get the last inserted ID. It seems like a very common thing and somewhere in the DBDO docs I must have overlooked the "offic
ially-approved" way to do it.
>
When I use DB_DataObject (please call it that, not DB_Object) the id
is in the object after the insert() call. Of course, I'm using mysql.
I have no idea about other RDBMS.
--
Justin Patrin
|