http://www.perlmonks.org?node_id=519158


in reply to Re^7: Tricks with DBI
in thread Tricks with DBI

I was thinking about the OPs problem over dinner yesterday. I would imagine that the problem exists when you've got one handle open for read and you need to open another one with exactly the same statement. I wonder if prepare_cached could be changed to instead of just storing one handle, store an arrayref of them. When prepare_cached was called, it would go to the appropriate arrayref (via a hash lookup), and start iterating, calling $sth->{Active} on each until it finds one that isn't active, at which point it returns that one. If it fails to find an inactive one, it creates a new one and stores it. In the general case, you'd have only one stored. But, in cases like the OPs, it would just magically work. :)

thor

The only easy day was yesterday