Hi all,

I found a strange problem in DBI::type_info().
I don't know much of DBI internals. Only found that "sometimes",
the 'type_info_all' structure returned by the driver is
mangled by some shift() that happens in DBI::type_info().

This happens only for DBD::Informix driver (2003.04, but last version
still has the problem), while for example, DBD::Pg doesn't show
the problem.

The following patch solves the problem, and I think shows also
the reason why.
I don't know whether it's more appropriate to apply this patch
to DBI or to modify DBD::Informix::TypeInfo to return a new structure
every time. No, bad. Probably it's better to change in DBI.pm.


--- DBI.pm  2006-10-30 21:35:19.000000000 +0100
+++ DBI_cosimo.pm   2006-11-22 09:38:47.459177881 +0100
@@ -1713,8 +1713,11 @@
    else {
        my $temp = $dbh->type_info_all;
        return unless $temp && @$temp;
+       # make a temporary copy of tia structure returned by driver, to avoid
+       # mangling of driver's internal ref (see 
$DBD::Informix::TypeInfo::type_info_all)
+       my @temp_copy = @$temp;
        # we cache here because type_info_all may be expensive to call
-       $tia      = $dbh->{dbi_type_info_row_cache} = $temp;
+       $tia      = $dbh->{dbi_type_info_row_cache} = [EMAIL PROTECTED];
        $idx_hash = $dbh->{dbi_type_info_idx_cache} = shift @$tia;
    }


--
Cosimo

Reply via email to