A DBI driver should pass the following tests:

  my @ti = $dbh->type_info;
  ok( @ti,'type_info');

  my $tia = $dbh->type_info_all;
  is( ref $tia,'ARRAY','type_info_all');

  my $idx = shift @$tia;
  is( ref $idx,'HASH','index hash');

However, the last test fails with an implementation of
type_info_all() generated by DBI::DBD::Metadata.
That's because type_info() shifts the first element from
the array ref which type_info_all() returns, i.e. from
the original data structure.
The attached patch modifies type_info_all() such that it
returns a shallow copy.
Or should type_info_all() return a deep copy?


Steffen
Index: lib/DBI/DBD/Metadata.pm
===================================================================
--- lib/DBI/DBD/Metadata.pm     (revision 863)
+++ lib/DBI/DBD/Metadata.pm     (working copy)
@@ -243,7 +243,7 @@
   sub type_info_all {
     my ($dbh) = @_;
     require DBD::Driver::TypeInfo;
-    return $DBD::Driver::TypeInfo::type_info_all;
+    return [ @$DBD::Driver::TypeInfo::type_info_all ];
   }
 
 Please replace Driver (or "<foo>") with the name of your driver.
@@ -326,7 +326,7 @@
     {
         my (\$dbh) = [EMAIL PROTECTED];
         require DBD::${driver}::TypeInfo;
-        return \$DBD::${driver}::TypeInfo::type_info_all;
+        return [ [EMAIL PROTECTED]::${driver}::TypeInfo::type_info_all ];
     }
 
 # Transfer this to lib/DBD/${driver}/TypeInfo.pm.

Reply via email to