Re: Unusual behavior with $sth->{NAME} and friends

Tim Bunce <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.dbi.sybase.devel
Message-ID <[email protected]>
The finish() docs say:

  Calling C<finish> resets the L</Active> attribute for the statement.  It
  may also make some statement handle attributes (such as C<NAME> and C<TYPE>)
  unavailable if they have not already been accessed (and thus cached).

Tim.


On Thu, Aug 07, 2008 at 04:29:25PM -0000, Greg Sabino Mullane wrote:
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: RIPEMD160
> 
> 
> I noticed something odd with NAME and NAME_lc / NAME_uc: if
> they are called, and then called *again* after $sth->finish()
> is called, both NAME_lc and NAME_uc return the previous values
> instead of an undef. I'm not sure if this is a DBI or
> DBD::Pg issue, but I thought I'd see if people can perhaps
> duplicate this on other DBDs:
> 
> $sth = $dbh->prepare(q{SELECT 123 AS "Goldfish"});
> $sth->execute();
> print Dumper $sth->{NAME};
> print Dumper $sth->{NAME_lc};
> $sth->finish();
> print Dumper $sth->{NAME};
> print Dumper $sth->{NAME_lc};
> print Dumper $sth->{NAME_uc};
> 
> For DBD::Pg, it prints:
> 
> $VAR1 = [
>           'Goldfish'
>         ];
> $VAR1 = [
>           'goldfish'
>         ];
> $VAR1 = undef;
> $VAR1 = [
>           'goldfish'
>         ];
> $VAR1 = undef;
> 
> I also got a CPAN tester report today that is almost certainly related. It can
> be seen here:
> 
> http://www.nntp.perl.org/group/perl.cpan.testers/2008/08/msg1997411.html
> 
> The relevant info is:
> 
> Assertion i == (((((SV *) (name_av))->sv_flags & 0x00800000)) ?
> Perl_mg_size(my_perl, (SV *) name_av) : ((XPVAV*) (name_av)->sv_any)->xav_fill)+1
> failed: file "DBI.xs", line 2001 at /usr/lib/perl5/5.10.0/Test/More.pm line 821.
> # Looks like you planned 250 tests but only ran 95.
> 
> Test 96 is this on line 623 of 02attribs.t:
> 
> $t='Statement handle attribute "NAME_uc" returns empty arrayref for updates';
> is_deeply ($sth->{'NAME_uc'}, [], $t);
> 
> The file is here to see it in context:
> 
> http://search.cpan.org/src/TURNSTEP/DBD-Pg-2.9.0/t/02attribs.t
> 
> 
> - --
> Greg Sabino Mullane [email protected]
> End Point Corporation
> PGP Key: 0x14964AC8 200808071224
> http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8
> -----BEGIN PGP SIGNATURE-----
> 
> iEYEAREDAAYFAkibIqkACgkQvJuQZxSWSsgNsACg3VoEuo0AffJo8hHOC5xizqA1
> H10AoIAi7UzE++v+7/8peJfzfgdTdJ82
> =CoBV
> -----END PGP SIGNATURE-----
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.