From: Peter Rabbitson Date: Mon, 29 Jun 2009 22:03:21 +0000 (+0000) Subject: Minor fixes X-Git-Tag: v0.08109~29^2~12 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=806258308b89cb080263b5ef45e66604342bb4e6;p=dbsrgits%2FDBIx-Class.git Minor fixes --- diff --git a/lib/DBIx/Class/Storage/DBI/Pg.pm b/lib/DBIx/Class/Storage/DBI/Pg.pm index 41b2357..25d645b 100644 --- a/lib/DBIx/Class/Storage/DBI/Pg.pm +++ b/lib/DBIx/Class/Storage/DBI/Pg.pm @@ -51,10 +51,18 @@ sub _dbh_get_autoinc_seq { sub get_autoinc_seq { my ($self,$source,$col) = @_; - + my @pri = $source->primary_columns; - my ($schema,$table) = $source->name =~ /^(.+)\.(.+)$/ ? ($1,$2) - : (undef,$source->name); + + my $schema; + my $table = $source->name; + + if (ref $table eq 'SCALAR') { + $table = $$table; + } + elsif ($table =~ /^(.+)\.(.+)$/) { + ($schema, $table) = ($1, $2); + } $self->dbh_do('_dbh_get_autoinc_seq', $schema, $table, @pri); } diff --git a/t/76select.t b/t/76select.t index bee69e6..7560d2c 100644 --- a/t/76select.t +++ b/t/76select.t @@ -64,6 +64,7 @@ my $cds = $schema->resultset ('CD')->search ({}, { order_by => 'me.cdid'}); # ma cmp_ok ($cds->count, '>', 2, 'Initially populated with more than 2 CDs'); my $table = $cds->result_source->name; +$table = $$table if ref $table eq 'SCALAR'; my $subsel = $cds->search ({}, { columns => [qw/cdid title/], from => \ "(SELECT cdid, title FROM $table LIMIT 2) me",