[CDBI] Problem with _auto_increment_value()

Eric W. Bates ericx at vineyard.net
Mon Nov 27 18:04:37 GMT 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

This is from code that is several years old which runs fine on other
servers with older versions of Class::DBI.

I'm getting an inexplicable error:

Can't locate object method "last_insert_id" via package
"DBIx::ContextualFetch::db" at
/usr/local/lib/perl5/site_perl/5.8.8/Class/DBI.pm line 612

This is from _auto_increment_value():

    my $id = $dbh->last_insert_id(undef, undef, $self->table, undef)   
# std
        ||
$dbh->{mysql_insertid}                                         # mysql
        || eval { $dbh->func('last_insert_rowid') }
        or $self->_croak("Can't get last insert id");

I find this weird because I'm using mysql and obviously
$dbh->{mysql_insertid} is being skipped over.

When I use Data::Dumper to examine $dbh, I don't see much interesting:

$VAR1 = bless( {}, 'DBIx::ContextualFetch::db' );

Does this imply that $self->DB_Main is not being set correctly?

That doesn't really make sense; because the same program has not trouble
executing selects. This only crops up with an insert().

FreeBSD 4.11-RELEASE-p17
DBD::mysql 3.000.8
DBI 1.37
DBIx::ContextualFetch 1.03
Class::DBI 3.0.16
Class::DBI::mysql 1.00

Thanks for your time.

- --
Eric W. Bates
ericx at vineyard.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (FreeBSD)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFayi1D1roJTQ4LlERApogAKCiPj8hqeTnbPlIxHz+jtclQdcwJgCeP7cT
QTVAUsoO0mh4HjFBL2NnuTs=
=6INh
-----END PGP SIGNATURE-----




More information about the ClassDBI mailing list