[Bast-commits] r5735 - DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage
ribasushi at dev.catalyst.perl.org
ribasushi at dev.catalyst.perl.org
Wed Mar 11 10:03:06 GMT 2009
Author: ribasushi
Date: 2009-03-11 10:03:06 +0000 (Wed, 11 Mar 2009)
New Revision: 5735
Modified:
DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI.pm
Log:
Replace the fallback _dbh_last_insert_id with an explicit exception.
Currently all known Storage::DBI engines provide their own _dbh_last_insert_id, except for Storage::DBI::Sybase, for which the old sqlite-ish fallback doesn't work anyway: http://rt.cpan.org/Public/Bug/Display.html?id=40265
Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI.pm 2009-03-11 09:43:40 UTC (rev 5734)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI.pm 2009-03-11 10:03:06 UTC (rev 5735)
@@ -1565,9 +1565,18 @@
=cut
sub _dbh_last_insert_id {
- my ($self, $dbh, $source, $col) = @_;
- # XXX This is a SQLite-ism as a default... is there a DBI-generic way?
- $dbh->func('last_insert_rowid');
+ # All Storage's need to register their own _dbh_last_insert_id
+ # the old SQLite-based method was highly inappropriate
+
+ my $self = shift;
+ my $class = ref $self;
+ $self->throw_exception (<<EOE);
+
+No _dbh_last_insert_id() method found in $class.
+Since the method of obtaining the autoincrement id of the last insert
+operation varies greatly between different databases, this method must be
+individually implemented for every storage class.
+EOE
}
sub last_insert_id {
More information about the Bast-commits
mailing list