In order to properly test take_imp_data implementation, one needs to be able to test that when a second connect is issued and dbi_imp_data is passed:

    my $dbh = DBI->connect($test_dsn, $test_user, $test_password,
             { dbi_imp_data => $imp_data });

a new connection won't be opened. Any ideas how to write such a test?

I've hacked the following for mysql:

# XXX: this is a non-portable hack used for testing. want to find a
# method that will allow us to get the connection ID and then later on
# verify that the same ID is used.
sub connection_id {
    my $dbh = shift;

my $hash_ref = $dbh->selectall_hashref("SHOW FULL PROCESSLIST", [qw(User Id)]);

    my @ids = keys % { $hash_ref->{stas} };

    return sort @ids;
}

so here I grab the list of connection ids before the second connect and after it and verify that it's the same list.

but not only it's mysql-specific, it won't work for most users, since "SHOW FULL PROCESSLIST" requires special perms in the mysql setup, which by default aren't on for no one but root.


Here is the current test:




-- __________________________________________________________________ Stas Bekman JAm_pH ------> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com

Reply via email to