Re: Unusual behavior with $sth-{NAME} and friends
On Mon, Aug 18, 2008 at 09:40:52PM -, Greg Sabino Mullane wrote: The finish() docs say: Calling Cfinish resets the L/Active attribute for the statement. It may also make some statement handle attributes (such as CNAME and CTYPE) unavailable if they have not already been accessed (and thus cached). Sure, but why is NAME_lc cached and NAME not? I'd guess that's a 'bug' in DBD::mysql. It implements the NAME attribute. The NAME_* attributes are implemented by the DBI. And why the differing behavior depending on the DBD? I think DBD::mysql is the only driver to exhibit this behaviour. I'd be happy to see it 'fixed' but I don't know how difficult it would be. I admit this is fairly corner case but it smells like there is some subtle bug here. I'm confident a patch to cache NAME (and other sth metadata attribs) would be welcome - and probably quite simple. Tim.
Re: Unusual behavior with $sth-{NAME} and friends
-BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 The finish() docs say: Calling Cfinish resets the L/Active attribute for the statement. It may also make some statement handle attributes (such as CNAME and CTYPE) unavailable if they have not already been accessed (and thus cached). Sure, but why is NAME_lc cached and NAME not? And why the differing behavior depending on the DBD? I admit this is fairly corner case but it smells like there is some subtle bug here. - -- Greg Sabino Mullane [EMAIL PROTECTED] End Point Corporation PGP Key: 0x14964AC8 200808181740 http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8 -BEGIN PGP SIGNATURE- iEYEAREDAAYFAkip7FYACgkQvJuQZxSWSsiYTACePxYxbJacbhNp2SfvjPYPiCyq lLwAniS+t6sQTqc4x+sq9urIEcN8j9yi =LIDf -END PGP SIGNATURE-
Unusual behavior with $sth-{NAME} and friends
-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 0x0080)) ? 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-
Re: Unusual behavior with $sth-{NAME} and friends
On Aug 7, 2008, at 09:29, Greg Sabino Mullane wrote: For DBD::Pg, it prints: $VAR1 = [ 'Goldfish' ]; $VAR1 = [ 'goldfish' ]; $VAR1 = undef; $VAR1 = [ 'goldfish' ]; $VAR1 = undef; DBD::SQLite: $VAR1 = [ 'Goldfish' ]; $VAR1 = [ 'goldfish' ]; $VAR1 = undef; $VAR1 = [ 'goldfish' ]; $VAR1 = undef; DBD::mysql: $VAR1 = [ 'Goldfish' ]; $VAR1 = [ 'goldfish' ]; $VAR1 = [ 'Goldfish' ]; $VAR1 = [ 'goldfish' ]; $VAR1 = [ 'GOLDFISH' ]; Best, David
Re: Unusual behavior with $sth-{NAME} and friends
The finish() docs say: Calling Cfinish resets the L/Active attribute for the statement. It may also make some statement handle attributes (such as CNAME and CTYPE) unavailable if they have not already been accessed (and thus cached). Tim. On Thu, Aug 07, 2008 at 04:29:25PM -, 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 0x0080)) ? 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-