Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not call mariadb_db_reconnect() during changing $dbh attributes unless needed #212

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

choroba
Copy link
Member

@choroba choroba commented Dec 9, 2024

Fixes #211.

pali added 2 commits December 25, 2024 19:39
…en not needed

Currently mariadb_db_STORE_attrib() function (handler for changing dbh
attributes via $dbh->{...} = ... syntax) at its beginning calls function
mariadb_db_reconnect() to ensure that imp_dbh->pmysql connection structure
is initialized.

Change logic of mariadb_db_STORE_attrib() function to call function
mariadb_db_reconnect() only when the changing of attribute really requires
active connection.

This change fixes a problem that Perl for locatized variables is trying to
restore its original value after leaving the scope, and this is failing for
restoring the DBI attributes.

Trying to change common DBI attributes (those which first letter is upper
case) except the AutoConnect, is not handled by DBD::MariaDB driver, and
therefore DBD::MariaDB driver does not have to check if the connection is
still active.
Add test case that custom HandleError and also localized custom HandleError
does not trigger any error after disconnect.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
review needed This PR needs a review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DBD::MariaDB V1.23 - STORE raise error '2006 - MySQL server has gone away' after requested disconnect
2 participants