From: Rafael Kitover Date: Thu, 29 Mar 2012 22:01:11 +0000 (-0400) Subject: Fix auto-pk for Sybase ASE, broken by refactoring in fabbd5cc X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=044f5b3e5ba3cd11010d5751eab0acadaf024940;p=dbsrgits%2FDBIx-Class-Historic.git Fix auto-pk for Sybase ASE, broken by refactoring in fabbd5cc Was returning arrayref due to missing arrow, tests were passing because arrayref numifies. Added a test that catches this. --- diff --git a/lib/DBIx/Class/Storage/DBI/Sybase/ASE.pm b/lib/DBIx/Class/Storage/DBI/Sybase/ASE.pm index 6036acd..f7121e1 100644 --- a/lib/DBIx/Class/Storage/DBI/Sybase/ASE.pm +++ b/lib/DBIx/Class/Storage/DBI/Sybase/ASE.pm @@ -326,7 +326,7 @@ sub _execute { my ($rv, $sth, @bind) = $self->next::method(@_); - $self->_identity( ($sth->fetchall_arrayref)[0][0] ) + $self->_identity( ($sth->fetchall_arrayref)->[0][0] ) if $self->_perform_autoinc_retrieval; return wantarray ? ($rv, $sth, @bind) : $rv; diff --git a/t/746sybase.t b/t/746sybase.t index 43e2ab5..33b3bcd 100644 --- a/t/746sybase.t +++ b/t/746sybase.t @@ -89,6 +89,7 @@ SQL # test primary key handling my $new = $schema->resultset('Artist')->create({ name => 'foo' }); + like $new->artistid, qr/^\d+\z/, 'Auto-PK returned a number'; ok($new->artistid > 0, "Auto-PK worked"); $seen_id{$new->artistid}++;