[CDBI] Problem with _auto_increment_value()

Eric W. Bates ericx at vineyard.net
Wed Nov 29 16:53:55 GMT 2006

Hash: SHA1


For the Google search record:

This is really a FreeBSD ports problem. DBI is installed by the port
databases/p5-DBI. For some reason, the port was split post DBI version
1.37 into p5-DBI-137 and p5-DBI. If you use portupgrade, it recognizes
that the port has been renamed and does nothing when asked to upgrade
p5-DBI-137 (makes sense). Easily repaired by forcing the upgrade:

portupgrade -o databases/p5-DBI p5-DBI

and then forcing a rebuild of the mysql DBD

portupgrade -f p5-DBD-mysql

I believe this could be clarified a bit if the Class::DBI port in
FreeBSD tested the version of DBI.

Eric W. Bates wrote:
> 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.

ClassDBI mailing list
ClassDBI at lists.digitalcraftsmen.net

- --
Eric W. Bates
ericx at vineyard.net
Version: GnuPG v1.2.1 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org


More information about the ClassDBI mailing list