[Bast-commits] r3148 - trunk/DBIx-Class/lib/DBIx/Class/Storage

blblack at dev.catalyst.perl.org blblack at dev.catalyst.perl.org
Thu Mar 29 14:42:28 GMT 2007


Author: blblack
Date: 2007-03-29 14:42:27 +0100 (Thu, 29 Mar 2007)
New Revision: 3148

Modified:
   trunk/DBIx-Class/lib/DBIx/Class/Storage/DBI.pm
Log:
fix for rt.cpan.org #25683 (DBD::Sybase/FreeTDS/MSSQL cannot have two open sths during column_info

Modified: trunk/DBIx-Class/lib/DBIx/Class/Storage/DBI.pm
===================================================================
--- trunk/DBIx-Class/lib/DBIx/Class/Storage/DBI.pm	2007-03-29 13:16:30 UTC (rev 3147)
+++ trunk/DBIx-Class/lib/DBIx/Class/Storage/DBI.pm	2007-03-29 13:42:27 UTC (rev 3148)
@@ -931,13 +931,7 @@
   my @columns = @{$sth->{NAME_lc}};
   for my $i ( 0 .. $#columns ){
     my %column_info;
-    my $type_num = $sth->{TYPE}->[$i];
-    my $type_name;
-    if(defined $type_num && $dbh->can('type_info')) {
-      my $type_info = $dbh->type_info($type_num);
-      $type_name = $type_info->{TYPE_NAME} if $type_info;
-    }
-    $column_info{data_type} = $type_name ? $type_name : $type_num;
+    $column_info{data_type} = $sth->{TYPE}->[$i];
     $column_info{size} = $sth->{PRECISION}->[$i];
     $column_info{is_nullable} = $sth->{NULLABLE}->[$i] ? 1 : 0;
 
@@ -948,7 +942,19 @@
 
     $result{$columns[$i]} = \%column_info;
   }
+  $sth->finish;
 
+  foreach my $col (keys %result) {
+    my $colinfo = $result{$col};
+    my $type_num = $colinfo->{data_type};
+    my $type_name;
+    if(defined $type_num && $dbh->can('type_info')) {
+      my $type_info = $dbh->type_info($type_num);
+      $type_name = $type_info->{TYPE_NAME} if $type_info;
+      $colinfo->{data_type} = $type_name if $type_name;
+    }
+  }
+
   return \%result;
 }
 




More information about the Bast-commits mailing list