Skip Menu | You are currently an anonymous guest. | Login | Return to Main | About rt.cpan.org
 

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.

X Report information
Id: 40265
Status: resolved
Left: 0 min
Priority: 0/0
Queue: DBIx-Class

Owner: Nobody
Requestors: dooladri <adrian.doolittle [...] morganstanley.com>
Cc:
AdminCc:

Severity: Important
Broken in: (no value)
Fixed in: 0.08103



X History Display mode: Brief headersFull headers
#   Wed Oct 22 11:39:09 2008 dooladri - Ticket created  
[text/plain 336b]
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.

Thanks,
Adrian
#   Fri Oct 24 08:34:36 2008 RIBASUSHI - Correspondence added  
[text/plain 92b]
Sounds reasonable. Could you please provide a patch with a failing test
against t/74mssql.t?
#   Fri Oct 24 08:34:37 2008 RT_System - Status changed from 'new' to 'open'  
#   Mon Nov 03 11:06:13 2008 MMIMS - Correspondence added  
Subject: Storage::DBI::Sybase needs last_insert_id handling
RT-Send-CC: adrian.doolittle[...]morganstanley.com
[text/plain 1.2k]
On Wed Oct 22 11:39:09 2008, dooladri wrote:
> 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
#   Sun Feb 15 08:32:54 2009 RIBASUSHI - Correspondence added  
[text/plain 61b]
No reply from original submitter, changing status to stalled.
#   Sun Feb 15 08:32:55 2009 RIBASUSHI - Status changed from 'open' to 'stalled'  
#   Sun Feb 15 08:40:12 2009 RIBASUSHI - Subject changed from (no value) to 'DBIx::Class::Storage::DBI::Sybase and last_insert_id'  
#   Tue May 26 16:23:07 2009 RIBASUSHI - Correspondence added  
[text/plain 56b]
DBIx::Class 0.08103 just released on CPAN fixes this RT.
#   Tue May 26 16:23:08 2009 RT_System - Status changed from 'stalled' to 'open'  
#   Tue May 26 16:23:09 2009 RIBASUSHI - Status changed from 'open' to 'resolved'  
#   Wed May 27 01:03:44 2009 RIBASUSHI - Fixed in 0.08103 added