2 messages in com.mysql.lists.perl$dbh->{mysql_insertid} troubles on Da...
FromSent OnAttachments
mysq...@nospam.wyrdwright.com31 May 2001 07:16 
Jochen Wiedmann31 May 2001 07:38 
Subject:$dbh->{mysql_insertid} troubles on Darwin
From:mysq...@nospam.wyrdwright.com (mysq@nospam.wyrdwright.com)
Date:05/31/2001 07:16:41 AM
List:com.mysql.lists.perl

Hello, All:

I'm also having trouble with $dbh->{'mysql_insertid'} when $dbh is a DBI handle
with DBD::mysql v. 2.0901. For reference, I'm using Darwin 1.3.3 and also get
the problem with DBD::mysql 1.2214 and upwards. I can't quickly compile earlier
versions, so I haven't bothered testing them.

In my script, $dbh is derived from a DBI->connect call, and after preparing and
executing or doing an insert query using this handle, $dbh->{'mysql_insertid'}
returns the value 0.

However, deriving a statement handle from $dbh and using that to get
last_insert_id as in $sth->{'mysql_insertid'}, I get the equivalent value (i.e.
the correct value) as I would with select last_insert_id() on the mysql command
line.

When I make DBD::mysql, either by hand, or using -MCPAN -eshell, I notice the
following comipiler warning:

dbdimp.c: In function `mysql_db_reconnect': dbdimp.c:1694: warning: assignment from incompatible pointer type

The lines in dbdimp.c seem to check the connection and return the old connection
if it is still open or return a re-opened connection if it's closed, but I'm no
C programmer, so I can't be sure. So I suspect, but can't prove, that the
typecasting for the pointer is being screwed up by the flavor of processor in
this machine (G4/Altivec), since the same code works fine when compiled on a
Linux/686 box.

If anyone with the requisite C experience knows what the problem is and would
like me to try a patch on this hardware, I would be a grateful and willing
guinea pig.

BK

-------------- Any bureaucracy sufficiently advanced is indistinguishable from religion. -- YT