Skip Menu |
 

This queue is for tickets about the DBD-InterBase CPAN distribution.

Report information
The Basics
Id: 53671
Status: new
Priority: 0/
Queue: DBD-InterBase

People
Owner: Nobody in particular
Requestors: mjp [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.48
Fixed in: (no value)

Attachments
DBD-InterBase-0.48-test-cachedkids.patch



Subject: t/31prepare.t fails with modern DBI >= 1.605
The TEST_CACHED block in t/31prepare.t improperly tests the key format of $dbh->{CachedKids}, which format is undocumented and unreliable and changed to break the tests in DBI-1.605 (released 2008-06-16). The attached patch preserves the spirit of those tests while respecting the caution in DBI::Changes, which says "you shouldn't depend on [CachedKids' key format] anyway." :) Example of failure without the patch: [mjp@wrench DBD-InterBase-0.48-X1lQUS]$ prove -b t/31prepare.t t/31prepare.t .. 3/36 # Failed test 'cached "SELECT id FROM TESTAC"' # at t/31prepare.t line 70. # AutoCommit is now turned Off # Failed test 'cached "SELECT id FROM TESTAC"' # at t/31prepare.t line 70. # Looks like you failed 2 tests of 36. t/31prepare.t .. Dubious, test returned 2 (wstat 512, 0x200) Failed 2/36 subtests Test Summary Report ------------------- t/31prepare.t (Wstat: 512 Tests: 36 Failed: 2) Failed tests: 19, 29 Non-zero exit status: 2 Files=1, Tests=36, 1 wallclock secs ( 0.06 usr 0.02 sys + 0.08 cusr 0.03 csys = 0.19 CPU) Result: FAIL
Subject: DBD-InterBase-0.48-test-cachedkids.patch
--- t/31prepare.t.orig 2010-01-13 22:06:57.000000000 -0600 +++ t/31prepare.t 2010-01-13 22:17:28.000000000 -0600 @@ -62,11 +62,13 @@ TEST_CACHED: { $prepare_sub = sub { $dbh->prepare_cached(shift), "prepare_cached" }; - my $k; + my ($query, $n_cached); - $k = simpleQuery($dbh, $prepare_sub); - my $ck = $dbh->{CachedKids}; - ok($ck->{$k}, qq{cached "$k"}); + $query = simpleQuery($dbh, $prepare_sub); + for (values %{$dbh->{CachedKids}}) { + $n_cached++ if $_->{Statement} eq $query; + } + is($n_cached, 1, qq{cached "$query"}); $dbh->commit() unless $dbh->{AutoCommit}; @@ -75,11 +77,11 @@ # ok($dbh->{CachedKids}{$k}, qq{cached "$k"}); # $dbh->rollback() unless $dbh->{AutoCommit}; - $k = simpleQuery($dbh, $prepare_sub); - is(scalar keys(%$ck), 1); + $query = simpleQuery($dbh, $prepare_sub); + is(scalar keys(%{$dbh->{CachedKids}}), 1); # clear cached sth - %$ck = (); + %{$dbh->{CachedKids}} = (); # wrong: # $dbh->{CachedKids} = undef;


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.