7 messages in com.mysql.lists.perlRe: $dbh->last_insert_id() not wor...
FromSent OnAttachments
Daniel Kasak15 Jun 2004 16:10 
William R. Mussatto15 Jun 2004 16:21 
Daniel Kasak15 Jun 2004 16:39 
William R. Mussatto15 Jun 2004 17:02 
Jochen Wiedmann15 Jun 2004 23:40 
Daniel Kasak16 Jun 2004 15:20 
lei shen17 Jun 2004 07:44 
Subject:Re: $dbh->last_insert_id() not working
From:Daniel Kasak (dka@nusconsulting.com.au)
Date:06/16/2004 03:20:29 PM
List:com.mysql.lists.perl

Jochen Wiedmann wrote:

On Mi, 2004-06-16 at 01:39, Daniel Kasak wrote:

Any if I use the suggested:

$pk = $dbh->{'mysql_insertid');

then I'm locking the object to work with MySQL only, and I'd really prefer to use DBI's more portable 'last_insert_id()' function ... if the damned thing works.

Do you think that SELECT LAST_INSERT_ID() is different in that aspect? :-)

Huh? DBI's database handle's last_insert_id() *function* is server neutral. Have a look an the man page for DBI. The docs say specifically that it works with MySQL, Postgres, Oracle, Informix, Sybase & SQL Server. So in this way, I think the last_insert_id() function is quite different to both:

select LAST_INSERT_ID(), and $dbh->{'mysql_insertid');

which both are MySQL-specific.