[Bast-commits] r6395 - DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/ODBC

ribasushi at dev.catalyst.perl.org ribasushi at dev.catalyst.perl.org
Sun May 24 08:47:04 GMT 2009


Author: ribasushi
Date: 2009-05-24 08:47:03 +0000 (Sun, 24 May 2009)
New Revision: 6395

Modified:
   DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/ODBC/Microsoft_SQL_Server.pm
Log:
MSSQL through ODBC does not like unfinished statements - make sure we finish the scope identity retrieval
(This worked before because of the automatic retry on exception, essentially running any select after insert twice)

Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/ODBC/Microsoft_SQL_Server.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/ODBC/Microsoft_SQL_Server.pm	2009-05-23 23:47:32 UTC (rev 6394)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/ODBC/Microsoft_SQL_Server.pm	2009-05-24 08:47:03 UTC (rev 6395)
@@ -19,7 +19,10 @@
     my ($op) = @_;
 
     my ($rv, $sth, @bind) = $self->dbh_do($self->can('_dbh_execute'), @_);
-    $self->{_scope_identity} = $sth->fetchrow_array if $op eq 'insert';
+    if ($op eq 'insert') {
+      $self->{_scope_identity} = $sth->fetchrow_array;
+      $sth->finish;
+    }
 
     return wantarray ? ($rv, $sth, @bind) : $rv;
 }




More information about the Bast-commits mailing list