7 messages in com.mysql.lists.perlRe: $dbh->last_insert_id() not...
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:William R. Mussatto (muss@csz.com)
Date:06/15/2004 05:02:18 PM
List:com.mysql.lists.perl

Daniel Kasak said:

William R. Mussatto wrote:

syntax error: should be $pk = $dbh->{'mysql_insertid'};

Thanks for the answer :) Someone else in the main MySQL list said that to me, right before suggesting I come here.

That's not what my DBI docs say though:

$rv = $dbh->last_insert_id($catalog, $schema, $table, $field);

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.

But thanks for the suggestion. I will use it for now to get things up & running, and I might go bug the DBI developers if I can't get the above working.

Put it, and any other mysql unique stuff into a .pm file and refer to that. Then you will be able to change it only in one place. Just went through convertsion MS SQL -> mysql and the date functions are NOT THE SAME!!. Some databases don't even have an autoincrement function, so its not part of the SQL standard.