i doubt that this is an actual bug, or there would have been a
discussion before, but just in case someone can save what remains of my
hair:
anyone aware of an os-x-specific problem with dbd::mysql's
$dbh->{last_insertid}?
it always returns zero on my powerbook, but the identical applications
work perfectly everywhere else I've tried them.
there's no problem in the mysql client, or if the request is made
directly in perl:
my $sth = $dbh->prepare('select LAST_INSERT_ID() as lastid;');
ends up returning the proper value. So I could work around it, but i
rely on Class::DBI quite a bit, which uses $dbh->{last_insertid} to
retrieve the id of an object just created. and it's always 0. grrr.
thanks.
will
ps.
I've been updating like crazy to try and make it go away, to no avail.
Here's the resulting setup:
perl 5.8.0
DBI 1.30
mysql Ver 11.18 Distrib 3.23.53, for apple-darwin6.1 (powerpc)
msql-mysql tools 1.2219 (ie DBD::mysql 2.0419)
and here's the simplest case that doesn't work for me.
mysql > use test;
mysql > create table dbdtest (id int not null auto_increment, title
varchar(255), primary key(id));
and:
use DBI;
use Data::Dumper;
my $dsn = "DBI:mysql:database=test;host=localhost";
my $dbh = DBI->connect( $dsn );
my $handle = $dbh->prepare( "insert into dbdtest (title) values (?)" );
$handle->execute( 'test person );
print $dbh->{mysql_insertid} . "\n";
__END__
always prints 0 :(
- Re: [OT] Shareware (was: Re: What up wi... Chris Devers
- Re: [OT] Shareware (was: Re: What up wi... Jeff Hallgren
- [OT] Terminal Speed (was Shareware... Martin Redington
- Re: What up with the mac Erik Price
- Re: What up with the mac Gregory Cranz
- Re: What up with the mac Sherm Pendley
- Re: What up with the mac William H. Magill
- Re: What up with the mac Peter Tattersall
- Re: What up with the mac Erik Price
- Re: What up with the mac ellem
- Re: os x specific DBD::mysql insert_id problem? william ross
- Re: os x specific DBD::mysql insert_id problem? Chris Reinhardt
- Re: os x specific DBD::mysql insert_id prob... william ross