This patch should make the cleanup handlers roll back all database handles
that have been used in a script, rather than just the last one connected.
Currently, $Idx is a file-scoped variable, and gets overwritten with each
call to Apache::DBI::connect.

I've made $Idx a lexical variable scoped to connect(), and pass it as a
parameter to cleanup().  This necessitated pushing a closure ("sub {
cleanup($Idx) }") onto the cleanup handlers.

The real reason I wrote this was that I have a DBD driver that aggregates
several database handles into one virtual handle.  It was calling
DBI->connect from inside its own connect method, and strange bugs started
popping up when it was run under Apache::DBI.  It turns out that the inner
connect() calls were causing $Idx to be overwritten, so the handle got
stored in the wrong slot in %Connected.

This patch makes Apache::DBI::connect reentrant, and my problem goes away.

Joe

Attachment: DBI.pm.patch
Description: Binary data

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html

Reply via email to