[Bast-commits] r7597 -
DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI
ribasushi at dev.catalyst.perl.org
ribasushi at dev.catalyst.perl.org
Mon Sep 7 14:26:59 GMT 2009
Author: ribasushi
Date: 2009-09-07 14:26:59 +0000 (Mon, 07 Sep 2009)
New Revision: 7597
Modified:
DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Pg.pm
Log:
Whoops - last_insert_id allows for multiple autoinc columns - support it in pg
Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Pg.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Pg.pm 2009-09-07 13:36:40 UTC (rev 7596)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Pg.pm 2009-09-07 14:26:59 UTC (rev 7597)
@@ -20,15 +20,22 @@
}
sub last_insert_id {
- my ($self,$source,$col) = @_;
- my $seq = ( $source->column_info($col)->{sequence} ||= $self->dbh_do('_dbh_get_autoinc_seq', $source, $col) )
+ my ($self,$source, at cols) = @_;
+
+ my @values;
+
+ for my $col (@cols) {
+ my $seq = ( $source->column_info($col)->{sequence} ||= $self->dbh_do('_dbh_get_autoinc_seq', $source, $col) )
or $self->throw_exception( "could not determine sequence for "
. $source->name
. ".$col, please consider adding a "
. "schema-qualified sequence to its column info"
);
- $self->_dbh_last_insert_id ($self->_dbh, $seq);
+ push @values, $self->_dbh_last_insert_id ($self->_dbh, $seq);
+ }
+
+ return @values;
}
# there seems to be absolutely no reason to have this as a separate method,
More information about the Bast-commits
mailing list