Fix auto-pk for Sybase ASE, broken by refactoring in fabbd5cc
Rafael Kitover [Thu, 29 Mar 2012 22:01:11 +0000 (18:01 -0400)]
Was returning arrayref due to missing arrow, tests were passing because
arrayref numifies. Added a test that catches this.

lib/DBIx/Class/Storage/DBI/Sybase/ASE.pm
t/746sybase.t

index 6036acd..f7121e1 100644 (file)
@@ -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;
index 43e2ab5..33b3bcd 100644 (file)
@@ -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}++;