From: Peter Rabbitson Date: Wed, 11 Mar 2009 10:03:06 +0000 (+0000) Subject: Replace the fallback _dbh_last_insert_id with an explicit exception. X-Git-Tag: v0.08100~48 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=dbsrgits%2FDBIx-Class.git;a=commitdiff_plain;h=93b7182b41791a8253cef12f02805eaab05df91d 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 --- diff --git a/lib/DBIx/Class/Storage/DBI.pm b/lib/DBIx/Class/Storage/DBI.pm index 1b05615..d70bed2 100644 --- a/lib/DBIx/Class/Storage/DBI.pm +++ b/lib/DBIx/Class/Storage/DBI.pm @@ -1565,9 +1565,18 @@ Return the row id of the last insert. =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 (<