prepare handle & autoreconnect - question #28

Perlover opened this Issue Feb 12, 2013 · 1 comment


None yet

2 participants


Good day!

Thanks for nice module!
But i have question for future using.

Suppose i made everywhere like this:

my $sth = $conn->dbh->prepare(..);

Then by some reasons a connection was lost.
Your module made auto-reconnect and as i understand after reconnect will be:

$conn->dbh != $old_dbh


And question: can i use $sth after reconnect (auto-reconnect is transparent so this will be difficult to check this every time) or should i do prepare again?
And same question for fork situations: if i made and got $sth in parent, then made fork - can i use $sth in child without new prepare?

I am interested for situations when i use $sth outside of txn, run methods. I understand if i will make sub {} with fixup method where prepare will be - it will work fine: a prepare will rerun. But for old programs i cannot remake logic to your module quickly and in my projects i use $sth outside. If i use DBD::mysql module - there i has mysql_auto_reconnect to true.


@theory theory closed this Feb 12, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment