Henri Asseily wrote:
I'm trying to do the following, and was wondering where I should look to get a good handle on what's going on:
I have an $sth that's pointing to a dead server. I have a new $sth2 that's pointing to a good server.
upon the user doing $sth->execute, I want to be able to get $sth pointing to $sth2, effectively making $sth valid again.
I understand that $sth is a tied hash. Can it be cleanly untied and retied to what $sth2 is tied to? Would that do what I'm looking to do?
I have no problem coding up some C, as long as I can be pointed at the relevant code in dbi.
I think your problem can be solved much simpler:
- Write a pure Perl DBD driver, roughly comparable to DBD::Proxy.
- Your Perl DBD drivers classes (dbh, sth) would use references to the actual handles internally.
- Whenever required, update the internal handles.
It's quite possible, that a similar solution already exists, for example DBD::Multiplex or however it is called.
Jochen