On Wed Oct 22 11:39:09 2008, dooladri wrote:
Show quoted text> Similar to bug 21260 I am getting the following error:
> DBIx::Class::Schema::populate(): Can't locate DBI object method
> "last_insert_rowid" via package "DBD::Sybase::db" at
> /xxx/perl5/PROJ/DBIx-Class/0.08010/lib/perl5/DBIx/Class/Storage/DBI.pm
> line 1275.
>
> I believe last_insert_rowid should be switched to last_insert_id.
A correct _dbh_last_insert_id method needs to be added for
DBIx::Class::Storage::DBI::Sybase, which currently provides none.
The base method in Storage::DBI defaults to SQLite's last_insert_rowid,
which is probably never correct for any other database. At runtime,
DBIC determines the correct sub-class to handle storage. Each subclass
needs to provide something appropriate for last_insert_id.
The correct handling varies greatly from one DB to the next. See the
last_insert_id documentation for DBD::Sybase for caveats:
http://search.cpan.org/~mewp/DBD-Sybase-1.09/Sybase.pm#Behavior_of_$dbh-%3Elast_insert_id
Using DBI's last_insert_id may be sufficient for DBD::Sybase. If so,
the same method used for DBD::ODBC may work:
http://dev.catalystframework.org/svnweb/bast/revision?rev=4893
Sybase may provide some better means for obtaining the last_insert_id.
Storage::DBI::ODBC::Microsoft_SQL_Server is a less trivial example.
-Marc